zhangback
8 天以前 3974fad5d836431e417e99220cc07bb5b0aba331
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
<?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.tms.mapper.TmsDriverMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsDriver" id="TmsDriverResult">
        <result property="id"    column="id"    />
        <result property="systemCode"    column="system_code"    />
        <result property="vehicleProviderId"    column="vehicle_provider_id"    />
        <result property="driverName"    column="driver_name"    />
        <result property="vehicleProviderName"    column="vehicle_provider_name"    />
        <result property="mobile"    column="mobile"    />
        <result property="email"    column="email"    />
        <result property="licenseType"    column="license_type"    />
        <result property="licenseNumber"    column="license_number"    />
        <result property="licenseIssueDate"    column="license_issue_date"    />
        <result property="licenseValidPeriodBefore"    column="license_valid_period_before"    />
        <result property="licenseValidPeriodEnd"    column="license_valid_period_end"    />
        <result property="licenseAttachment"    column="license_attachment"    />
        <result property="currentVehicleCode"    column="current_vehicle_code"    />
        <result property="status"    column="status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="carrierType"    column="carrier_type"    />
    </resultMap>
 
    <sql id="selectTmsDriverVo">
        select thisTab.id, thisTab.system_code, thisTab.vehicle_provider_id, thisTab.driver_name, thisTab.vehicle_provider_name, thisTab.mobile, thisTab.email, thisTab.license_type, thisTab.license_number, thisTab.license_issue_date, thisTab.license_valid_period_before, thisTab.license_valid_period_end, thisTab.license_attachment, thisTab.current_vehicle_code, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark , thisTab.carrier_type from tms_driver AS thisTab
    </sql>
    <sql id="selectTmsDriverVoCount">
        select count(0) from tms_driver as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="systemCode != null  and systemCode != ''"> and thisTab.system_code = #{systemCode}</if>
        <if test="vehicleProviderId != null "> and thisTab.vehicle_provider_id = #{vehicleProviderId}</if>
        <if test="driverName != null  and driverName != ''"> and  thisTab.driver_name like concat('%', #{driverName}, '%')</if>
        <if test="vehicleProviderName != null  and vehicleProviderName != ''"> and  thisTab.vehicle_provider_name like concat('%', #{vehicleProviderName}, '%')</if>
        <if test="mobile != null  and mobile != ''"> and thisTab.mobile = #{mobile}</if>
        <if test="licenseNumber != null  and licenseNumber != ''"> and thisTab.license_number = #{licenseNumber}</if>
        <if test="licenseAttachment != null  and licenseAttachment != ''"> and thisTab.license_attachment = #{licenseAttachment}</if>
        <if test="currentVehicleCode != null  and currentVehicleCode != ''"> and thisTab.current_vehicle_code = #{currentVehicleCode}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="carrierType != null "> and thisTab.carrier_type = #{carrierType}</if>
    </sql>
 
    <!--查询-->
    <select id="selectTmsDriverById" parameterType="Integer" resultMap="TmsDriverResult">
        <include refid="selectTmsDriverVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsDriverCount" parameterType="com.ruoyi.tms.domain.TmsDriver" resultType="int">
        <include refid="selectTmsDriverVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectTmsDriverList" parameterType="com.ruoyi.tms.domain.TmsDriver" resultMap="TmsDriverResult">
        <include refid="selectTmsDriverVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsDriver" parameterType="com.ruoyi.tms.domain.TmsDriver"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_driver
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code,</if>
            <if test="vehicleProviderId != null">vehicle_provider_id,</if>
            <if test="driverName != null and driverName != ''">driver_name,</if>
            <if test="vehicleProviderName != null">vehicle_provider_name,</if>
            <if test="mobile != null and mobile != ''">mobile,</if>
            <if test="email != null">email,</if>
            <if test="licenseType != null">license_type,</if>
            <if test="licenseNumber != null and licenseNumber != ''">license_number,</if>
            <if test="licenseIssueDate != null">license_issue_date,</if>
            <if test="licenseValidPeriodBefore != null">license_valid_period_before,</if>
            <if test="licenseValidPeriodEnd != null">license_valid_period_end,</if>
            <if test="licenseAttachment != null">license_attachment,</if>
            <if test="currentVehicleCode != null">current_vehicle_code,</if>
            <if test="status != null">status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="carrierType != null">carrier_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">#{systemCode},</if>
            <if test="vehicleProviderId != null">#{vehicleProviderId},</if>
            <if test="driverName != null and driverName != ''">#{driverName},</if>
            <if test="vehicleProviderName != null">#{vehicleProviderName},</if>
            <if test="mobile != null and mobile != ''">#{mobile},</if>
            <if test="email != null">#{email},</if>
            <if test="licenseType != null">#{licenseType},</if>
            <if test="licenseNumber != null and licenseNumber != ''">#{licenseNumber},</if>
            <if test="licenseIssueDate != null">#{licenseIssueDate},</if>
            <if test="licenseValidPeriodBefore != null">#{licenseValidPeriodBefore},</if>
            <if test="licenseValidPeriodEnd != null">#{licenseValidPeriodEnd},</if>
            <if test="licenseAttachment != null">#{licenseAttachment},</if>
            <if test="currentVehicleCode != null">#{currentVehicleCode},</if>
            <if test="status != null">#{status},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="carrierType != null">#{carrierType},</if>
        </trim>
    </insert>
 
    <insert id="insertTmsDriverBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_driver
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,system_code,vehicle_provider_id,driver_name,vehicle_provider_name,mobile,email,license_type,license_number,license_issue_date,license_valid_period_before,license_valid_period_end,license_attachment,current_vehicle_code,status,create_by,create_time,update_by,update_time,remark,carrier_type,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.systemCode},#{item.vehicleProviderId},#{item.driverName},#{item.vehicleProviderName},#{item.mobile},#{item.email},#{item.licenseType},#{item.licenseNumber},#{item.licenseIssueDate},#{item.licenseValidPeriodBefore},#{item.licenseValidPeriodEnd},#{item.licenseAttachment},#{item.currentVehicleCode},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.carrierType},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsDriver" parameterType="com.ruoyi.tms.domain.TmsDriver">
        update tms_driver
        <trim prefix="SET" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code = #{systemCode},</if>
            <if test="vehicleProviderId != null">vehicle_provider_id = #{vehicleProviderId},</if>
            <if test="driverName != null and driverName != ''">driver_name = #{driverName},</if>
            <if test="vehicleProviderName != null">vehicle_provider_name = #{vehicleProviderName},</if>
            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
            <if test="email != null">email = #{email},</if>
            <if test="licenseType != null">license_type = #{licenseType},</if>
            <if test="licenseNumber != null and licenseNumber != ''">license_number = #{licenseNumber},</if>
            <if test="licenseIssueDate != null">license_issue_date = #{licenseIssueDate},</if>
            <if test="licenseValidPeriodBefore != null">license_valid_period_before = #{licenseValidPeriodBefore},</if>
            <if test="licenseValidPeriodEnd != null">license_valid_period_end = #{licenseValidPeriodEnd},</if>
            <if test="licenseAttachment != null">license_attachment = #{licenseAttachment},</if>
            <if test="currentVehicleCode != null">current_vehicle_code = #{currentVehicleCode},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="carrierType != null">carrier_type = #{carrierType},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsDriverBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_driver
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.systemCode != null and item.systemCode != ''">system_code = #{item.systemCode},</if>
                <if test="item.vehicleProviderId != null">vehicle_provider_id = #{item.vehicleProviderId},</if>
                <if test="item.driverName != null and item.driverName != ''">driver_name = #{item.driverName},</if>
                <if test="item.vehicleProviderName != null">vehicle_provider_name = #{item.vehicleProviderName},</if>
                <if test="item.mobile != null and item.mobile != ''">mobile = #{item.mobile},</if>
                <if test="item.email != null">email = #{item.email},</if>
                <if test="item.licenseType != null">license_type = #{item.licenseType},</if>
                <if test="item.licenseNumber != null and item.licenseNumber != ''">license_number = #{item.licenseNumber},</if>
                <if test="item.licenseIssueDate != null">license_issue_date = #{item.licenseIssueDate},</if>
                <if test="item.licenseValidPeriodBefore != null">license_valid_period_before = #{item.licenseValidPeriodBefore},</if>
                <if test="item.licenseValidPeriodEnd != null">license_valid_period_end = #{item.licenseValidPeriodEnd},</if>
                <if test="item.licenseAttachment != null">license_attachment = #{item.licenseAttachment},</if>
                <if test="item.currentVehicleCode != null">current_vehicle_code = #{item.currentVehicleCode},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                <if test="item.remark != null">remark = #{item.remark},</if>
                <if test="item.carrierType != null">carrier_type = #{item.carrierType},</if>
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsDriverById" parameterType="Integer">
        delete from tms_driver where id = #{id}
    </delete>
    <delete id="deleteTmsDriverByIds" parameterType="Integer">
        delete from tms_driver where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>