CZT
2023-11-27 c206acfaedc69c390fb67daa81bc686f58a212ef
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?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.inout.mapper.InoutCheckMapper">
 
    <!--分页获取扦样数据-->
    <select id="pageSampleData" resultType="com.ld.igds.inout.dto.InoutCheckData"
            parameterType="com.ld.igds.inout.dto.InoutCheckParam">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        TYPE_ as type,
        PROGRESS_ as progress,
        RECORD_STATUS_ as recordStatus,
        INTEL_CARD_ as intelCard,
        REGISTER_TIME_ as registerTime,
        REGISTER_USER_ as registerUser,
        PLATE_NUM_ as plateNum,
        SAMPLE_USER_ as sampleUser,
        SAMPLE_TIME_ as sampleTime,
        SAMPLE_TYPE_ as sampleType,
        CHECK_ID_ as checkId,
        IF(ISNULL(SAMPLE_TIME_),'NONE','SAMPLE') AS sampleStatus
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and  param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.checkId != null and param.checkId != '' ">AND CHECK_ID_ like #{param.checkId}</if>
            <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ like #{param.plateNum}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            <if test="param.start != null">AND REGISTER_TIME_ <![CDATA[ >= ]]>#{param.start,jdbcType=TIMESTAMP}</if>
            <if test="param.end != null">AND REGISTER_TIME_  <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}</if>
            <if test="param.sampleStatus != null and param.sampleStatus == 'NONE' ">AND SAMPLE_TIME_ IS NULL</if>
            <if test="param.sampleStatus != null and param.sampleStatus != 'NONE' ">AND SAMPLE_TIME_ IS NOT NULL</if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        ORDER BY REGISTER_TIME_
    </select>
 
    <!--更新扦样信息-->
    <update id="updateSampleData" parameterType="com.ld.igds.inout.dto.InoutCheckData">
        UPDATE D_INOUT_RECORD
        set UPDATE_TIME_ = #{data.updateTime} ,
        <if test="data.sampleUser != null">SAMPLE_USER_ = #{data.sampleUser},</if>
        <if test="data.sampleTime != null">SAMPLE_TIME_ = #{data.sampleTime},</if>
        <if test="data.sampleType != null">SAMPLE_TYPE_ = #{data.sampleType},</if>
        TYPE_ = #{data.type}
        WHERE
        COMPANY_ID_ =#{data.companyId}
        AND ID_ =#{data.id}
    </update>
 
    <!--分页获取化验数据-->
    <select id="pageCheckData" resultType="com.ld.igds.inout.dto.InoutCheckData"
            parameterType="com.ld.igds.inout.dto.InoutCheckParam">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        TYPE_ as type,
        PROGRESS_ as progress,
        RECORD_STATUS_ as recordStatus,
        INTEL_CARD_ as intelCard,
        REGISTER_TIME_ as registerTime,
        REGISTER_USER_ as registerUser,
        DEPOT_ID_ as depotId,
        FOOD_VARIETY_ as foodVariety,
        FOOD_LEVEL_ as foodLevel,
        PRICE_ as price,
        PLATE_NUM_ as plateNum,
        SAMPLE_USER_ as sampleUser,
        SAMPLE_TIME_ as sampleTime,
        CHECK_USER_ as checkUser,
        CHECK_TIME_ as checkTime,
        CHECK_ID_ as checkId,
        CHECK_STATUS_ AS checkStatus,
        REMARKS_ AS remarks,
        FOOD_YEAR_ AS foodYear,
        FOOD_TYPE_ AS foodType,
        IF(ISNULL(SAMPLE_TIME_),'NONE','SAMPLE') AS sampleStatus
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.deptId != null and  param.deptId != '' ">AND DEPT_ID_ = #{param.deptId}</if>
            <if test="param.checkId != null and param.checkId != '' ">AND CHECK_ID_ like #{param.checkId}</if>
            <if test="param.foodVariety != null and param.foodVariety != '' ">AND FOOD_VARIETY_ = #{param.foodVariety}
            </if>
            <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
            <if test="param.start != null">AND REGISTER_TIME_ <![CDATA[ >= ]]>#{param.start,jdbcType=TIMESTAMP}</if>
            <if test="param.end != null">AND REGISTER_TIME_  <![CDATA[ <= ]]>#{param.end,jdbcType=TIMESTAMP}</if>
            <if test="param.checkStatus != null and param.checkStatus != 'NONE' ">AND CHECK_STATUS_ != 'NONE' AND
                CHECK_STATUS_ IS NOT NULL
            </if>
            <if test="param.checkStatus != null and param.checkStatus == 'NONE' ">AND CHECK_STATUS_ = 'NONE'</if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        ORDER BY REGISTER_TIME_
    </select>
 
    <!--更新化验信息-->
    <update id="updateCheckData" parameterType="com.ld.igds.inout.dto.InoutData">
        UPDATE D_INOUT_RECORD
        <trim prefix="SET" suffixOverrides=",">
            TYPE_ = #{data.type},
            <if test="data.depotId != null">DEPOT_ID_ = #{data.depotId},</if>
            <if test="data.checkUser != null">CHECK_USER_ = #{data.checkUser},</if>
            <if test="data.checkTime != null">CHECK_TIME_ = #{data.checkTime},</if>
            <if test="data.progress != null">PROGRESS_ = #{data.progress},</if>
            <if test="data.checkStatus != null">CHECK_STATUS_ = #{data.checkStatus},</if>
            <if test="data.foodLevel != null">FOOD_LEVEL_ = #{data.foodLevel},</if>
            <if test="data.foodYear != null">FOOD_YEAR_ = #{data.foodYear},</if>
            <if test="data.foodVariety != null">FOOD_VARIETY_ = #{data.foodVariety},</if>
            <if test="data.foodType != null">FOOD_Type_ = #{data.foodType},</if>
            <if test="data.deCheck != null">DE_CHECK_ = #{data.deCheck},</if>
            <if test="data.addCheck != null">ADD_CHECK_ = #{data.addCheck},</if>
            <if test="data.price != null">PRICE_ = #{data.price},</if>
            <if test="data.remarks != null">REMARKS_ = #{data.remarks},</if>
            <if test="data.updateTime != null">UPDATE_TIME_ = #{data.updateTime},</if>
        </trim>
        WHERE
        COMPANY_ID_ =#{data.companyId}
        AND ID_ =#{data.id}
    </update>
 
    <!--获取粮食定价信息-->
    <select id="getPrice" resultType="com.ld.igds.models.InoutPrice"
            parameterType="com.ld.igds.inout.dto.InoutCheckParam">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        FOOD_VARIETY_ as foodVariety,
        FOOD_LEVEL_ as foodLevel,
        PRICE_ as price,
        START_TIME_ as startTime,
        END_TIME_ as endTime,
        UPDATE_USER_ as updateUser,
        UPDATE_TIME_ as updateTime,
        REMARKS_ as remarks
        from
        D_INOUT_PRICE
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.foodLevel != null and  param.foodLevel != '' ">AND FOOD_LEVEL_ = #{param.foodLevel}</if>
            <if test="param.foodVariety != null and param.foodVariety != '' ">AND FOOD_VARIETY_ like
                #{param.foodVariety}
            </if>
            <if test="param.end != null">AND END_TIME_ <![CDATA[ >= ]]>#{param.end,jdbcType=TIMESTAMP}</if>
            <if test="param.start != null">AND START_TIME_  <![CDATA[ <= ]]>#{param.start,jdbcType=TIMESTAMP}</if>
        </where>
        ORDER BY UPDATE_TIME_
    </select>
 
    <!--分页获取化验数据-->
    <select id="inoutDataByCheckId" resultType="com.ld.igds.inout.dto.InoutCheckData"
            parameterType="com.ld.igds.inout.dto.InoutCheckParam">
        select
        ID_ as id,
        COMPANY_ID_ as companyId,
        DEPT_ID_ as deptId,
        TYPE_ as type,
        PROGRESS_ as progress,
        RECORD_STATUS_ as recordStatus,
        INTEL_CARD_ as intelCard,
        REGISTER_TIME_ as registerTime,
        REGISTER_USER_ as registerUser,
        DEPOT_ID_ as depotId,
        FOOD_VARIETY_ as foodVariety,
        FOOD_LEVEL_ as foodLevel,
        PRICE_ as price,
        PLATE_NUM_ as plateNum,
        SAMPLE_USER_ as sampleUser,
        SAMPLE_TIME_ as sampleTime,
        CHECK_USER_ as checkUser,
        CHECK_TIME_ as checkTime,
        CHECK_ID_ as checkId,
        CHECK_STATUS_ AS checkStatus,
        REMARKS_ AS remarks
        from
        D_INOUT_RECORD
        <where>
            <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if>
            <if test="param.checkId != null and param.checkId != '' ">AND CHECK_ID_ = #{param.checkId}</if>
            <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if>
        </where>
        AND RECORD_STATUS_ != 'DEL'
        ORDER BY REGISTER_TIME_
    </select>
 
</mapper>