|
|
|
@ -20,47 +20,40 @@
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="factoryCode" column="factory_code"/>
|
|
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
|
|
<result property="productCode" column="product_code"/>
|
|
|
|
|
<result property="productName" column="product_name"/>
|
|
|
|
|
<collection property="productList" ofType="com.op.mes.domain.MesLineProduct"
|
|
|
|
|
select="com.op.mes.mapper.MesLineProductMapper.selectProductByBelongTo" column="id"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectMesLineVo">
|
|
|
|
|
select id, line_code, line_name, use_man, efficiency, attr1, attr2, attr3, attr4, create_by,
|
|
|
|
|
create_time, update_by, update_time, factory_code, del_flag from mes_line
|
|
|
|
|
select id, line_code, product_code,product_name,use_man, efficiency, attr1, attr2, attr3, attr4, create_by,
|
|
|
|
|
create_time, update_by, update_time, factory_code, del_flag from mes_line_product
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectMesLineList" parameterType="MesLine" resultMap="MesLineResult">
|
|
|
|
|
<include refid="selectMesLineVo"/>
|
|
|
|
|
select mlp.id, mlp.line_code, mlp.product_code,mlp.product_name,mlp.use_man, mlp.efficiency, mlp.attr1,
|
|
|
|
|
mlp.attr2, mlp.attr3, mlp.attr4, mlp.create_by,
|
|
|
|
|
mlp.create_time, mlp.update_by, mlp.update_time, mlp.factory_code, mlp.del_flag,
|
|
|
|
|
be.equipment_name line_name
|
|
|
|
|
from mes_line_product mlp
|
|
|
|
|
left join base_equipment be on be.equipment_code = mlp.line_code
|
|
|
|
|
<where>
|
|
|
|
|
<if test="lineCode != null and lineCode != ''">
|
|
|
|
|
and line_code = #{lineCode}
|
|
|
|
|
and mlp.line_code like concat('%', #{lineName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lineName != null and lineName != ''">
|
|
|
|
|
and line_name like concat('%', #{lineName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="useMan != null ">
|
|
|
|
|
and use_man = #{useMan}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="efficiency != null ">
|
|
|
|
|
and efficiency = #{efficiency}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null and attr1 != ''">
|
|
|
|
|
and attr1 = #{attr1}
|
|
|
|
|
and be.equipment_name like concat('%', #{lineName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null and attr2 != ''">
|
|
|
|
|
and attr2 = #{attr2}
|
|
|
|
|
<if test="productCode != null and productCode != ''">
|
|
|
|
|
and mlp.product_code like concat('%', #{productCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null and attr3 != ''">
|
|
|
|
|
and attr3 = #{attr3}
|
|
|
|
|
<if test="productName != null and productName != ''">
|
|
|
|
|
and mlp.product_name like concat('%', #{productName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null and attr4 != ''">
|
|
|
|
|
and attr4 = #{attr4}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">
|
|
|
|
|
and factory_code = #{factoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
and del_flag = '0' order by create_time
|
|
|
|
|
and mlp.del_flag = '0' order by mlp.line_code
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectMesLineById" parameterType="String"
|
|
|
|
@ -70,11 +63,49 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertMesLine" parameterType="MesLine">
|
|
|
|
|
insert into mes_line
|
|
|
|
|
insert into mes_line_product
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
|
<if test="lineCode != null">line_code,</if>
|
|
|
|
|
|
|
|
|
|
<if test="useMan != null">use_man,</if>
|
|
|
|
|
<if test="efficiency != null">efficiency,</if>
|
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
|
<if test="attr4 != null">attr4,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
|
<if test="lineCode != null">#{lineCode},</if>
|
|
|
|
|
|
|
|
|
|
<if test="useMan != null">#{useMan},</if>
|
|
|
|
|
<if test="efficiency != null">#{efficiency},</if>
|
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
|
<if test="attr4 != null">#{attr4},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertLineProduct">
|
|
|
|
|
insert into mes_line_product
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
|
<if test="lineCode != null">line_code,</if>
|
|
|
|
|
<if test="lineName != null">line_name,</if>
|
|
|
|
|
<if test="productCode != null">product_code,</if>
|
|
|
|
|
<if test="productName != null">product_name,</if>
|
|
|
|
|
<if test="useMan != null">use_man,</if>
|
|
|
|
|
<if test="efficiency != null">efficiency,</if>
|
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
@ -91,7 +122,8 @@
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
|
<if test="lineCode != null">#{lineCode},</if>
|
|
|
|
|
<if test="lineName != null">#{lineName},</if>
|
|
|
|
|
<if test="productCode != null">#{productCode},</if>
|
|
|
|
|
<if test="productName != null">#{productName},</if>
|
|
|
|
|
<if test="useMan != null">#{useMan},</if>
|
|
|
|
|
<if test="efficiency != null">#{efficiency},</if>
|
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
@ -108,10 +140,10 @@
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateMesLine" parameterType="MesLine">
|
|
|
|
|
update mes_line
|
|
|
|
|
update mes_line_product
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="lineCode != null">line_code = #{lineCode},</if>
|
|
|
|
|
<if test="lineName != null">line_name = #{lineName},</if>
|
|
|
|
|
|
|
|
|
|
<if test="useMan != null">use_man = #{useMan},</if>
|
|
|
|
|
<if test="efficiency != null">efficiency = #{efficiency},</if>
|
|
|
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
|
|
@ -127,13 +159,31 @@
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateLineProduct">
|
|
|
|
|
update mes_line_product
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="useMan != null">use_man = #{useMan},</if>
|
|
|
|
|
<if test="efficiency != null">efficiency = #{efficiency},</if>
|
|
|
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
|
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
|
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
|
|
|
<if test="attr4 != null">attr4 = #{attr4},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
|
|
|
|
<if test="delFlag != null">del_flag =#{delFlag},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where line_code = #{lineCode} and product_code= #{productCode}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMesLineById" parameterType="String">
|
|
|
|
|
update mes_line set del_flag = '1' where id = #{id}
|
|
|
|
|
update mes_line_product set del_flag = '1' where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMesLineByIds" parameterType="String">
|
|
|
|
|
update mes_line set del_flag = '1' where id in
|
|
|
|
|
update mes_line_product set del_flag = '1' where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
@ -151,8 +201,8 @@
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="validate" parameterType="MesLine" resultMap="MesLineResult">
|
|
|
|
|
select id, line_code, line_name, use_man, efficiency
|
|
|
|
|
from mes_line
|
|
|
|
|
select id, line_code, use_man, efficiency
|
|
|
|
|
from mes_line_product
|
|
|
|
|
where del_flag = '0' and line_code = #{lineCode}
|
|
|
|
|
and use_man = #{useMan} and efficiency = #{efficiency}
|
|
|
|
|
</select>
|
|
|
|
@ -166,5 +216,11 @@
|
|
|
|
|
'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectInfoByLineProduct" resultType="com.op.mes.domain.MesLine">
|
|
|
|
|
select id, line_code,use_man, efficiency
|
|
|
|
|
from mes_line_product
|
|
|
|
|
where del_flag = '0' and line_code = #{lineCode}
|
|
|
|
|
and product_code = #{productCode}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|