zhangback
2025-11-14 c2e20ac680e03cb26cf7c00f573f0cb917afaece
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
<?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.TmsRouteMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsRoute" id="TmsRouteResult">
        <result property="id"    column="id"    />
        <result property="systemCode"    column="system_code"    />
        <result property="routeCode"    column="route_code"    />
        <result property="routeName"    column="route_name"    />
        <result property="routeType"    column="route_type"    />
        <result property="transportMode"    column="transport_mode"    />
        <result property="startArea"    column="start_area"    />
        <result property="startWarehouse"    column="start_warehouse"    />
        <result property="endArea"    column="end_area"    />
        <result property="endWarehouse"    column="end_warehouse"    />
        <result property="viaStations"    column="via_stations"    />
        <result property="distanceKm"    column="distance_km"    />
        <result property="estimatedHours"    column="estimated_hours"    />
        <result property="routeGroup"    column="route_group"    />
        <result property="suitableVehicleType"    column="suitable_vehicle_type"    />
        <result property="suitableTrayType"    column="suitable_tray_type"    />
        <result property="routeStatus"    column="route_status"    />
        <result property="isCommon"    column="is_common"    />
        <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"    />
    </resultMap>
 
    <sql id="selectTmsRouteVo">
        select thisTab.id, thisTab.system_code, thisTab.route_code, thisTab.route_name, thisTab.route_type, thisTab.transport_mode, thisTab.start_area, thisTab.start_warehouse, thisTab.end_area, thisTab.end_warehouse, thisTab.via_stations, thisTab.distance_km, thisTab.estimated_hours, thisTab.route_group, thisTab.suitable_vehicle_type, thisTab.suitable_tray_type, thisTab.route_status, thisTab.is_common, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark from tms_route AS thisTab
    </sql>
    <sql id="selectTmsRouteVoCount">
        select count(0) from tms_route as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="systemCode != null  and systemCode != ''"> and thisTab.system_code = #{systemCode}</if>
        <if test="routeCode != null  and routeCode != ''"> and thisTab.route_code = #{routeCode}</if>
        <if test="routeName != null  and routeName != ''"> and  thisTab.route_name like concat('%', #{routeName}, '%')</if>
        <if test="routeType != null "> and thisTab.route_type = #{routeType}</if>
        <if test="transportMode != null "> and thisTab.transport_mode = #{transportMode}</if>
        <if test="startArea != null  and startArea != ''"> and thisTab.start_area = #{startArea}</if>
        <if test="startWarehouse != null  and startWarehouse != ''"> and thisTab.start_warehouse = #{startWarehouse}</if>
        <if test="endArea != null  and endArea != ''"> and thisTab.end_area = #{endArea}</if>
        <if test="endWarehouse != null  and endWarehouse != ''"> and thisTab.end_warehouse = #{endWarehouse}</if>
        <if test="viaStations != null  and viaStations != ''"> and thisTab.via_stations = #{viaStations}</if>
        <if test="distanceKm != null "> and thisTab.distance_km = #{distanceKm}</if>
        <if test="estimatedHours != null "> and thisTab.estimated_hours = #{estimatedHours}</if>
        <if test="routeGroup != null  and routeGroup != ''"> and thisTab.route_group = #{routeGroup}</if>
        <if test="suitableVehicleType != null "> and thisTab.suitable_vehicle_type = #{suitableVehicleType}</if>
        <if test="suitableTrayType != null "> and thisTab.suitable_tray_type = #{suitableTrayType}</if>
        <if test="routeStatus != null "> and thisTab.route_status = #{routeStatus}</if>
        <if test="isCommon != null "> and thisTab.is_common = #{isCommon}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
    </sql>
 
    <!--查询-->
    <select id="selectTmsRouteById" parameterType="Integer" resultMap="TmsRouteResult">
        <include refid="selectTmsRouteVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsRouteCount" parameterType="com.ruoyi.tms.domain.TmsRoute" resultType="int">
        <include refid="selectTmsRouteVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectTmsRouteList" parameterType="com.ruoyi.tms.domain.TmsRoute" resultMap="TmsRouteResult">
        <include refid="selectTmsRouteVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsRoute" parameterType="com.ruoyi.tms.domain.TmsRoute"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_route
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code,</if>
            <if test="routeCode != null and routeCode != ''">route_code,</if>
            <if test="routeName != null and routeName != ''">route_name,</if>
            <if test="routeType != null">route_type,</if>
            <if test="transportMode != null">transport_mode,</if>
            <if test="startArea != null and startArea != ''">start_area,</if>
            <if test="startWarehouse != null">start_warehouse,</if>
            <if test="endArea != null and endArea != ''">end_area,</if>
            <if test="endWarehouse != null">end_warehouse,</if>
            <if test="viaStations != null">via_stations,</if>
            <if test="distanceKm != null">distance_km,</if>
            <if test="estimatedHours != null">estimated_hours,</if>
            <if test="routeGroup != null">route_group,</if>
            <if test="suitableVehicleType != null">suitable_vehicle_type,</if>
            <if test="suitableTrayType != null">suitable_tray_type,</if>
            <if test="routeStatus != null">route_status,</if>
            <if test="isCommon != null">is_common,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">#{systemCode},</if>
            <if test="routeCode != null and routeCode != ''">#{routeCode},</if>
            <if test="routeName != null and routeName != ''">#{routeName},</if>
            <if test="routeType != null">#{routeType},</if>
            <if test="transportMode != null">#{transportMode},</if>
            <if test="startArea != null and startArea != ''">#{startArea},</if>
            <if test="startWarehouse != null">#{startWarehouse},</if>
            <if test="endArea != null and endArea != ''">#{endArea},</if>
            <if test="endWarehouse != null">#{endWarehouse},</if>
            <if test="viaStations != null">#{viaStations},</if>
            <if test="distanceKm != null">#{distanceKm},</if>
            <if test="estimatedHours != null">#{estimatedHours},</if>
            <if test="routeGroup != null">#{routeGroup},</if>
            <if test="suitableVehicleType != null">#{suitableVehicleType},</if>
            <if test="suitableTrayType != null">#{suitableTrayType},</if>
            <if test="routeStatus != null">#{routeStatus},</if>
            <if test="isCommon != null">#{isCommon},</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>
         </trim>
    </insert>
 
    <insert id="insertTmsRouteBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_route
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,system_code,route_code,route_name,route_type,transport_mode,start_area,start_warehouse,end_area,end_warehouse,via_stations,distance_km,estimated_hours,route_group,suitable_vehicle_type,suitable_tray_type,route_status,is_common,status,create_by,create_time,update_by,update_time,remark,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.systemCode},#{item.routeCode},#{item.routeName},#{item.routeType},#{item.transportMode},#{item.startArea},#{item.startWarehouse},#{item.endArea},#{item.endWarehouse},#{item.viaStations},#{item.distanceKm},#{item.estimatedHours},#{item.routeGroup},#{item.suitableVehicleType},#{item.suitableTrayType},#{item.routeStatus},#{item.isCommon},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsRoute" parameterType="com.ruoyi.tms.domain.TmsRoute">
        update tms_route
        <trim prefix="SET" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code = #{systemCode},</if>
            <if test="routeCode != null and routeCode != ''">route_code = #{routeCode},</if>
            <if test="routeName != null and routeName != ''">route_name = #{routeName},</if>
            <if test="routeType != null">route_type = #{routeType},</if>
            <if test="transportMode != null">transport_mode = #{transportMode},</if>
            <if test="startArea != null and startArea != ''">start_area = #{startArea},</if>
            <if test="startWarehouse != null">start_warehouse = #{startWarehouse},</if>
            <if test="endArea != null and endArea != ''">end_area = #{endArea},</if>
            <if test="endWarehouse != null">end_warehouse = #{endWarehouse},</if>
            <if test="viaStations != null">via_stations = #{viaStations},</if>
            <if test="distanceKm != null">distance_km = #{distanceKm},</if>
            <if test="estimatedHours != null">estimated_hours = #{estimatedHours},</if>
            <if test="routeGroup != null">route_group = #{routeGroup},</if>
            <if test="suitableVehicleType != null">suitable_vehicle_type = #{suitableVehicleType},</if>
            <if test="suitableTrayType != null">suitable_tray_type = #{suitableTrayType},</if>
            <if test="routeStatus != null">route_status = #{routeStatus},</if>
            <if test="isCommon != null">is_common = #{isCommon},</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>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsRouteBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_route
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.systemCode != null and item.systemCode != ''">system_code = #{item.systemCode},</if>
                <if test="item.routeCode != null and item.routeCode != ''">route_code = #{item.routeCode},</if>
                <if test="item.routeName != null and item.routeName != ''">route_name = #{item.routeName},</if>
                <if test="item.routeType != null">route_type = #{item.routeType},</if>
                <if test="item.transportMode != null">transport_mode = #{item.transportMode},</if>
                <if test="item.startArea != null and item.startArea != ''">start_area = #{item.startArea},</if>
                <if test="item.startWarehouse != null">start_warehouse = #{item.startWarehouse},</if>
                <if test="item.endArea != null and item.endArea != ''">end_area = #{item.endArea},</if>
                <if test="item.endWarehouse != null">end_warehouse = #{item.endWarehouse},</if>
                <if test="item.viaStations != null">via_stations = #{item.viaStations},</if>
                <if test="item.distanceKm != null">distance_km = #{item.distanceKm},</if>
                <if test="item.estimatedHours != null">estimated_hours = #{item.estimatedHours},</if>
                <if test="item.routeGroup != null">route_group = #{item.routeGroup},</if>
                <if test="item.suitableVehicleType != null">suitable_vehicle_type = #{item.suitableVehicleType},</if>
                <if test="item.suitableTrayType != null">suitable_tray_type = #{item.suitableTrayType},</if>
                <if test="item.routeStatus != null">route_status = #{item.routeStatus},</if>
                <if test="item.isCommon != null">is_common = #{item.isCommon},</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>
            </trim>
        where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsRouteById" parameterType="Integer">
        delete from tms_route where id = #{id}
    </delete>
    <delete id="deleteTmsRouteByIds" parameterType="Integer">
        delete from tms_route where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>