SignInMapper.xml
10.8 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?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.ruoyi.in.mapper.SignInMapper">
<resultMap type="com.ruoyi.pojo.response.SignInResponseVo" id="SignInResultVO">
<result property="id" column="id"/>
<result property="createTime" column="create_time"/>
<result property="jobCode" column="jobCode"/>
<result property="deviceId" column="device_id"/>
<result property="ip" column="ip"/>
<result property="image" column="image"/>
<result property="status" column="status"/>
<result property="updateBy" column="update_by"/>
<result property="singnIn" column="singn_in"/>
<result property="alcoholFlag" column="alcohol_flag"/>
<result property="type" column="type"/>
<result property="updateTime" column="update_time"/>
<result property="alcoholIntake" column="alcohol_intake"/>
<result property="remark" column="remark"/>
<result property="posts" column="posts"/>
<result property="name" column="personnel_name"/>
<result column="scheduling_id" jdbcType="INTEGER" property="schedulingId" />
</resultMap>
<resultMap type="SignIn" id="SignInResult">
<result property="id" column="id"/>
<result property="createTime" column="create_time"/>
<result property="jobCode" column="jobCode"/>
<result property="deviceId" column="device_id"/>
<result property="ip" column="ip"/>
<result property="image" column="image"/>
<result property="status" column="status"/>
<result property="updateBy" column="update_by"/>
<result property="singnIn" column="singn_in"/>
<result property="alcoholFlag" column="alcohol_flag"/>
<result property="type" column="type"/>
<result property="updateTime" column="update_time"/>
<result property="alcoholIntake" column="alcohol_intake"/>
<result property="remark" column="remark"/>
<result column="scheduling_id" jdbcType="INTEGER" property="schedulingId" />
</resultMap>
<sql id="selectSignInVo">
select id,
create_time,
jobCode,
device_id,
ip,
image,
status,
update_by,
singn_in,
alcohol_flag,
type,
update_time,
alcohol_intake,
remark,
scheduling_id
from sign_in
</sql>
<select id="selectSignInList" parameterType="com.ruoyi.pojo.response.SignInResponseVo" resultMap="SignInResultVO">
select sign_in.*,driver.posts,driver.personnel_name,equipment.name
from sign_in inner join driver on driver.job_code = sign_in.jobCode
left join equipment on equipment.device_id = sign_in.device_id
WHERE
1=1
<if test="jobCode != null and jobCode != ''">and jobCode = #{jobCode}</if>
<if test="ip != null and ip != ''">and ip = #{ip}</if>
<if test="image != null and image != ''">and image = #{image}</if>
<if test="status != null ">and sign_in.status = #{status}</if>
<if test="singnIn != null and singnIn != ''">and singn_in = #{singnIn}</if>
<if test="alcoholFlag != null ">and alcohol_flag = #{alcoholFlag}</if>
<if test="type != null ">and type = #{type}</if>
<if test="alcoholIntake != null ">and alcohol_intake = #{alcoholIntake}</if>
<if test="siteName != null ">and name = #{name}</if>
<if test="date != null ">and sign_in.create_time LIKE concat(#{date},'%')</if>
<if test="null!=schedulingId"> scheduling_id = #{schedulingId}</if>
order by create_time desc
</select>
<select id="selectSignInById" parameterType="Long" resultMap="SignInResult">
<include refid="selectSignInVo"/>
where id = #{id}
</select>
<select id="getReportScrollViewTable" resultType="com.ruoyi.pojo.response.ReportViewResponseVo">
<if test="jobCode != '' and jobCode != null">
and sign_in.jobCode = #{jobCode}
</if>
<if test="startTime != '' and startTime != null">
and DATE_FORMAT(sign_in.create_time,'%Y-%m-%d') >= #{startTime}
and DATE_FORMAT(sign_in.create_time,'%Y-%m-%d') <= #{endTime}
</if>
<if test="status != '' and status != null">
and sign_in.status = #{status}
</if>
<if test="name != '' and name != null">
and driver.personnel_name = #{name}
</if>
<if test="null!=schedulingId"> scheduling_id = #{schedulingId}</if>
<if test="ids != null and ids.size() > 0">
and sign_in.id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
order by sign_in.create_time desc
</select>
<select id="getSignErrorList" resultType="com.ruoyi.in.domain.SignIn">
<include refid="selectSignInVo"></include>
where `status` = 2
<if test="endTime != '' and endTime != null">
and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{startTime}
and DATE_FORMAT(create_time,'%Y-%m-%d') <= #{endTime}
</if>
<if test="null!=schedulingId"> scheduling_id = #{schedulingId}</if>
<if test="jobCode != '' and jobCode != null">
and jobCode = #{jobCode}
</if>
</select>
<select id="queryOutBcType" resultType="com.ruoyi.domain.DriverScheduling">
SELECT s1.*
FROM scheduling s1
INNER JOIN (SELECT job_code, schedule_date, MIN(fcsj_t) AS min_fcsj_t
FROM scheduling
WHERE bc_type = 'out'
AND schedule_date = DATE_FORMAT(NOW(), '%Y-%m-%d')
GROUP BY job_code, schedule_date) s2
ON s1.job_code = s2.job_code AND s1.schedule_date = s2.schedule_date AND
s1.fcsj_t = s2.min_fcsj_t;
</select>
<select id="querySignInData" resultType="com.ruoyi.in.domain.SignIn">
SELECT *
FROM sign_in s1
JOIN (SELECT jobCode AS job_code, MIN(create_time) AS min_create_time
FROM sign_in
WHERE create_time LIKE CONCAT(DATE_FORMAT(NOW(), "%Y-%m-%d"), "%")
GROUP BY job_code, DATE (create_time) ) s2
on s1.jobCode = s2.job_code and s1.create_time = s2.min_create_time
</select>
<select id="selectSignInByIds" parameterType="com.ruoyi.pojo.response.SignInResponseVo" resultMap="SignInResultVO">
select sign_in.id,equipment.name
from sign_in,equipment
where equipment.device_id = sign_in.device_id
<if test="list != null and list.size >0">
and sign_in.id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<insert id="insertSignIn" parameterType="SignIn" useGeneratedKeys="true" keyProperty="id">
insert into sign_in
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="jobCode != null">jobCode,</if>
<if test="ip != null">ip,</if>
<if test="deviceId != null">device_id,</if>
<if test="image != null">image,</if>
<if test="status != null">status,</if>
<if test="updateBy != null">update_by,</if>
<if test="singnIn != null">singn_in,</if>
<if test="alcoholFlag != null">alcohol_flag,</if>
<if test="type != null">`type`,</if>
<if test="updateTime != null">update_time,</if>
<if test="alcoholIntake != null">alcohol_intake,</if>
<if test="remark != null">remark,</if>
<if test="exType != null">ex_type,</if>
<if test="null!=schedulingId">scheduling_id,</if>
<if test="null!=exType1">ex_type1,</if>
<if test="null!=exceptionId">exception_Id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="jobCode != null">#{jobCode},</if>
<if test="ip != null">#{ip},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="image != null">#{image},</if>
<if test="status != null">#{status},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="singnIn != null">#{singnIn},</if>
<if test="alcoholFlag != null">#{alcoholFlag},</if>
<if test="type != null">#{type},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="alcoholIntake != null">#{alcoholIntake},</if>
<if test="remark != null">#{remark},</if>
<if test="exType != null">#{exType},</if>
<if test="null!=schedulingId">#{schedulingId,jdbcType=INTEGER},</if>
<if test="null!=exType1">#{exType1,jdbcType=INTEGER},</if>
<if test="null!=exceptionId">#{exceptionId},</if>
</trim>
</insert>
<update id="updateSignIn" parameterType="SignIn">
update sign_in
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="jobCode != null">jobCode = #{jobCode},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="image != null">image = #{image},</if>
<if test="status != null">`status` = #{status},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="singnIn != null">singn_in = #{singnIn},</if>
<if test="alcoholFlag != null">alcohol_flag = #{alcoholFlag},</if>
<if test="type != null">type = #{type},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alcoholIntake != null">alcohol_intake = #{alcoholIntake},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="exType != null">ex_type = #{exType},</if>
<if test="null!=schedulingId"> scheduling_id = #{schedulingId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSignInById" parameterType="Long">
delete
from sign_in
where id = #{id}
</delete>
<delete id="deleteSignInByIds" parameterType="String">
delete from sign_in where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>