#
luxiaotao1123
2021-03-26 ab440f3a09ae3c17e3e4d436ce98cd687ab666bb
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?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="zy.cloud.wms.manager.mapper.PriorMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="zy.cloud.wms.manager.entity.Prior">
        <id column="id" property="id" />
        <result column="uuid" property="uuid" />
        <result column="name" property="name" />
        <result column="mat_id" property="matId" />
        <result column="matnr" property="matnr" />
        <result column="maktx" property="maktx" />
        <result column="node_id" property="nodeId" />
        <result column="node_name" property="nodeName" />
        <result column="safe_qua" property="safeQua" />
        <result column="prio" property="prio" />
        <result column="barcode" property="barcode" />
        <result column="status" property="status" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="memo" property="memo" />
 
    </resultMap>
 
 
    <sql id="pageCondition">
        <if test="loc_no != null and loc_no != ''">
            and mld.loc_no like concat('%',#{loc_no},'%')
        </if>
        <if test="matnr != null and matnr != ''">
            and mld.matnr like concat('%',#{matnr},'%')
        </if>
        <if test="maktx != null and maktx != ''">
            and mld.maktx like concat('%',#{maktx},'%')
        </if>
        <if test="startTime!=null and endTime!=null">
            and mld.update_time between #{startTime} and #{endTime}
        </if>
    </sql>
 
    <select id="selectSafeStoPage" resultType="zy.cloud.wms.manager.entity.SafeStoDo">
        select * from
        (
            select
            ROW_NUMBER() over (order by mp.create_time desc) as row,
            mp.node_id,
            mp.node_name,
            mp.matnr,
            mp.maktx,
            mp.safe_qua,
            ls.amount,
            (cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%') as progress
            from man_prior mp
            inner join
            (
                select
                node_id,
                matnr,
                sum(anfme) as amount
                from man_loc_detl
                group by node_id, matnr
            ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr
            where 1=1
            <include refid="pageCondition"></include>
       ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
 
    <select id="selectSafeStoPageCount" resultType="java.lang.Integer">
        select
        count(1) as count
        from man_prior mp
        inner join
        (
        select
        node_id,
        matnr,
        sum(anfme) as amount
        from man_loc_detl
        group by node_id, matnr
        ) as ls on ls.node_id = mp.node_id and ls.matnr = mp.matnr
        where 1=1
        <include refid="pageCondition"></include>
    </select>
 
</mapper>