#
lsh
2024-09-05 d26b4835feb289d37e3e815117080075e7fc79e8
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
<?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.common.wms.mapper.ReportQueryMapper">
 
    <!-- mapper不支持sql语句嵌套时,采用sql片段包含方式,解决xml标签问题 -->
    <sql id="viewStayTimeConditionSql">
            <if test="viewStayTime.locNo!=null and viewStayTime.locNo!='' ">
                and common_loc_mast.loc_no like '%' + #{viewStayTime.locNo} + '%'
            </if>
            <if test="viewStayTime.matnr!=null and viewStayTime.matnr!='' ">
                and wms_loc_detl.matnr like '%' + #{viewStayTime.matnr} + '%'
            </if>
    </sql>
 
    <!-- 分页查询所有信息 -->
    <select id="queryViewStayTimeList" parameterType="com.zy.asrs.common.wms.entity.ViewStayTimeBean" resultType="com.zy.asrs.common.wms.entity.ViewStayTimeBean">
        SELECT
        GETDATE() AS today
        , CONVERT(decimal, DATEDIFF(second,wms_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
        , wms_loc_detl.*
        FROM wms_loc_detl
        INNER JOIN common_loc_mast ON wms_loc_detl.loc_no = common_loc_mast.loc_no and wms_loc_detl.host_id = common_loc_mast.host_id
        where 1=1
        <include refid="viewStayTimeConditionSql"></include>
    </select>
 
    <!-- 不分页查询所有信息,用于excel导出 -->
    <select id="getViewStayTimeAll" parameterType="map" resultType="com.zy.asrs.common.wms.entity.ViewStayTimeBean">
        SELECT
        GETDATE() AS today
        , CONVERT(decimal, DATEDIFF(second,wms_loc_detl.appe_time, GETDATE()) / 86400.0, 9) AS stay_time
        , wms_loc_detl.*
        FROM wms_loc_detl
        INNER JOIN common_loc_mast ON wms_loc_detl.loc_no = common_loc_mast.loc_no and wms_loc_detl.host_id = common_loc_mast.host_id
        where 1=1
        <if test="locNo!=null and locNo!='' ">
            and wms_loc_detl.loc_no like '%' + #{locNo} + '%'
        </if>
    </select>
 
</mapper>