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.
udi-wms-java/src/main/resources/mybatis/mapper/inout/ReceiveDao.xml

74 lines
3.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.glxp.api.dao.inout.ReceiveDao">
<select id="filterList" resultType="com.glxp.api.res.inout.ReceiveResponse">
select io.*,
( SELECT originName FROM basic_bustype_change bus WHERE bus.originAction = io.billType ) billTypeName,
(select name from auth_dept ad where ad.code = io.deptCode) deptName,
(select name from auth_warehouse aw where aw.code = io.invCode) invName,
(select employeeName from auth_user au where au.id = io.createUser) createUserName,
(select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName,
(select employeeName from auth_user au3 where au3.id = io.auditUser) auditUserName,
(select name from auth_dept ad2 where ad2.code = io.targetDeptCode) targetDeptName,
(select name from auth_warehouse aw2 where aw2.code = io.targetInvCode) targetInvName
from pur_receive as io
<where>
<if test="billType != null and billType != ''">
AND billType = #{billType}
</if>
<if test="corpName != null and corpName != ''">
AND ( SELECT name FROM auth_warehouse aw2 WHERE aw2.CODE = io.targetInvCode ) = #{corpName}
</if>
<if test="billNo != null and billNo != ''">
AND billNo like concat('%', #{billNo}, '%')
</if>
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="createUser != '' and createUser != null">
AND io.createUser = #{createUser}
</if>
<if test="targetInvCode != null and targetInvCode != ''">
AND targetInvCode = #{targetInvCode}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND date_format(createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startAuditTime != null and startAuditTime != '' and endAuditTime != null and endAuditTime != ''">
AND date_format(auditTime, '%Y-%m-%d') between date_format(#{startAuditTime}, '%Y-%m-%d') and date_format(#{endAuditTime}, '%Y-%m-%d')
</if>
<if test="startTime != null and startTime != '' and (endTime == null or endTime == '')">
AND date_format(createTime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != '' and (startTime == null or startTime == '')">
AND date_format(createTime, '%Y-%m-%d') &lt;= date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="type == 1">
AND (status=1 or status=2 or status=4)
</if>
<if test="type == 2">
AND (status=2)
</if>
<if test="type == 3">
AND (status=3 or status=4)
</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>
</mapper>