|
|
|
<?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.IoOrderDao">
|
|
|
|
<select id="filterList" resultType="com.glxp.api.res.inout.IoOrderResponse">
|
|
|
|
select io.*,
|
|
|
|
(select name from basic_bussiness_type bus where bus.action = io.action) 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.reviewUser) reviewUserName,
|
|
|
|
(select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName,
|
|
|
|
(select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName,
|
|
|
|
(select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName
|
|
|
|
from io_order as io
|
|
|
|
<where>
|
|
|
|
<if test="id != null and id != ''">
|
|
|
|
AND id = #{id}
|
|
|
|
</if>
|
|
|
|
<if test="action != null and action != ''">
|
|
|
|
AND action = #{action}
|
|
|
|
</if>
|
|
|
|
<if test="mainAction != null and mainAction != ''">
|
|
|
|
AND mainAction = #{mainAction}
|
|
|
|
</if>
|
|
|
|
<if test="billNo != null and billNo != ''">
|
|
|
|
AND billNo like concat('%', #{billNo}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="corpOrderId != null and corpOrderId != ''">
|
|
|
|
AND corpOrderId = #{corpOrderId}
|
|
|
|
</if>
|
|
|
|
<if test="fromCorp != null and fromCorp != ''">
|
|
|
|
AND fromCorp = #{fromCorp}
|
|
|
|
</if>
|
|
|
|
<if test="deptCode != null and deptCode != ''">
|
|
|
|
AND deptCode = #{deptCode}
|
|
|
|
</if>
|
|
|
|
<if test="invCode != null and invCode != ''">
|
|
|
|
AND invCode = #{invCode}
|
|
|
|
</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="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') <= date_format(#{endTime}, '%Y-%m-%d')
|
|
|
|
</if>
|
|
|
|
<if test="statuses != null and statuses.size() != 0">
|
|
|
|
AND status in
|
|
|
|
<foreach collection="statuses" index="index" item="item" open="(" close=")" separator=",">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="dealStatuses != null and dealStatuses.size() != 0">
|
|
|
|
AND dealStatus in
|
|
|
|
<foreach collection="dealStatuses" index="index" item="item" open="(" close=")" separator=",">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="orderIds != null and orderIds.size() != 0">
|
|
|
|
AND io.billNo in
|
|
|
|
<foreach collection="orderIds" index="index" item="item" open="(" close=")" separator=",">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
AND status = #{status}
|
|
|
|
</if>
|
|
|
|
<if test="orderType != null">
|
|
|
|
AND orderType = #{orderType}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="filterOrderList" resultType="com.glxp.api.entity.inout.IoOrderEntity">
|
|
|
|
select *
|
|
|
|
from io_order
|
|
|
|
<where>
|
|
|
|
<if test="billNo != null and billNo != ''">
|
|
|
|
AND billNo like concat('%', #{billNo}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="id != null and id != ''">
|
|
|
|
AND id = #{id}
|
|
|
|
</if>
|
|
|
|
<if test="action != null and action != ''">
|
|
|
|
AND action = #{action}
|
|
|
|
</if>
|
|
|
|
<if test="mainAction != null and mainAction != ''">
|
|
|
|
AND mainAction = #{mainAction}
|
|
|
|
</if>
|
|
|
|
<if test="status != null">
|
|
|
|
AND status = #{status}
|
|
|
|
</if>
|
|
|
|
<if test="corpOrderId != null and corpOrderId != ''">
|
|
|
|
AND corpOrderId = #{corpOrderId}
|
|
|
|
</if>
|
|
|
|
<if test="fromCorp != null and fromCorp != ''">
|
|
|
|
AND fromCorp = #{fromCorp}
|
|
|
|
</if>
|
|
|
|
<if test="customerId != null and customerId != ''">
|
|
|
|
AND customerId = #{customerId}
|
|
|
|
</if>
|
|
|
|
<if test="invCode != null and invCode != ''">
|
|
|
|
AND invCode = #{invCode}
|
|
|
|
</if>
|
|
|
|
<if test="deptCode != null and deptCode != ''">
|
|
|
|
AND deptCode = #{deptCode}
|
|
|
|
</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="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') <= date_format(#{endTime}, '%Y-%m-%d')
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectSupplementOrderList" resultType="com.glxp.api.entity.inout.IoOrderEntity">
|
|
|
|
SELECT *
|
|
|
|
FROM io_order
|
|
|
|
WHERE (supplementNo IS NULL OR supplementNo = '')
|
|
|
|
AND `action` IN (SELECT `action`
|
|
|
|
FROM basic_bussiness_type
|
|
|
|
WHERE supplementOrderType IS NOT NULL
|
|
|
|
OR supplementOrderType
|
|
|
|
!= '')
|
|
|
|
</select>
|
|
|
|
</mapper>
|