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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?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.TmsQuoteDetailMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsQuoteDetail" id="TmsQuoteDetailResult">
        <result property="id"    column="id"    />
        <result property="systemCode"    column="system_code"    />
        <result property="quotePlanId"    column="quote_plan_id"    />
        <result property="quotePlanCode"    column="quote_plan_code"    />
        <result property="vehicleProviderId"    column="vehicle_provider_id"    />
        <result property="vehicleProviderName"    column="vehicle_provider_name"    />
        <result property="transportRoute"    column="transport_route"    />
        <result property="startRegionCode"    column="start_region_code"    />
        <result property="startRegion"    column="start_region"    />
        <result property="startWarehouse"    column="start_warehouse"    />
        <result property="endRegionCode"    column="end_region_code"    />
        <result property="endRegion"    column="end_region"    />
        <result property="endWarehouse"    column="end_warehouse"    />
        <result property="vehicleType"    column="vehicle_type"    />
        <result property="transportMode"    column="transport_mode"    />
        <result property="routeType"    column="route_type"    />
        <result property="freightPrice"    column="freight_price"    />
        <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="planType"    column="plan_type"    />
        <result property="customerId"    column="customer_id"    />
        <result property="currency"    column="currency"    />
        <result property="taxRate"    column="tax_rate"    />
        <result property="isSegmentedInvoice"    column="is_segmented_invoice"    />
        <result property="segment1FreightQuote"    column="segment1_freight_quote"    />
        <result property="segment1Currency"    column="segment1_currency"    />
        <result property="segment1TaxRate"    column="segment1_tax_rate"    />
        <result property="segment2FreightQuote"    column="segment2_freight_quote"    />
        <result property="segment2Currency"    column="segment2_currency"    />
        <result property="segment2TaxRate"    column="segment2_tax_rate"    />
        <result property="totalFreightCny"    column="total_freight_cny"    />
        <result property="totalFreightHkd"    column="total_freight_hkd"    />
    </resultMap>
 
    <sql id="selectTmsQuoteDetailVo">
        select thisTab.id, thisTab.system_code, thisTab.quote_plan_id, thisTab.quote_plan_code, thisTab.vehicle_provider_id, thisTab.vehicle_provider_name, thisTab.transport_route, thisTab.start_region_code, thisTab.start_region, thisTab.start_warehouse, thisTab.end_region_code, thisTab.end_region, thisTab.end_warehouse, thisTab.vehicle_type, thisTab.transport_mode, thisTab.route_type, thisTab.freight_price, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark,thisTab.plan_type, thisTab.customer_id , thisTab.currency, thisTab.tax_rate, thisTab.is_segmented_invoice, thisTab.segment1_freight_quote, thisTab.segment1_currency, thisTab.segment1_tax_rate, thisTab.segment2_freight_quote, thisTab.segment2_currency, thisTab.segment2_tax_rate, thisTab.total_freight_cny, thisTab.total_freight_hkd  from tms_quote_detail AS thisTab
    </sql>
    <sql id="selectTmsQuoteDetailVoCount">
        select count(0) from tms_quote_detail as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="systemCode != null  and systemCode != ''"> and thisTab.system_code = #{systemCode}</if>
        <if test="quotePlanId != null "> and thisTab.quote_plan_id = #{quotePlanId}</if>
        <if test="quotePlanCode != null  and quotePlanCode != ''"> and thisTab.quote_plan_code = #{quotePlanCode}</if>
        <if test="vehicleProviderId != null "> and thisTab.vehicle_provider_id = #{vehicleProviderId}</if>
        <if test="vehicleProviderName != null  and vehicleProviderName != ''"> and  thisTab.vehicle_provider_name like concat('%', #{vehicleProviderName}, '%')</if>
        <if test="transportRoute != null  and transportRoute != ''"> and thisTab.transport_route = #{transportRoute}</if>
        <if test="startRegionCode != null  and startRegionCode != ''"> and thisTab.start_region_code = #{startRegionCode}</if>
        <if test="startRegion != null  and startRegion != ''"> and thisTab.start_region = #{startRegion}</if>
        <if test="startWarehouse != null "> and thisTab.start_warehouse = #{startWarehouse}</if>
        <if test="endRegionCode != null  and endRegionCode != ''"> and thisTab.end_region_code = #{endRegionCode}</if>
        <if test="endRegion != null  and endRegion != ''"> and thisTab.end_region = #{endRegion}</if>
        <if test="endWarehouse != null "> and thisTab.end_warehouse = #{endWarehouse}</if>
        <if test="vehicleType != null  and vehicleType != ''"> and thisTab.vehicle_type = #{vehicleType}</if>
        <if test="transportMode != null "> and thisTab.transport_mode = #{transportMode}</if>
        <if test="routeType != null "> and thisTab.route_type = #{routeType}</if>
        <if test="freightPrice != null "> and thisTab.freight_price = #{freightPrice}</if>
        <if test="status != null and status != ''"> and thisTab.status = #{status}</if>
        <if test="planType != null "> and thisTab.plan_type = #{planType}</if>
        <if test="customerId != null "> and thisTab.customer_id = #{customerId}</if>
        <if test="currency != null and currency != ''"> and thisTab.currency = #{currency}</if>
        <if test="taxRate != null "> and thisTab.tax_rate = #{taxRate}</if>
        <if test="isSegmentedInvoice != null "> and thisTab.is_segmented_invoice = #{isSegmentedInvoice}</if>
        <if test="segment1FreightQuote != null "> and thisTab.segment1_freight_quote = #{segment1FreightQuote}</if>
        <if test="segment1Currency != null  and segment1Currency != ''"> and thisTab.segment1_currency = #{segment1Currency}</if>
        <if test="segment1TaxRate != null "> and thisTab.segment1_tax_rate = #{segment1TaxRate}</if>
        <if test="segment2FreightQuote != null "> and thisTab.segment2_freight_quote = #{segment2FreightQuote}</if>
        <if test="segment2Currency != null  and segment2Currency != ''"> and thisTab.segment2_currency = #{segment2Currency}</if>
        <if test="segment2TaxRate != null "> and thisTab.segment2_tax_rate = #{segment2TaxRate}</if>
        <if test="totalFreightCny != null "> and thisTab.total_freight_cny = #{totalFreightCny}</if>
        <if test="totalFreightHkd != null "> and thisTab.total_freight_hkd = #{totalFreightHkd}</if>
 
    </sql>
 
    <!--查询-->
    <select id="selectTmsQuoteDetailById" parameterType="Integer" resultMap="TmsQuoteDetailResult">
        <include refid="selectTmsQuoteDetailVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsQuoteDetailCount" parameterType="com.ruoyi.tms.domain.TmsQuoteDetail" resultType="int">
        <include refid="selectTmsQuoteDetailVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
    <select id="countSameCustomerRouteVehicle" parameterType="com.ruoyi.tms.domain.TmsQuoteDetail" resultType="int">
        SELECT COUNT(0)
        FROM tms_quote_plan AS p
                 INNER JOIN tms_quote_detail AS d
                            ON p.id = d.quote_plan_id
                                AND d.transport_route = #{transportRoute}
                                AND d.vehicle_type = #{vehicleType}
 
        WHERE p.id &lt;&gt; #{quotePlanId}
          AND p.customer_id = #{customerId} and d.plan_type = #{planType}
        <if test="id != '' and id != null">
            d.id &lt;&gt; #{id}
        </if>
    </select>
    <select id="selectTmsQuoteDetailList" parameterType="com.ruoyi.tms.domain.TmsQuoteDetail" resultMap="TmsQuoteDetailResult">
        <include refid="selectTmsQuoteDetailVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsQuoteDetail" parameterType="com.ruoyi.tms.domain.TmsQuoteDetail"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code,</if>
            <if test="quotePlanId != null">quote_plan_id,</if>
            <if test="quotePlanCode != null">quote_plan_code,</if>
            <if test="vehicleProviderId != null">vehicle_provider_id,</if>
            <if test="vehicleProviderName != null and vehicleProviderName != ''">vehicle_provider_name,</if>
            <if test="transportRoute != null and transportRoute != ''">transport_route,</if>
            <if test="startRegionCode != null and startRegionCode != ''">start_region_code,</if>
            <if test="startRegion != null and startRegion != ''">start_region,</if>
            <if test="startWarehouse != null">start_warehouse,</if>
            <if test="endRegionCode != null and endRegionCode != ''">end_region_code,</if>
            <if test="endRegion != null and endRegion != ''">end_region,</if>
            <if test="endWarehouse != null">end_warehouse,</if>
            <if test="vehicleType != null">vehicle_type,</if>
            <if test="transportMode != null">transport_mode,</if>
            <if test="routeType != null">route_type,</if>
            <if test="freightPrice != null">freight_price,</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="planType != null">plan_type,</if>
            <if test="customerId != null">customer_id,</if>
            <if test="currency != null">currency,</if>
            <if test="taxRate != null">tax_rate,</if>
            <if test="isSegmentedInvoice != null">is_segmented_invoice,</if>
            <if test="segment1FreightQuote != null">segment1_freight_quote,</if>
            <if test="segment1Currency != null">segment1_currency,</if>
            <if test="segment1TaxRate != null">segment1_tax_rate,</if>
            <if test="segment2FreightQuote != null">segment2_freight_quote,</if>
            <if test="segment2Currency != null">segment2_currency,</if>
            <if test="segment2TaxRate != null">segment2_tax_rate,</if>
            <if test="totalFreightCny != null">total_freight_cny,</if>
            <if test="totalFreightHkd != null">total_freight_hkd,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">#{systemCode},</if>
            <if test="quotePlanId != null">#{quotePlanId},</if>
            <if test="quotePlanCode != null">#{quotePlanCode},</if>
            <if test="vehicleProviderId != null">#{vehicleProviderId},</if>
            <if test="vehicleProviderName != null and vehicleProviderName != ''">#{vehicleProviderName},</if>
            <if test="transportRoute != null and transportRoute != ''">#{transportRoute},</if>
            <if test="startRegionCode != null and startRegionCode != ''">#{startRegionCode},</if>
            <if test="startRegion != null and startRegion != ''">#{startRegion},</if>
            <if test="startWarehouse != null">#{startWarehouse},</if>
            <if test="endRegionCode != null and endRegionCode != ''">#{endRegionCode},</if>
            <if test="endRegion != null and endRegion != ''">#{endRegion},</if>
            <if test="endWarehouse != null">#{endWarehouse},</if>
            <if test="vehicleType != null">#{vehicleType},</if>
            <if test="transportMode != null">#{transportMode},</if>
            <if test="routeType != null">#{routeType},</if>
            <if test="freightPrice != null">#{freightPrice},</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="planType != null">#{planType},</if>
            <if test="customerId != null">#{customerId},</if>
            <if test="currency != null">#{currency},</if>
            <if test="taxRate != null">#{taxRate},</if>
            <if test="isSegmentedInvoice != null">#{isSegmentedInvoice},</if>
            <if test="segment1FreightQuote != null">#{segment1FreightQuote},</if>
            <if test="segment1Currency != null">#{segment1Currency},</if>
            <if test="segment1TaxRate != null">#{segment1TaxRate},</if>
            <if test="segment2FreightQuote != null">#{segment2FreightQuote},</if>
            <if test="segment2Currency != null">#{segment2Currency},</if>
            <if test="segment2TaxRate != null">#{segment2TaxRate},</if>
            <if test="totalFreightCny != null">#{totalFreightCny},</if>
            <if test="totalFreightHkd != null">#{totalFreightHkd},</if>
        </trim>
    </insert>
 
    <insert id="insertTmsQuoteDetailBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_quote_detail
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,system_code,quote_plan_id,quote_plan_code,vehicle_provider_id,vehicle_provider_name,transport_route,start_region_code,start_region,start_warehouse,end_region_code,end_region,end_warehouse,vehicle_type,transport_mode,route_type,freight_price,status,create_by,create_time,update_by,update_time,remark,plan_type,customer_id,currency,tax_rate,is_segmented_invoice,segment1_freight_quote,segment1_currency,segment1_tax_rate,segment2_freight_quote,segment2_currency,segment2_tax_rate,total_freight_cny,total_freight_hkd,
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.systemCode},#{item.quotePlanId},#{item.quotePlanCode},#{item.vehicleProviderId},#{item.vehicleProviderName},#{item.transportRoute},#{item.startRegionCode},#{item.startRegion},#{item.startWarehouse},#{item.endRegionCode},#{item.endRegion},#{item.endWarehouse},#{item.vehicleType},#{item.transportMode},#{item.routeType},#{item.freightPrice},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.planType},#{item.customerId},#{item.currency},#{item.taxRate},#{item.isSegmentedInvoice},#{item.segment1FreightQuote},#{item.segment1Currency},#{item.segment1TaxRate},#{item.segment2FreightQuote},#{item.segment2Currency},#{item.segment2TaxRate},#{item.totalFreightCny},#{item.totalFreightHkd},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsQuoteDetail" parameterType="com.ruoyi.tms.domain.TmsQuoteDetail">
        update tms_quote_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="systemCode != null and systemCode != ''">system_code = #{systemCode},</if>
            <if test="quotePlanId != null">quote_plan_id = #{quotePlanId},</if>
            <if test="quotePlanCode != null">quote_plan_code = #{quotePlanCode},</if>
            <if test="vehicleProviderId != null">vehicle_provider_id = #{vehicleProviderId},</if>
            <if test="vehicleProviderName != null and vehicleProviderName != ''">vehicle_provider_name = #{vehicleProviderName},</if>
            <if test="transportRoute != null and transportRoute != ''">transport_route = #{transportRoute},</if>
            <if test="startRegionCode != null and startRegionCode != ''">start_region_code = #{startRegionCode},</if>
            <if test="startRegion != null and startRegion != ''">start_region = #{startRegion},</if>
            <if test="startWarehouse != null">start_warehouse = #{startWarehouse},</if>
            <if test="endRegionCode != null and endRegionCode != ''">end_region_code = #{endRegionCode},</if>
            <if test="endRegion != null and endRegion != ''">end_region = #{endRegion},</if>
            <if test="endWarehouse != null">end_warehouse = #{endWarehouse},</if>
            <if test="vehicleType != null">vehicle_type = #{vehicleType},</if>
            <if test="transportMode != null">transport_mode = #{transportMode},</if>
            <if test="routeType != null">route_type = #{routeType},</if>
            <if test="freightPrice != null">freight_price = #{freightPrice},</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="planType != null">plan_type = #{planType},</if>
            <if test="customerId != null">customer_id = #{customerId},</if>
            <if test="currency != null">currency = #{currency},</if>
            <if test="taxRate != null">tax_rate = #{taxRate},</if>
            <if test="isSegmentedInvoice != null">is_segmented_invoice = #{isSegmentedInvoice},</if>
            <if test="segment1FreightQuote != null">segment1_freight_quote = #{segment1FreightQuote},</if>
            <if test="segment1Currency != null">segment1_currency = #{segment1Currency},</if>
            <if test="segment1TaxRate != null">segment1_tax_rate = #{segment1TaxRate},</if>
            <if test="segment2FreightQuote != null">segment2_freight_quote = #{segment2FreightQuote},</if>
            <if test="segment2Currency != null">segment2_currency = #{segment2Currency},</if>
            <if test="segment2TaxRate != null">segment2_tax_rate = #{segment2TaxRate},</if>
            <if test="totalFreightCny != null">total_freight_cny = #{totalFreightCny},</if>
            <if test="totalFreightHkd != null">total_freight_hkd = #{totalFreightHkd},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsQuoteDetailBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_quote_detail
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.systemCode != null and item.systemCode != ''">system_code = #{item.systemCode},</if>
                <if test="item.quotePlanId != null">quote_plan_id = #{item.quotePlanId},</if>
                <if test="item.quotePlanCode != null">quote_plan_code = #{item.quotePlanCode},</if>
                <if test="item.vehicleProviderId != null">vehicle_provider_id = #{item.vehicleProviderId},</if>
                <if test="item.vehicleProviderName != null and item.vehicleProviderName != ''">vehicle_provider_name = #{item.vehicleProviderName},</if>
                <if test="item.transportRoute != null and item.transportRoute != ''">transport_route = #{item.transportRoute},</if>
                <if test="item.startRegionCode != null and item.startRegionCode != ''">start_region_code = #{item.startRegionCode},</if>
                <if test="item.startRegion != null and item.startRegion != ''">start_region = #{item.startRegion},</if>
                <if test="item.startWarehouse != null">start_warehouse = #{item.startWarehouse},</if>
                <if test="item.endRegionCode != null and item.endRegionCode != ''">end_region_code = #{item.endRegionCode},</if>
                <if test="item.endRegion != null and item.endRegion != ''">end_region = #{item.endRegion},</if>
                <if test="item.endWarehouse != null">end_warehouse = #{item.endWarehouse},</if>
                <if test="item.vehicleType != null">vehicle_type = #{item.vehicleType},</if>
                <if test="item.transportMode != null">transport_mode = #{item.transportMode},</if>
                <if test="item.routeType != null">route_type = #{item.routeType},</if>
                <if test="item.freightPrice != null">freight_price = #{item.freightPrice},</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.planType != null">plan_type = #{item.planType},</if>
                <if test="item.customerId != null">customer_id = #{item.customerId},</if>
                <if test="item.currency != null">currency = #{item.currency},</if>
                <if test="item.taxRate != null">tax_rate = #{item.taxRate},</if>
                <if test="item.isSegmentedInvoice != null">is_segmented_invoice = #{item.isSegmentedInvoice},</if>
                <if test="item.segment1FreightQuote != null">segment1_freight_quote = #{item.segment1FreightQuote},</if>
                <if test="item.segment1Currency != null">segment1_currency = #{item.segment1Currency},</if>
                <if test="item.segment1TaxRate != null">segment1_tax_rate = #{item.segment1TaxRate},</if>
                <if test="item.segment2FreightQuote != null">segment2_freight_quote = #{item.segment2FreightQuote},</if>
                <if test="item.segment2Currency != null">segment2_currency = #{item.segment2Currency},</if>
                <if test="item.segment2TaxRate != null">segment2_tax_rate = #{item.segment2TaxRate},</if>
                <if test="item.totalFreightCny != null">total_freight_cny = #{item.totalFreightCny},</if>
                <if test="item.totalFreightHkd != null">total_freight_hkd = #{item.totalFreightHkd},</if>
 
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsQuoteDetailById" parameterType="Integer">
        delete from tms_quote_detail where id = #{id}
    </delete>
    <delete id="deleteTmsQuoteDetailByIds" parameterType="Integer">
        delete from tms_quote_detail where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>