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.
211 lines
8.0 KiB
XML
211 lines
8.0 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.glxp.api.dao.purchase.PurApplyDao">
|
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurApplyRequest"
|
|
resultType="com.glxp.api.res.purchase.PurApplyResponse">
|
|
SELECT IFNULL(saf.status,1) as flowStatus,saf.updateTime as flowAuditTime,saf.updateUserName as flowAuditByName,
|
|
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
|
|
Left Join sys_approval_flow as saf ON pur_apply.approvalFlowId = saf.id
|
|
<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>
|
|
<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>
|
|
<if test="endAuditDate != null and endAuditDate != ''">
|
|
<![CDATA[
|
|
and DATE_FORMAT(pur_apply.auditTime, '%Y-%m-%d') <= #{endAuditDate}
|
|
]]>
|
|
</if>
|
|
|
|
<if test="!sysApprovalFlow">
|
|
<if test="status != null and status != 10 and status != 11 and status != 12 ">
|
|
and pur_apply.status = #{status}
|
|
</if>
|
|
<if test="status == 10">
|
|
and (pur_apply.status = 2 )
|
|
</if>
|
|
<if test="status == 11">
|
|
and (pur_apply.status = 1 or pur_apply.status = 2 or pur_apply.status = 4)
|
|
</if>
|
|
<if test="status == 12">
|
|
and (pur_apply.status = 3)
|
|
</if>
|
|
</if>
|
|
|
|
<if test="sysApprovalFlow">
|
|
<if test="status != null and status != 10 and status != 11 and status != 12 ">
|
|
and saf.status = #{status}
|
|
</if>
|
|
<if test="status == 10">
|
|
and (saf.status = 2)
|
|
</if>
|
|
<if test="status == 11">
|
|
and (saf.status = 1 or saf.status = 2 or saf.status = 4 or saf.status is null)
|
|
</if>
|
|
<if test="status == 12">
|
|
and (saf.status = 3)
|
|
</if>
|
|
</if>
|
|
|
|
<if test="deptCode != '' and deptCode != null">
|
|
AND pur_apply.deptCode = #{deptCode}
|
|
</if>
|
|
<if test="invCode != '' and invCode != null">
|
|
AND pur_apply.invCode = #{invCode}
|
|
</if>
|
|
<if test="targetInvCode != '' and targetInvCode != null">
|
|
AND pur_apply.targetInvCode = #{targetInvCode}
|
|
</if>
|
|
<if test="targetDeptCode != '' and targetDeptCode != null">
|
|
AND pur_apply.targetDeptCode = #{targetDeptCode}
|
|
</if>
|
|
<if test="auditUser != '' and auditUser != null">
|
|
AND pur_apply.auditUser = #{auditUser}
|
|
</if>
|
|
<if test="createUser != '' and createUser != null">
|
|
AND pur_apply.createUser = #{createUser}
|
|
</if>
|
|
<if test="applyType != null">
|
|
AND pur_apply.generatePlan = 1
|
|
</if>
|
|
<if test="emergency != null">
|
|
AND pur_apply.emergency = #{emergency}
|
|
</if>
|
|
<if test="pageType != null">
|
|
AND pur_apply.pageType = #{pageType}
|
|
</if>
|
|
<if test="productType != '' and productType != null">
|
|
AND productType = #{productType}
|
|
</if>
|
|
</where>
|
|
<choose>
|
|
<when test="(orderBy != null) and (sort == 'desc' or sort == 'asc')">
|
|
order by ${orderBy} ${sort}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY updateTime DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
|
|
<delete id="deleteByIds" parameterType="java.util.List">
|
|
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
|
|
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="approvalFlowId != null">
|
|
approvalFlowId=#{approvalFlowId},
|
|
</if>
|
|
<if test="pageType != null">
|
|
pageType=#{pageType},
|
|
</if>
|
|
<if test="productType != null">
|
|
productType=#{productType},
|
|
</if>
|
|
</trim>
|
|
WHERE id = #{id}
|
|
</update>
|
|
</mapper>
|