zhangback
2025-11-18 4636b03d801662db1b8712d7a9ae9105462eca37
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
<?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.TmsConsignorMapper">
 
    <resultMap type="com.ruoyi.tms.domain.TmsConsignor" id="TmsConsignorResult">
        <result property="id"    column="id"    />
        <result property="consignorCode"    column="consignor_code"    />
        <result property="consignorName"    column="consignor_name"    />
        <result property="customerId"    column="customer_id"    />
        <result property="customerName"    column="customer_name"    />
        <result property="customerSysCode"    column="customer_sys_code"    />
        <result property="consignorType"    column="consignor_type"    />
        <result property="contactName"    column="contact_name"    />
        <result property="contactPhone"    column="contact_phone"    />
        <result property="contactEmail"    column="contact_email"    />
        <result property="countryId"    column="country_id"    />
        <result property="provinceId"    column="province_id"    />
        <result property="cityId"    column="city_id"    />
        <result property="districtId"    column="district_id"    />
        <result property="streetId"    column="street_id"    />
        <result property="addressDetail"    column="address_detail"    />
        <result property="dispatchTransportArea"    column="dispatch_transport_area"    />
        <result property="mapLocation"    column="map_location"    />
        <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="regionLabel"    column="region_label"    />
        <result property="electronicFenceRange"    column="electronic_fence_range"    />
    </resultMap>
 
    <sql id="selectTmsConsignorVo">
        select thisTab.id, thisTab.consignor_code, thisTab.consignor_name, thisTab.customer_id, thisTab.customer_name, thisTab.customer_sys_code, thisTab.consignor_type, thisTab.contact_name, thisTab.contact_phone, thisTab.contact_email, thisTab.country_id, thisTab.province_id, thisTab.city_id, thisTab.district_id, thisTab.street_id, thisTab.address_detail, thisTab.dispatch_transport_area, thisTab.map_location, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark, thisTab.region_label ,thisTab.electronic_fence_range from tms_consignor AS thisTab
    </sql>
    <sql id="selectTmsConsignorVoCount">
        select count(0) from tms_consignor as thisTab
    </sql>
 
    <sql id="whereCondition">
        <if test="consignorCode != null  and consignorCode != ''"> and thisTab.consignor_code = #{consignorCode}</if>
        <if test="consignorName != null  and consignorName != ''"> and  thisTab.consignor_name like concat('%', #{consignorName}, '%')</if>
        <if test="customerId != null "> and thisTab.customer_id = #{customerId}</if>
        <if test="customerName != null  and customerName != ''"> and  thisTab.customer_name like concat('%', #{customerName}, '%')</if>
        <if test="customerSysCode != null  and customerSysCode != ''"> and thisTab.customer_sys_code = #{customerSysCode}</if>
        <if test="consignorType != null "> and thisTab.consignor_type = #{consignorType}</if>
        <if test="contactName != null  and contactName != ''"> and  thisTab.contact_name like concat('%', #{contactName}, '%')</if>
        <if test="dispatchTransportArea != null  and dispatchTransportArea != ''"> and thisTab.dispatch_transport_area = #{dispatchTransportArea}</if>
        <if test="status != null "> and thisTab.status = #{status}</if>
        <if test="updateBy != null  and updateBy != ''"> and thisTab.update_by = #{updateBy}</if>
        <if test="updateTime != null "> and thisTab.update_time = #{updateTime}</if>
        <if test="regionLabel != null  and regionLabel != ''"> and thisTab.region_label = #{regionLabel}</if>
    </sql>
 
    <!--查询-->
    <select id="selectTmsConsignorById" parameterType="Integer" resultMap="TmsConsignorResult">
        <include refid="selectTmsConsignorVo"/>
        where id = #{id}
    </select>
 
    <select id="selectTmsConsignorCount" parameterType="com.ruoyi.tms.domain.TmsConsignor" resultType="int">
        <include refid="selectTmsConsignorVoCount"/>
        <where>
            <include refid="whereCondition"/>
        </where>
    </select>
 
    <select id="selectTmsConsignorList" parameterType="com.ruoyi.tms.domain.TmsConsignor" resultMap="TmsConsignorResult">
        <include refid="selectTmsConsignorVo"/>
        <where>
            <include refid="whereCondition"/>
        </where>
        order by thisTab.id desc
    </select>
 
    <!-- 新增 -->
    <insert id="insertTmsConsignor" parameterType="com.ruoyi.tms.domain.TmsConsignor"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_consignor
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="consignorCode != null and consignorCode != ''">consignor_code,</if>
            <if test="consignorName != null and consignorName != ''">consignor_name,</if>
            <if test="customerId != null">customer_id,</if>
            <if test="customerName != null">customer_name,</if>
            <if test="customerSysCode != null and customerSysCode != ''">customer_sys_code,</if>
            <if test="consignorType != null">consignor_type,</if>
            <if test="contactName != null and contactName != ''">contact_name,</if>
            <if test="contactPhone != null">contact_phone,</if>
            <if test="contactEmail != null">contact_email,</if>
            <if test="countryId != null">country_id,</if>
            <if test="provinceId != null">province_id,</if>
            <if test="cityId != null">city_id,</if>
            <if test="districtId != null">district_id,</if>
            <if test="streetId != null">street_id,</if>
            <if test="addressDetail != null">address_detail,</if>
            <if test="dispatchTransportArea != null and dispatchTransportArea != ''">dispatch_transport_area,</if>
            <if test="mapLocation != null">map_location,</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="regionLabel != null">region_label,</if>
            <if test="electronicFenceRange != null">electronic_fence_range,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="consignorCode != null and consignorCode != ''">#{consignorCode},</if>
            <if test="consignorName != null and consignorName != ''">#{consignorName},</if>
            <if test="customerId != null">#{customerId},</if>
            <if test="customerName != null">#{customerName},</if>
            <if test="customerSysCode != null and customerSysCode != ''">#{customerSysCode},</if>
            <if test="consignorType != null">#{consignorType},</if>
            <if test="contactName != null and contactName != ''">#{contactName},</if>
            <if test="contactPhone != null">#{contactPhone},</if>
            <if test="contactEmail != null">#{contactEmail},</if>
            <if test="countryId != null">#{countryId},</if>
            <if test="provinceId != null">#{provinceId},</if>
            <if test="cityId != null">#{cityId},</if>
            <if test="districtId != null">#{districtId},</if>
            <if test="streetId != null">#{streetId},</if>
            <if test="addressDetail != null">#{addressDetail},</if>
            <if test="dispatchTransportArea != null and dispatchTransportArea != ''">#{dispatchTransportArea},</if>
            <if test="mapLocation != null">#{mapLocation},</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="regionLabel != null">#{regionLabel},</if>
            <if test="electronicFenceRange != null">#{electronicFenceRange},</if>
        </trim>
    </insert>
 
    <insert id="insertTmsConsignorBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
        insert into tms_consignor
        <trim prefix="(" suffix=") values" suffixOverrides=",">
            id,consignor_code,consignor_name,customer_id,customer_name,customer_sys_code,consignor_type,contact_name,contact_phone,contact_email,country_id,province_id,city_id,district_id,street_id,address_detail,dispatch_transport_area,map_location,status,create_by,create_time,update_by,update_time,remark,region_label,electronic_fence_range
        </trim>
        <foreach item="item" index="index" collection="list" separator=",">
            <trim prefix="(" suffix=") " suffixOverrides=",">
                #{item.id},#{item.consignorCode},#{item.consignorName},#{item.customerId},#{item.customerName},#{item.customerSysCode},#{item.consignorType},#{item.contactName},#{item.contactPhone},#{item.contactEmail},#{item.countryId},#{item.provinceId},#{item.cityId},#{item.districtId},#{item.streetId},#{item.addressDetail},#{item.dispatchTransportArea},#{item.mapLocation},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.regionLabel},#{item.electronicFenceRange},
            </trim>
        </foreach>
    </insert>
 
    <!-- 修改 -->
    <update id="updateTmsConsignor" parameterType="com.ruoyi.tms.domain.TmsConsignor">
        update tms_consignor
        <trim prefix="SET" suffixOverrides=",">
            <if test="consignorCode != null and consignorCode != ''">consignor_code = #{consignorCode},</if>
            <if test="consignorName != null and consignorName != ''">consignor_name = #{consignorName},</if>
            <if test="customerId != null">customer_id = #{customerId},</if>
            <if test="customerName != null">customer_name = #{customerName},</if>
            <if test="customerSysCode != null and customerSysCode != ''">customer_sys_code = #{customerSysCode},</if>
            <if test="consignorType != null">consignor_type = #{consignorType},</if>
            <if test="contactName != null and contactName != ''">contact_name = #{contactName},</if>
            <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
            <if test="contactEmail != null">contact_email = #{contactEmail},</if>
            <if test="countryId != null">country_id = #{countryId},</if>
            <if test="provinceId != null">province_id = #{provinceId},</if>
            <if test="cityId != null">city_id = #{cityId},</if>
            <if test="districtId != null">district_id = #{districtId},</if>
            <if test="streetId != null">street_id = #{streetId},</if>
            <if test="addressDetail != null">address_detail = #{addressDetail},</if>
            <if test="dispatchTransportArea != null and dispatchTransportArea != ''">dispatch_transport_area = #{dispatchTransportArea},</if>
            <if test="mapLocation != null">map_location = #{mapLocation},</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="regionLabel != null">region_label = #{regionLabel},</if>
            <if test="electronicFenceRange != null">electronic_fence_range = #{electronicFenceRange},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 修改 -->
    <update id="updateTmsConsignorBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" separator=";">
            update tms_consignor
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.consignorCode != null and item.consignorCode != ''">consignor_code = #{item.consignorCode},</if>
                <if test="item.consignorName != null and item.consignorName != ''">consignor_name = #{item.consignorName},</if>
                <if test="item.customerId != null">customer_id = #{item.customerId},</if>
                <if test="item.customerName != null">customer_name = #{item.customerName},</if>
                <if test="item.customerSysCode != null and item.customerSysCode != ''">customer_sys_code = #{item.customerSysCode},</if>
                <if test="item.consignorType != null">consignor_type = #{item.consignorType},</if>
                <if test="item.contactName != null and item.contactName != ''">contact_name = #{item.contactName},</if>
                <if test="item.contactPhone != null">contact_phone = #{item.contactPhone},</if>
                <if test="item.contactEmail != null">contact_email = #{item.contactEmail},</if>
                <if test="item.countryId != null">country_id = #{item.countryId},</if>
                <if test="item.provinceId != null">province_id = #{item.provinceId},</if>
                <if test="item.cityId != null">city_id = #{item.cityId},</if>
                <if test="item.districtId != null">district_id = #{item.districtId},</if>
                <if test="item.streetId != null">street_id = #{item.streetId},</if>
                <if test="item.addressDetail != null">address_detail = #{item.addressDetail},</if>
                <if test="item.dispatchTransportArea != null and item.dispatchTransportArea != ''">dispatch_transport_area = #{item.dispatchTransportArea},</if>
                <if test="item.mapLocation != null">map_location = #{item.mapLocation},</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.regionLabel != null">region_label = #{item.regionLabel},</if>
                <if test="item.electronicFenceRange != null">electronic_fence_range = #{item.electronicFenceRange},</if>
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <!--删除-->
    <delete id="deleteTmsConsignorById" parameterType="Integer">
        delete from tms_consignor where id = #{id}
    </delete>
    <delete id="deleteTmsConsignorByIds" parameterType="Integer">
        delete from tms_consignor where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>