DriverSchedulingMapper.xml
4.95 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
<?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.driver.mapper.DriverSchedulingMapper">
<resultMap id="Scheduling" type="com.ruoyi.domain.DriverScheduling">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="job_code" property="jobCode"/>
<result column="name" property="name"/>
<result column="posts" property="posts"/>
<result column="schedule_date" property="scheduleDate" jdbcType="DATE"/>
<result column="line_name" property="lineName"/>
<result column="lp_name" property="lpName"/>
<result column="nbbm" property="nbbm"/>
<result column="bc_type" property="bcType"/>
<result column="fcsj_t" property="fcsjT" jdbcType="BIGINT"/>
<result column="zdsj_t" property="zdsjT" jdbcType="BIGINT"/>
<result column="sign_in_id" property="signInId" jdbcType="BIGINT"/>
<result column="ex_type" property="exType" jdbcType="TINYINT"/>
<result column="sign_time" property="signTime" jdbcType="DATETIMEOFFSET"/>
<result column="alcohol_flag" property="alcoholFlag" jdbcType="DATETIMEOFFSET"/>
<result column="alcohol_intake" property="alcoholIntake"/>
<result column="sign_type" property="signType"></result>
<result column="remark" property="remark"></result>
<result column="upDown" property="upDown"></result>
<result column="qdzCode" property="qdzCode"></result>
<result column="qdzName" property="qdzName"></result>
<result column="zdzCode" property="zdzCode"></result>
</resultMap>
<sql id="selectColumn">
id, job_code,name,posts,schedule_date,line_name,lp_name,nbbm,bc_type,fcsj_t,zdsj_t,sign_in_id,ex_type,sign_time,alcohol_flag,alcohol_intake,sign_type,remark
</sql>
<insert id="insertRoster" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
insert into scheduling (schedule_date,line_name,job_code,`name`,posts,lp_name,nbbm,bc_type,fcsj_t,zdsj_t,upDown,qdzCode,qdzName,zdzCode,zdzName,scheduling_type)
values
<foreach collection="list" item="item" separator=",">
(
#{item.scheduleDate}, #{item.lineName}, #{item.jobCode}, #{item.name}, #{item.posts}, #{item.lpName}, #{item.nbbm},
#{item.bcType},#{item.fcsjT},#{item.zdsjT},#{item.upDown},#{item.qdzCode},#{item.qdzName},#{item.zdzCode},#{item.zdzName},#{item.type}
)
</foreach>
on duplicate key update
job_code = values(job_code)
</insert>
<update id="updateRoster">
update scheduling
set sign_in_id = #{signInId},
ex_type = #{exType},
sign_time = #{signTime},
remark = #{remark},
sign_type = #{signType},
alcohol_flag = #{alcoholFlag},
alcohol_intake = #{alcoholIntake}
where id = #{scheduling.id}
</update>
<update id="updateRosterById" parameterType="com.ruoyi.domain.DriverScheduling">
</update>
<select id="queryToDay" resultType="com.ruoyi.domain.DriverScheduling" resultMap="Scheduling">
select scheduling.*,driver.fleet_name fleetName,equipment.name siteName from
scheduling left join driver on scheduling.job_code = driver.job_code
left join sign_in on scheduling.sign_in_id = sign_in.id
left join equipment on equipment.device_id = sign_in.device_id
<where>
<if test="jobCode !=null and jobCode != ''">
and scheduling.job_code = #{jobCode}
</if>
<if test="name !=null and name != ''">
and scheduling.`name` = #{name}
</if>
<if test="lineName !=null and lineName != ''">
and scheduling.line_name like concat('%', #{lineName}, '%')
</if>
<if test="date != null and date != '' and endDate != null and endDate != ''">
and schedule_date between #{date} and #{endDate}
</if>
and (scheduling.scheduling_type = 1 or scheduling.scheduling_type is null)
</where>
</select>
<select id="queryByMonth" resultType="com.ruoyi.domain.DriverScheduling" resultMap="Scheduling">
select scheduling.*, driver.fleet_name fleetName,equi pment.name siteName
from scheduling
left join driver on driver.job_code = scheduling.job_code
left join sign_in on scheduling.sign_in_id = sign_in.id
left join equipment on equipment.device_id = sign_in.device_id
where schedule_date >= #{startDate}
and schedule_date <= #{endDate}
</select>
<select id="querySelectColumnById" parameterType="java.lang.Integer" resultMap="Scheduling">
select <include refid="selectColumn"></include> from scheduling where id=#{id}
</select>
</mapper>