<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.thhy.engineering.modules.biz.moldquality.mapper.MoldQualityMapper">
|
|
|
<!--查询列表-->
|
<select id="findAll" parameterType="java.util.Map" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
|
SELECT
|
t.id,
|
t.mouldCode,
|
t.mouldNum,
|
t.blockNum,
|
t.size,
|
t.turn,
|
t.groutingHole,
|
t.content,
|
t.checkDate,
|
t.checkUnit,
|
t.createDate,
|
t.createUser,
|
t.companyId,
|
t.proId,
|
sp.pro_name proName
|
from t_mold_quality t
|
left join sys_project sp ON sp.pro_id = t.proId
|
where sp.company_id = #{companyId}
|
<if test="proId != null and proId !=''">
|
and t.proId = #{proId}
|
</if>
|
<if test="mouldNum != null and mouldNum !=''">
|
and t.mouldNum = #{mouldNum}
|
</if>
|
<if test="mouldCode != null and mouldCode !=''">
|
and t.mouldCode = #{mouldCode}
|
</if>
|
order by t.createDate desc
|
</select>
|
|
<select id="findNewOne" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
|
SELECT
|
t.id,
|
t.mouldCode,
|
t.mouldNum,
|
t.blockNum,
|
t.size,
|
t.turn,
|
t.groutingHole,
|
t.content,
|
t.checkDate,
|
t.checkUnit,
|
t.createDate,
|
t.createUser,
|
t.companyId,
|
t.proId
|
from t_mold_quality t
|
order by t.createDate desc
|
limit 1
|
</select>
|
<!--插入操作-->
|
<insert id="insert">
|
insert into t_mold_quality
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
id,
|
</if>
|
<if test="mouldCode != null">
|
mouldCode,
|
</if>
|
<if test="mouldNum != null">
|
mouldNum,
|
</if>
|
<if test="blockNum != null">
|
blockNum,
|
</if>
|
<if test="size != null">
|
size,
|
</if>
|
<if test="turn != null">
|
turn,
|
</if>
|
<if test="groutingHole != null">
|
groutingHole,
|
</if>
|
<if test="content != null">
|
content,
|
</if>
|
<if test="checkDate != null">
|
checkDate,
|
</if>
|
<if test="checkUnit != null">
|
checkUnit,
|
</if>
|
<if test="createDate != null">
|
createDate,
|
</if>
|
<if test="createUser != null">
|
createUser,
|
</if>
|
<if test="companyId != null">
|
companyId,
|
</if>
|
<if test="proId != null">
|
proId,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null">
|
#{id,jdbcType=INTEGER},
|
</if>
|
<if test="mouldCode != null">
|
#{mouldCode,jdbcType=VARCHAR},
|
</if>
|
<if test="mouldNum != null">
|
#{mouldNum,jdbcType=VARCHAR},
|
</if>
|
<if test="blockNum != null">
|
#{blockNum,jdbcType=VARCHAR},
|
</if>
|
<if test="size != null">
|
#{size,jdbcType=VARCHAR},
|
</if>
|
<if test="turn != null">
|
#{turn,jdbcType=VARCHAR},
|
</if>
|
<if test="groutingHole != null">
|
#{groutingHole,jdbcType=VARCHAR},
|
</if>
|
<if test="content != null">
|
#{content,jdbcType=VARCHAR},
|
</if>
|
<if test="checkDate != null">
|
#{checkDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="checkUnit != null">
|
#{checkUnit,jdbcType=VARCHAR},
|
</if>
|
<if test="createDate != null">
|
#{createDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="proId != null">
|
#{proId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_mold_quality
|
<set>
|
<if test="mouldCode != null">
|
mouldCode = #{mouldCode,jdbcType=VARCHAR},
|
</if>
|
<if test="mouldNum != null">
|
mouldNum = #{mouldNum,jdbcType=VARCHAR},
|
</if>
|
<if test="blockNum != null">
|
blockNum = #{blockNum,jdbcType=VARCHAR},
|
</if>
|
<if test="size != null">
|
size = #{size,jdbcType=VARCHAR},
|
</if>
|
<if test="turn != null">
|
turn = #{turn,jdbcType=VARCHAR},
|
</if>
|
<if test="groutingHole != null">
|
groutingHole = #{groutingHole,jdbcType=VARCHAR},
|
</if>
|
<if test="content != null">
|
content = #{content,jdbcType=VARCHAR},
|
</if>
|
<if test="checkDate != null">
|
checkDate = #{checkDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="checkUnit != null">
|
checkUnit = #{checkUnit,jdbcType=VARCHAR},
|
</if>
|
<if test="createDate != null">
|
createDate = #{createDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
createUser = #{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="companyId != null">
|
companyId = #{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="proId != null">
|
proId = #{proId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id=#{id,jdbcType=INTEGER}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="delete">
|
delete from t_mold_quality
|
where id=#{id}
|
</delete>
|
|
<select id="findOneById" resultType="com.thhy.engineering.modules.biz.moldquality.entity.MoldQualityEntity">
|
select
|
t.id,
|
t.mouldCode,
|
t.mouldNum,
|
t.blockNum,
|
t.size,
|
t.turn,
|
t.groutingHole,
|
t.content,
|
t.checkDate,
|
t.checkUnit,
|
t.createDate,
|
t.createUser,
|
t.companyId,
|
t.proId,
|
sp.pro_name proName
|
from t_mold_quality t
|
left join sys_project sp ON sp.pro_id = t.proId
|
where t.id=#{id}
|
</select>
|
|
<select id="getMoldNum" resultType="java.util.Map">
|
select
|
DISTINCT mould_num mouldNum
|
from sys_mould
|
where pro_id =#{proId,jdbcType=VARCHAR}
|
</select>
|
|
<select id="getMoldCode" resultType="java.util.Map">
|
select
|
DISTINCT mould_code mouldCode
|
from sys_mould
|
where 1=1
|
<if test="proId != null and proId !=''">
|
and pro_id = #{proId}
|
</if>
|
<if test="mouldNum != null and mouldNum !=''">
|
and mould_num = #{mouldNum}
|
</if>
|
</select>
|
|
|
<select id="getMoldByProIdAndModNumAndModCode" resultType="java.util.Map">
|
select
|
sd1.dict_name as mouldTypeName,
|
sd2.dict_name as mouldSizeName,
|
sd3.dict_name as mouldTurnName,
|
sd4.dict_name as groutingHolesName
|
from sys_mould t
|
left join sys_dict sd1 on sd1.dict_id = t.mould_type
|
left join sys_dict sd2 on sd2.dict_id = t.mould_size
|
left join sys_dict sd3 on sd3.dict_id = t.mould_turn
|
left join sys_dict sd4 on sd4.dict_id = t.grouting_holes
|
WHERE t.is_use = 1
|
<if test="mouldNum!=null and mouldNum!=''">
|
and t.mould_num = #{mouldNum}
|
</if>
|
<if test="proId!=null and proId!=''">
|
and t.pro_id = #{proId}
|
</if>
|
<if test="mouldCode!=null and mouldCode!=''">
|
and t.mould_code = #{mouldCode}
|
</if>
|
</select>
|
|
</mapper>
|