97 lines
3.5 KiB
XML
97 lines
3.5 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.bonus.material.part.mapper.PartLeaseMapper">
|
|
|
|
<select id="selectPartLeaseInfoById" resultType="com.bonus.material.part.domain.PartLeaseInfo">
|
|
</select>
|
|
|
|
<select id="selectPartLeaseInfoList" resultType="com.bonus.material.part.domain.PartLeaseInfo">
|
|
select task_id, code, creator, create_time, auditor, audit_time, status, remarks, company_id
|
|
from pa_collar_apply
|
|
<where>
|
|
<if test="taskId != null ">
|
|
and task_id = #{taskId}
|
|
</if>
|
|
<if test="code != null and code != ''">
|
|
and `code` = #{code}
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
and creator = #{creator}
|
|
</if>
|
|
</where>
|
|
orber by create_time desc
|
|
</select>
|
|
|
|
<insert id="insertPartLeaseInfo">
|
|
insert into pa_collar_apply(task_id, code, creator, create_time, status, remarks, company_id)
|
|
values (#{taskId}, #{code}, #{creator}, now(), 0, #{remarks}, #{companyId})
|
|
</insert>
|
|
|
|
<delete id="removePartLeaseInfoByIds">
|
|
delete from pa_collar_apply where task_id in
|
|
<foreach item="taskId" collection="array" open="(" separator="," close=")">
|
|
#{taskId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectPartLeaseDetailsList" resultType="com.bonus.material.part.domain.PartLeaseDetails">
|
|
select pcad.id, pcad.task_id, pcad.part_id, mpt.pa_name as partName, pcad.pre_num, pcad.al_num, pcad.remarks
|
|
from pa_collar_apply_details pcad
|
|
left join ma_part_type mpt on pcad.part_id = mpt.pa_id
|
|
<where>
|
|
<if test="taskId != null ">
|
|
and pcad.task_id = #{taskId}
|
|
</if>
|
|
<if test="partId != null ">
|
|
and pcad.part_id = #{partId}
|
|
</if>
|
|
<if test="partName != null and partName != ''">
|
|
and pcad.part_name = #{partName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="insertPartLeaseDetails">
|
|
insert into pa_collar_apply_details(task_id, part_id, pre_num, al_num, remarks)
|
|
values (#{taskId}, #{partId}, #{preNum}, #{alNum}, #{remarks})
|
|
</insert>
|
|
|
|
<insert id="batchPartLeaseDetails">
|
|
insert into pa_collar_apply_details(task_id, part_id, pre_num, al_num, remarks)
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.taskId}, #{item.partId}, #{item.preNum}, #{item.alNum}, #{item.remarks})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updatePartLeaseInfo">
|
|
update pa_collar_apply
|
|
<set>
|
|
<if test="code != null and code != ''">
|
|
`code` = #{code},
|
|
</if>
|
|
<if test="auditor !=null">
|
|
auditor = #{auditor},
|
|
</if>
|
|
<if test="audit_time != null">
|
|
audit_time = #{auditTime},
|
|
</if>
|
|
<if test="status != null">
|
|
`status` = #{status},
|
|
</if>
|
|
<if test="remarks != null and remarks != ''">
|
|
remarks = #{remarks}
|
|
</if>
|
|
</set>
|
|
where task_id = #{taskId}
|
|
</update>
|
|
|
|
<update id="removePartLeaseDetailsByIds">
|
|
delete pa_collar_apply_details where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
</mapper> |