|
|
|
@ -2,45 +2,54 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
|
|
|
|
|
<mapper namespace="com.glxp.api.dao.purchase.PurApplyDao">
|
|
|
|
|
|
|
|
|
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurApplyRequest"
|
|
|
|
|
resultType="com.glxp.api.res.purchase.PurApplyResponse">
|
|
|
|
|
SELECT
|
|
|
|
|
pur_apply.*,
|
|
|
|
|
cb.employeeName createByName,
|
|
|
|
|
ab.employeeName auditByName,
|
|
|
|
|
auth_warehouse.`name` targetInvName,
|
|
|
|
|
auth_dept.`name` targetDeptName
|
|
|
|
|
FROM
|
|
|
|
|
pur_apply
|
|
|
|
|
LEFT JOIN auth_user cb ON pur_apply.createUser = cb.id
|
|
|
|
|
LEFT JOIN auth_user ab ON pur_apply.auditUser = ab.id
|
|
|
|
|
LEFT JOIN auth_warehouse ON pur_apply.targetInvCode = auth_warehouse.`code`
|
|
|
|
|
LEFT JOIN auth_dept ON auth_dept.`code` = pur_apply.targetDeptCode
|
|
|
|
|
SELECT pur_apply.*,
|
|
|
|
|
cb.employeeName createByName,
|
|
|
|
|
ab.employeeName auditByName,
|
|
|
|
|
auth_warehouse.`name` targetInvName,
|
|
|
|
|
auth_dept.`name` targetDeptName,
|
|
|
|
|
aw1.`name` invName,
|
|
|
|
|
ad1.`name` deptName
|
|
|
|
|
FROM pur_apply
|
|
|
|
|
LEFT JOIN auth_user cb ON pur_apply.createUser = cb.id
|
|
|
|
|
LEFT JOIN auth_user ab ON pur_apply.auditUser = ab.id
|
|
|
|
|
LEFT JOIN auth_warehouse ON pur_apply.targetInvCode = auth_warehouse.`code`
|
|
|
|
|
LEFT JOIN auth_dept ON auth_dept.`code` = pur_apply.targetDeptCode
|
|
|
|
|
LEFT JOIN auth_warehouse aw1 ON pur_apply.invCode = aw1.`code`
|
|
|
|
|
LEFT JOIN auth_dept ad1 ON ad1.`code` = pur_apply.deptCode
|
|
|
|
|
<where>
|
|
|
|
|
<if test="billNo != '' and billNo != null">
|
|
|
|
|
AND billNo = #{billNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate != null and startDate !=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(pur_apply.createTime,'%Y-%m-%d')>= #{startDate}]]>
|
|
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(pur_apply.createTime, '%Y-%m-%d') >= #{startDate}
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null and endDate !=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(pur_apply.createTime,'%Y-%m-%d') <= #{endDate}]]>
|
|
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(pur_apply.createTime, '%Y-%m-%d') <= #{endDate}
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startAuditDate != null and startAuditDate !=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(pur_apply.auditTime,'%Y-%m-%d')>= #{startAuditDate}]]>
|
|
|
|
|
<if test="startAuditDate != null and startAuditDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(pur_apply.auditTime, '%Y-%m-%d') >= #{startAuditDate}
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endAuditDate != null and endAuditDate !=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(pur_apply.auditTime,'%Y-%m-%d') <= #{endAuditDate}]]>
|
|
|
|
|
<if test="endAuditDate != null and endAuditDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(pur_apply.auditTime, '%Y-%m-%d') <= #{endAuditDate}
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status!=null and status!=10 and status!=11">
|
|
|
|
|
<if test="status != null and status != 10 and status != 11">
|
|
|
|
|
and pur_apply.status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status ==10">
|
|
|
|
|
and ( pur_apply.status = 3 or pur_apply.status=2 or pur_apply.status=4)
|
|
|
|
|
<if test="status == 10">
|
|
|
|
|
and (pur_apply.status = 3 or pur_apply.status = 2 or pur_apply.status = 4)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status ==11">
|
|
|
|
|
and ( pur_apply.status = 1 or pur_apply.status=2 or pur_apply.status=4)
|
|
|
|
|
<if test="status == 11">
|
|
|
|
|
and (pur_apply.status = 1 or pur_apply.status = 2 or pur_apply.status = 4)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="deptCode != '' and deptCode != null">
|
|
|
|
@ -69,8 +78,8 @@
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="(orderBy!=null ) and (sort=='desc' or sort=='asc')">
|
|
|
|
|
order by ${orderBy} ${sort}
|
|
|
|
|
<when test="(orderBy != null) and (sort == 'desc' or sort == 'asc')">
|
|
|
|
|
order by ${orderBy} ${sort}
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
ORDER BY updateTime DESC
|
|
|
|
@ -81,75 +90,110 @@
|
|
|
|
|
<insert id="insert" keyProperty="id" keyColumn="id"
|
|
|
|
|
parameterType="com.glxp.api.entity.purchase.PurApplyEntity" useGeneratedKeys="true">
|
|
|
|
|
replace
|
|
|
|
|
INTO pur_apply
|
|
|
|
|
(
|
|
|
|
|
billNo,billDate,status,billType,remark,invCode,
|
|
|
|
|
deptCode,createUser,createTime,auditUser,auditTime,updateTime,updateUser ,auditRemark,
|
|
|
|
|
targetInvCode,targetDeptCode,planBillNo,generatePlan,emergency,arrivalTime
|
|
|
|
|
)
|
|
|
|
|
values (
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{billDate},
|
|
|
|
|
#{status},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{remark},
|
|
|
|
|
#{invCode},
|
|
|
|
|
#{deptCode},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{createTime},
|
|
|
|
|
#{auditUser},
|
|
|
|
|
#{auditTime},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{updateUser},
|
|
|
|
|
#{auditRemark},
|
|
|
|
|
#{targetInvCode},
|
|
|
|
|
#{targetDeptCode},
|
|
|
|
|
#{planBillNo},#{generatePlan},
|
|
|
|
|
#{emergency},#{arrivalTime}
|
|
|
|
|
)
|
|
|
|
|
INTO pur_apply
|
|
|
|
|
(billNo, billDate, status, billType, remark, invCode,
|
|
|
|
|
deptCode, createUser, createTime, auditUser, auditTime, updateTime, updateUser, auditRemark,
|
|
|
|
|
targetInvCode, targetDeptCode, planBillNo, generatePlan, emergency, arrivalTime)
|
|
|
|
|
values (#{billNo},
|
|
|
|
|
#{billDate},
|
|
|
|
|
#{status},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{remark},
|
|
|
|
|
#{invCode},
|
|
|
|
|
#{deptCode},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{createTime},
|
|
|
|
|
#{auditUser},
|
|
|
|
|
#{auditTime},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{updateUser},
|
|
|
|
|
#{auditRemark},
|
|
|
|
|
#{targetInvCode},
|
|
|
|
|
#{targetDeptCode},
|
|
|
|
|
#{planBillNo}, #{generatePlan},
|
|
|
|
|
#{emergency}, #{arrivalTime})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteByIds" parameterType="java.util.List">
|
|
|
|
|
DELETE FROM pur_apply WHERE id in
|
|
|
|
|
DELETE
|
|
|
|
|
FROM pur_apply WHERE id in
|
|
|
|
|
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteById" parameterType="long">
|
|
|
|
|
DELETE FROM pur_apply
|
|
|
|
|
DELETE
|
|
|
|
|
FROM pur_apply
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="update" parameterType="com.glxp.api.entity.purchase.PurApplyEntity">
|
|
|
|
|
UPDATE pur_apply
|
|
|
|
|
<trim prefix="set" suffixOverrides=",">
|
|
|
|
|
<if test="billNo != null">billNo=#{billNo},</if>
|
|
|
|
|
<if test="billDate != null">billDate=#{billDate},</if>
|
|
|
|
|
<if test="status != null">status=#{status},</if>
|
|
|
|
|
<if test="billType != null">billType=#{billType},</if>
|
|
|
|
|
<if test="remark != null">remark=#{remark},</if>
|
|
|
|
|
<if test="invCode != null">invCode=#{invCode},</if>
|
|
|
|
|
<if test="deptCode != null">deptCode=#{deptCode},</if>
|
|
|
|
|
<if test="auditUser != null">auditUser=#{auditUser},</if>
|
|
|
|
|
<if test="auditTime != null">auditTime=#{auditTime},</if>
|
|
|
|
|
<if test="createUser != null">createUser=#{createUser},</if>
|
|
|
|
|
<if test="createTime != null">createTime=#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
|
|
|
|
<if test="updateUser != null">updateUser=#{updateUser},</if>
|
|
|
|
|
<if test="auditRemark != null">auditRemark=#{auditRemark},</if>
|
|
|
|
|
<if test="targetInvCode != null">targetInvCode=#{targetInvCode},</if>
|
|
|
|
|
<if test="targetDeptCode != null">targetDeptCode=#{targetDeptCode},</if>
|
|
|
|
|
<if test="planBillNo != null">planBillNo=#{planBillNo},</if>
|
|
|
|
|
<if test="generatePlan != null">generatePlan=#{generatePlan},</if>
|
|
|
|
|
<if test="emergency != null">emergency=#{emergency},</if>
|
|
|
|
|
<if test="arrivalTime != null">arrivalTime=#{arrivalTime},</if>
|
|
|
|
|
<if test="billNo != null">
|
|
|
|
|
billNo=#{billNo},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billDate != null">
|
|
|
|
|
billDate=#{billDate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null">
|
|
|
|
|
status=#{status},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billType != null">
|
|
|
|
|
billType=#{billType},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="remark != null">
|
|
|
|
|
remark=#{remark},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invCode != null">
|
|
|
|
|
invCode=#{invCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deptCode != null">
|
|
|
|
|
deptCode=#{deptCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="auditUser != null">
|
|
|
|
|
auditUser=#{auditUser},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="auditTime != null">
|
|
|
|
|
auditTime=#{auditTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createUser != null">
|
|
|
|
|
createUser=#{createUser},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createTime != null">
|
|
|
|
|
createTime=#{createTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
updateTime=#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateUser != null">
|
|
|
|
|
updateUser=#{updateUser},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="auditRemark != null">
|
|
|
|
|
auditRemark=#{auditRemark},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="targetInvCode != null">
|
|
|
|
|
targetInvCode=#{targetInvCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="targetDeptCode != null">
|
|
|
|
|
targetDeptCode=#{targetDeptCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="planBillNo != null">
|
|
|
|
|
planBillNo=#{planBillNo},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="generatePlan != null">
|
|
|
|
|
generatePlan=#{generatePlan},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="emergency != null">
|
|
|
|
|
emergency=#{emergency},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="arrivalTime != null">
|
|
|
|
|
arrivalTime=#{arrivalTime},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|