czt
2024-07-13 1c1472f51d68382f913e413aa827fd0b028ab589
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?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.ld.igds.quantity.mapper.QuantityMapper">
 
    <!-- 基本返回信息 -->
    <sql id="BASE_COLUMN">
        BATCH_ID_ AS batchId,
        COMPANY_ID_ AS companyId,
        DEPOT_ID_ AS depotId,
        WEIGHT_ AS weight,
        BULK_ AS bulk,
        POINTS_ AS points,
        RECEIVE_DATE_ AS receiveDate,
        CHECK_USER_ AS checkUser,
        REMARK_ AS remark
    </sql>
 
 
    <!-- 查询所以后的设备列表 -->
    <select id="getLastData" resultType="com.ld.igds.quantity.dto.QuantityData"
            parameterType="com.ld.igds.quantity.dto.QuantityParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_QUANTITY
        <where>
            <if test="param.companyId != null">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null ">AND DEPOT_ID_ = #{param.depotId}</if>
        </where>
        ORDER BY RECEIVE_DATE_ DESC LIMIT 1
    </select>
 
    <!-- 查询所以后的设备列表 -->
    <select id="getDataByLimit" resultType="com.ld.igds.quantity.dto.QuantityData"
            parameterType="com.ld.igds.quantity.dto.QuantityParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_QUANTITY
        <where>
            <if test="param.companyId != null">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.batchId != null ">AND BATCH_ID_ = #{param.batchId}</if>
        </where>
        ORDER BY RECEIVE_DATE_ DESC LIMIT #{param.limit}
    </select>
 
 
    <!-- 新增 -->
    <insert id="saveData" parameterType="com.ld.igds.quantity.dto.QuantityData">
        insert into
            D_QUANTITY(
            BATCH_ID_,
            COMPANY_ID_,
            DEPOT_ID_,
            WEIGHT_,
            BULK_,
            POINTS_,
            RECEIVE_DATE_,
            CHECK_USER_,
            REMARK_)
        values(
        #{data.batchId},
        #{data.companyId},
        #{data.depotId},
        #{data.weight},
        #{data.bulk},
        #{data.points},
        #{data.receiveDate},
        #{data.checkUser},
        #{data.remark}
        )
    </insert>
 
    <!-- 根据条件查询检测数据 -->
    <select id="getQuantityData" resultType="com.ld.igds.quantity.dto.QuantityData"
            parameterType="com.ld.igds.quantity.dto.QuantityParam">
        select
        <include refid="BASE_COLUMN"/>
        from
        D_QUANTITY
        <where>
            <if test="param.companyId != null and param.companyId != ''">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.depotId != null and param.depotId != ''">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.start != null ">AND RECEIVE_DATE_ <![CDATA[ >= ]]> #{param.start}</if>
            <if test="param.end != null ">AND RECEIVE_DATE_ <![CDATA[ <= ]]> #{param.end}</if>
        </where>
 
        ORDER BY RECEIVE_DATE_ DESC
    </select>
 
    <!-- 根据组织编码获取所有数量检测配置信息 -->
    <select id="queryAll" parameterType="java.lang.String" resultType="com.ld.igds.models.QuantityConf">
        select
            COMPANY_ID_ as companyId,
            DEPOT_ID_ as depotId,
            DEPT_ID_ as deptId,
            NAME_ as name,
            SN_ as sn,
            IP_ as ip,
            PORT_ as port,
            LOGIN_ID_ as loginId,
            PWD_ as pwd,
            STATUS_ as status,
            PROTOCOL_ as protocol,
            LENGTH1_ as length1,
            LENGTH2_ as length2,
            LENGTH3_ as length3,
            LENGTH4_ as length4,
            WIDTH_ as width,
            HEIGHT_ as height,
            LINE_HEIGHT_ as lineHeight,
            YT_IP_ as ytIp,
            YT_PORT_ as ytPort,
            CAMERA_SN_ as cameraSn,
            PORT_CTRL_ as portCtrl,
            PORT_WEB_ as portWeb,
            PLAY_TYPE_ as playType,
            SNAP_TYPE_ as snapType,
            MEDIA_ADDR_ as mediaAddr,
            REMARK_ as remark
        from
            D_QUANTITY_CONF
    </select>
 
    <!-- 更新数量检测配置状态信息 -->
    <update id="updateQuantityConfBySn" parameterType="com.ld.igds.models.QuantityConf">
        update D_QUANTITY_CONF
        set
            IP_ = #{param.ip},
            PORT_ = #{param.port},
            STATUS_ = #{param.status}
        where SN_ = #{param.sn}
    </update>
</mapper>