parent
106a314a38
commit
dc0486883d
@ -0,0 +1,142 @@
|
|||||||
|
<?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.hw.mes.mapper.MesBomAttachChangeMapper">
|
||||||
|
|
||||||
|
<resultMap type="MesBomAttachChange" id="MesBomAttachChangeResult">
|
||||||
|
<result property="attachChangeId" column="attach_change_id" />
|
||||||
|
<result property="materialBomId" column="material_bom_id" />
|
||||||
|
<result property="attachType" column="attach_type" />
|
||||||
|
<result property="oldAttachId" column="old_attach_id" />
|
||||||
|
<result property="newAttachId" column="new_attach_id" />
|
||||||
|
<result property="changeType" column="change_type" />
|
||||||
|
<result property="planId" column="plan_id" />
|
||||||
|
<result property="planCode" column="plan_code" />
|
||||||
|
<result property="changeUserId" column="change_user_id" />
|
||||||
|
<result property="changeBy" column="change_by" />
|
||||||
|
<result property="changeTime" column="change_time" />
|
||||||
|
<result property="attachName" column="attach_name" />
|
||||||
|
<result property="attachPath" column="attach_path" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectMesBomAttachChangeVo">
|
||||||
|
select attach_change_id, material_bom_id,attach_type, old_attach_id, new_attach_id, change_type, plan_id, plan_code, change_user_id, change_by, change_time from mes_bom_attach_change
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectMesBomAttachChangeList" parameterType="MesBomAttachChange" resultMap="MesBomAttachChangeResult">
|
||||||
|
<include refid="selectMesBomAttachChangeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="materialBomId != null "> and material_bom_id = #{materialBomId}</if>
|
||||||
|
<if test="attachType != null "> and attach_type = #{attachType}</if>
|
||||||
|
<if test="oldAttachId != null "> and old_attach_id = #{oldAttachId}</if>
|
||||||
|
<if test="newAttachId != null "> and new_attach_id = #{newAttachId}</if>
|
||||||
|
<if test="changeType != null and changeType != ''"> and change_type = #{changeType}</if>
|
||||||
|
<if test="planId != null "> and plan_id = #{planId}</if>
|
||||||
|
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
|
||||||
|
<if test="changeUserId != null "> and change_user_id = #{changeUserId}</if>
|
||||||
|
<if test="changeBy != null and changeBy != ''"> and change_by = #{changeBy}</if>
|
||||||
|
<if test="changeTime != null "> and change_time = #{changeTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMesBomAttachChangeByAttachChangeId" parameterType="Long" resultMap="MesBomAttachChangeResult">
|
||||||
|
<include refid="selectMesBomAttachChangeVo"/>
|
||||||
|
where attach_change_id = #{attachChangeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertMesBomAttachChange" parameterType="MesBomAttachChange" useGeneratedKeys="true" keyProperty="attachChangeId">
|
||||||
|
insert into mes_bom_attach_change
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="materialBomId != null">material_bom_id,</if>
|
||||||
|
<if test="attachType != null">attach_type,</if>
|
||||||
|
<if test="oldAttachId != null">old_attach_id,</if>
|
||||||
|
<if test="newAttachId != null">new_attach_id,</if>
|
||||||
|
<if test="changeType != null">change_type,</if>
|
||||||
|
<if test="planId != null">plan_id,</if>
|
||||||
|
<if test="planCode != null">plan_code,</if>
|
||||||
|
<if test="changeUserId != null">change_user_id,</if>
|
||||||
|
<if test="changeBy != null">change_by,</if>
|
||||||
|
<if test="changeTime != null">change_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="materialBomId != null">#{materialBomId},</if>
|
||||||
|
<if test="attachType != null">#{attachType},</if>
|
||||||
|
<if test="oldAttachId != null">#{oldAttachId},</if>
|
||||||
|
<if test="newAttachId != null">#{newAttachId},</if>
|
||||||
|
<if test="changeType != null">#{changeType},</if>
|
||||||
|
<if test="planId != null">#{planId},</if>
|
||||||
|
<if test="planCode != null">#{planCode},</if>
|
||||||
|
<if test="changeUserId != null">#{changeUserId},</if>
|
||||||
|
<if test="changeBy != null">#{changeBy},</if>
|
||||||
|
<if test="changeTime != null">#{changeTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateMesBomAttachChange" parameterType="MesBomAttachChange">
|
||||||
|
update mes_bom_attach_change
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="materialBomId != null">material_bom_id = #{materialBomId},</if>
|
||||||
|
<if test="oldAttachId != null">old_attach_id = #{oldAttachId},</if>
|
||||||
|
<if test="newAttachId != null">new_attach_id = #{newAttachId},</if>
|
||||||
|
<if test="changeType != null">change_type = #{changeType},</if>
|
||||||
|
<if test="planId != null">plan_id = #{planId},</if>
|
||||||
|
<if test="planCode != null">plan_code = #{planCode},</if>
|
||||||
|
<if test="changeUserId != null">change_user_id = #{changeUserId},</if>
|
||||||
|
<if test="changeBy != null">change_by = #{changeBy},</if>
|
||||||
|
<if test="changeTime != null">change_time = #{changeTime},</if>
|
||||||
|
</trim>
|
||||||
|
where attach_change_id = #{attachChangeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteMesBomAttachChangeByAttachChangeId" parameterType="Long">
|
||||||
|
delete from mes_bom_attach_change where attach_change_id = #{attachChangeId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteMesBomAttachChangeByAttachChangeIds" parameterType="String">
|
||||||
|
delete from mes_bom_attach_change where attach_change_id in
|
||||||
|
<foreach item="attachChangeId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{attachChangeId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="batchMesBomAttachChange">
|
||||||
|
insert into mes_bom_attach_change( material_bom_id,attach_type, old_attach_id, new_attach_id, change_type, plan_id, plan_code, change_user_id, change_by, change_time) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
( #{item.materialBomId}, #{item.attachType}, #{item.oldAttachId}, #{item.newAttachId}, #{item.changeType}, #{item.planId}, #{item.planCode}, #{item.changeUserId}, #{item.changeBy}, #{item.changeTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectMesBomAttachChangeJoinList" parameterType="MesBomAttachChange" resultMap="MesBomAttachChangeResult">
|
||||||
|
select
|
||||||
|
a.attach_change_id,
|
||||||
|
a.material_bom_id,
|
||||||
|
a.attach_type,
|
||||||
|
a.old_attach_id,
|
||||||
|
a.new_attach_id,
|
||||||
|
a.change_type,
|
||||||
|
a.plan_id,
|
||||||
|
a.plan_code,
|
||||||
|
a.change_user_id,
|
||||||
|
a.change_by,
|
||||||
|
a.change_time,
|
||||||
|
b.attach_name,
|
||||||
|
b.attach_path
|
||||||
|
from mes_bom_attach_change a
|
||||||
|
left join mes_base_attach_info b on a.new_attach_id = b.attach_id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="materialBomId != null "> and material_bom_id = #{materialBomId}</if>
|
||||||
|
<if test="attachType != null "> and a.attach_type = #{attachType}</if>
|
||||||
|
<if test="oldAttachId != null "> and old_attach_id = #{oldAttachId}</if>
|
||||||
|
<if test="newAttachId != null "> and new_attach_id = #{newAttachId}</if>
|
||||||
|
<if test="changeType != null and changeType != ''"> and a.change_type = #{changeType}</if>
|
||||||
|
<if test="changeBy != null and changeBy != ''"> and change_by like concat( '%', #{changeBy}, '%')</if>
|
||||||
|
<if test="changeTime != null "> and change_time = #{changeTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue