You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
9.7 KiB
XML
186 lines
9.7 KiB
XML
<?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.MesPurchaseApplyProcessMapper">
|
|
|
|
<resultMap type="MesPurchaseApplyProcess" id="MesPurchaseApplyProcessResult">
|
|
<result property="purchaseApplyId" column="purchase_apply_id"/>
|
|
<result property="taskCode" column="task_code"/>
|
|
<result property="materialName" column="material_name"/>
|
|
<result property="wfProcessId" column="wf_process_id"/>
|
|
<result property="processActivityId" column="process_activity_id"/>
|
|
<result property="importFlag" column="import_flag"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="processActivityName" column="process_activity_name"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="MesPurchaseApplyProcessMesPurchaseApplyProcessDetailResult" type="MesPurchaseApplyProcess"
|
|
extends="MesPurchaseApplyProcessResult">
|
|
<collection property="mesPurchaseApplyProcessDetailList" notNullColumn="sub_purchase_apply_detail_id"
|
|
javaType="java.util.List" resultMap="MesPurchaseApplyProcessDetailResult"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="MesPurchaseApplyProcessDetail" id="MesPurchaseApplyProcessDetailResult">
|
|
<result property="purchaseApplyDetailId" column="sub_purchase_apply_detail_id"/>
|
|
<result property="taskCode" column="sub_task_code"/>
|
|
<result property="processActivityId" column="sub_process_activity_id"/>
|
|
<result property="anomalyFlag" column="sub_anomaly_flag"/>
|
|
<result property="updateFlag" column="sub_update_flag"/>
|
|
<result property="noticeFlag" column="sub_notice_flag"/>
|
|
<result property="noticeAuth" column="sub_notice_auth"/>
|
|
<result property="purchaseRemark" column="sub_purchase_remark"/>
|
|
<result property="createBy" column="sub_create_by"/>
|
|
<result property="createTime" column="sub_create_time"/>
|
|
<result property="updateBy" column="sub_update_by"/>
|
|
<result property="updateTime" column="sub_update_time"/>
|
|
<result property="processActivityName" column="sub_process_activity_name"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectMesPurchaseApplyProcessVo">
|
|
select mpap.purchase_apply_id,
|
|
mpap.task_code,
|
|
mpap.material_name,
|
|
mpap.wf_process_id,
|
|
mpap.process_activity_id,
|
|
mpap.import_flag,
|
|
mpap.create_by,
|
|
mpap.create_time,
|
|
mpap.update_by,
|
|
mpap.update_time,
|
|
wpa.process_activity_name
|
|
from mes_purchase_apply_process mpap
|
|
left join wf_process_activity wpa on mpap.process_activity_id + 1 = wpa.process_activity_id
|
|
</sql>
|
|
|
|
<select id="selectMesPurchaseApplyProcessList" parameterType="MesPurchaseApplyProcess"
|
|
resultMap="MesPurchaseApplyProcessResult">
|
|
<include refid="selectMesPurchaseApplyProcessVo"/>
|
|
<where>
|
|
<if test="taskCode != null and taskCode != ''">and mpap.task_code = #{taskCode}</if>
|
|
<if test="materialName != null and materialName != ''">and mpap.material_name like concat('%', #{materialName},
|
|
'%')
|
|
</if>
|
|
<if test="wfProcessId != null ">and mpap.wf_process_id = #{wfProcessId}</if>
|
|
<if test="processActivityId != null ">and mpap.process_activity_id = #{processActivityId}</if>
|
|
<if test="importFlag != null and importFlag != ''">and mpap.import_flag = #{importFlag}</if>
|
|
</where>
|
|
order by mpap.create_time desc
|
|
</select>
|
|
|
|
<select id="selectMesPurchaseApplyProcessByPurchaseApplyId" parameterType="Long"
|
|
resultMap="MesPurchaseApplyProcessMesPurchaseApplyProcessDetailResult">
|
|
select a.purchase_apply_id,
|
|
a.task_code,
|
|
a.material_name,
|
|
a.wf_process_id,
|
|
a.process_activity_id,
|
|
a.import_flag,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
b.purchase_apply_detail_id as sub_purchase_apply_detail_id,
|
|
b.task_code as sub_task_code,
|
|
b.process_activity_id as sub_process_activity_id,
|
|
b.anomaly_flag as sub_anomaly_flag,
|
|
b.update_flag as sub_update_flag,
|
|
b.notice_flag as sub_notice_flag,
|
|
b.notice_auth as sub_notice_auth,
|
|
b.purchase_remark as sub_purchase_remark,
|
|
b.create_by as sub_create_by,
|
|
b.create_time as sub_create_time,
|
|
b.update_by as sub_update_by,
|
|
b.update_time as sub_update_time,
|
|
wpa.process_activity_name as sub_process_activity_name,
|
|
wp2.process_activity_name
|
|
from mes_purchase_apply_process a
|
|
left join mes_purchase_apply_process_detail b on b.task_code = a.task_code
|
|
left join wf_process_activity wpa on wpa.process_activity_id = b.process_activity_id
|
|
left join wf_process_activity wp2 on a.process_activity_id + 1 = wp2.process_activity_id
|
|
where a.purchase_apply_id = #{purchaseApplyId}
|
|
</select>
|
|
|
|
<insert id="insertMesPurchaseApplyProcess" parameterType="MesPurchaseApplyProcess" useGeneratedKeys="true"
|
|
keyProperty="purchaseApplyId">
|
|
insert into mes_purchase_apply_process
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="taskCode != null and taskCode != ''">task_code,</if>
|
|
<if test="materialName != null">material_name,</if>
|
|
<if test="wfProcessId != null">wf_process_id,</if>
|
|
<if test="processActivityId != null">process_activity_id,</if>
|
|
<if test="importFlag != null">import_flag,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
|
|
<if test="materialName != null">#{materialName},</if>
|
|
<if test="wfProcessId != null">#{wfProcessId},</if>
|
|
<if test="processActivityId != null">#{processActivityId},</if>
|
|
<if test="importFlag != null">#{importFlag},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateMesPurchaseApplyProcess" parameterType="MesPurchaseApplyProcess">
|
|
update mes_purchase_apply_process
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="taskCode != null and taskCode != ''">task_code = #{taskCode},</if>
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
<if test="wfProcessId != null">wf_process_id = #{wfProcessId},</if>
|
|
<if test="processActivityId != null">process_activity_id = #{processActivityId},</if>
|
|
<if test="importFlag != null">import_flag = #{importFlag},</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>
|
|
</trim>
|
|
where purchase_apply_id = #{purchaseApplyId}
|
|
</update>
|
|
|
|
<delete id="deleteMesPurchaseApplyProcessByPurchaseApplyId" parameterType="Long">
|
|
delete
|
|
from mes_purchase_apply_process
|
|
where purchase_apply_id = #{purchaseApplyId}
|
|
</delete>
|
|
|
|
<delete id="deleteMesPurchaseApplyProcessByPurchaseApplyIds" parameterType="String">
|
|
delete from mes_purchase_apply_process where purchase_apply_id in
|
|
<foreach item="purchaseApplyId" collection="array" open="(" separator="," close=")">
|
|
#{purchaseApplyId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteMesPurchaseApplyProcessDetailByTaskCodes" parameterType="String">
|
|
delete from mes_purchase_apply_process_detail where task_code in
|
|
<foreach item="taskCode" collection="array" open="(" separator="," close=")">
|
|
#{taskCode}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteMesPurchaseApplyProcessDetailByTaskCode" parameterType="Long">
|
|
delete
|
|
from mes_purchase_apply_process_detail
|
|
where task_code = #{taskCode}
|
|
</delete>
|
|
|
|
<insert id="batchMesPurchaseApplyProcessDetail">
|
|
insert into mes_purchase_apply_process_detail( purchase_apply_detail_id, task_code, process_activity_id,
|
|
anomaly_flag, update_flag, notice_flag, notice_auth, purchase_remark, create_by, create_time, update_by,
|
|
update_time) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.purchaseApplyDetailId}, #{item.taskCode}, #{item.processActivityId}, #{item.anomalyFlag},
|
|
#{item.updateFlag}, #{item.noticeFlag}, #{item.noticeAuth}, #{item.purchaseRemark}, #{item.createBy},
|
|
#{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
|
</foreach>
|
|
</insert>
|
|
</mapper> |