王佳豪
2021-03-20 64f12d06f306b0e68c7792df0eebc093c9f40e2f
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
<?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.OutStockMapper">
 
    <!-- 映射结果 -->
    <resultMap id="OutStockResultMap" type="com.zy.common.service.erp.entity.OutStockBillEntry">
        <result column="FBrNo" property="FBrNo"/>
        <result column="FInterID" property="FInterID"/>
        <result column="FEntryID" property="FEntryID"/>
        <result column="FOrderInterID" property="FOrderInterID"/>
        <result column="FAuxQty" property="FAuxQty"/>
        <result column="FCommitQty" property="FCommitQty"/>
        <result column="FAuxPrice" property="FAuxPrice"/>
        <result column="FDate" property="FDate"/>
        <result column="FNote" property="FNote"/>
        <result column="FBillNo" property="FBillNo"/>
        <result column="FAdd" property="FAdd"/>
    </resultMap>
 
    <sql id="stockOutCondition">
        <if test="FBillNo!=null and FBillNo!='' ">
            and b.FBillNo like '%' + #{FBillNo} + '%'
        </if>
    </sql>
 
    <select id="queryOutStock" resultMap="OutStockResultMap">
        select * from
        (
        select ROW_NUMBER() over (order by a.FInterID,a.FEntryID) as row,a.FBrNo,a.FInterID,a.FEntryID,
        a.FOrderInterID,a.FAuxQty,a.FCommitQty,a.FAuxPrice,a.FDate,a.FNote, b.FBillNo, b.FAdd
        from OutStockBillEntry a left join OutStockBill b on a.FInterID = b.FInterID
        where 1=1
        <include refid="stockOutCondition"></include>
        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
 
    <select id="queryOutStockCount" parameterType="java.util.Map" resultType="java.lang.Integer">
        select
        count(1)
        from OutStockBillEntry a
        left join OutStockBill b on a.FInterID = b.FInterID
        where 1=1
    </select>
</mapper>