自动化立体仓库 - WMS系统
#
zyx
2024-06-26 26d5890bf75f0917eca93d2d1780bf5aea0cec7a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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.zy.asrs.mapper.ManPakOutMapper">
 
    <sql id="selectPakOutSql">
        <if test="docnum != null and docnum != '' ">
            and doc_num like '%' + #{docnum} + '%'
        </if>
        <if test="custName != null and custName != ''">
            and cust_name like '%' + #{custName} + '%'
        </if>
        <if test="stime != null">
            and create_time >= #{stime}
        </if>
        <if test="etime != null">
            and create_time &lt;= #{etime}
        </if>
        <if test="userId != null">
            and (create_by = #{userId} or create_by is null)
        </if>
 
    </sql>
 
    <select id="selectPakOut" resultType="com.zy.asrs.entity.param.PakOutDTO">
        select * from (
          SELECT status, doc_num,MAX(create_time) as create_time,MAX(update_time) as update_time, cust_name as custName FROM man_pakout
           where 1=1
            <include refid="selectPakOutSql"></include>
          GROUP BY doc_num,cust_name,status
      ) t ORDER BY status,update_time DESC
        OFFSET ((#{curr}-1)*#{limit}) ROWS
        FETCH NEXT #{limit} ROWS ONLY;
 
    </select>
    <select id="selectPakOutCount" resultType="java.lang.Integer">
        select count(1) from (
          SELECT status,  doc_num,MAX(create_time) as create_time FROM man_pakout
       where 1=1
        <include refid="selectPakOutSql"></include>
          GROUP BY doc_num,cust_name,status
      ) t
    </select>
</mapper>