jiangqs
2023-05-03 3bba8ccaea4c0ff7ad5a7acb056d554c42b2eca2
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
<?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.shop.mapper.shop.ShopMapper">
 
    <resultMap type="Shop" id="ShopResult">
        <result property="shopId"    column="shop_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="shopStatus"    column="shop_status"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="updateime"    column="update_time"    />
        <result property="updateUserId"    column="update_user_id"    />
        <result property="shopName"    column="shop_name"    />
        <result property="shopNumber"    column="shop_number"    />
        <result property="shopType"    column="shop_type"    />
        <result property="businessStartTime"    column="business_start_time"    />
        <result property="businessEndTime"    column="business_end_time"    />
        <result property="shopownerName"    column="shopowner_name"    />
        <result property="shopownerPhone"    column="shopowner_phone"    />
        <result property="signTime"    column="sign_time"    />
        <result property="signProvinceCode"    column="sign_province_code"    />
        <result property="signCityCode"    column="sign_city_code"    />
        <result property="signAreaCode"    column="sign_area_code"    />
        <result property="signAreaName"    column="sign_area_name"    />
        <result property="shopServicePhone"    column="shop_service_phone"    />
        <result property="belongUserId"    column="belong_user_id"    />
        <result property="belongShopId"    column="belong_shop_id"    />
        <result property="supportingCapacityFlag"    column="supporting_capacity_flag"    />
        <result property="operationPersonFlag"    column="operation_person_flag"    />
        <result property="executiveForceFlag"    column="executive_force_flag"    />
        <result property="patternFlag"    column="pattern_flag"    />
        <result property="connectionFlag"    column="connection_flag"    />
        <result property="economicAbilityFlag"    column="economic_ability_flag"    />
        <result property="relationPartner"    column="relation_partner"    />
        <result property="businessHistory"    column="business_history"    />
        <result property="shopProvinceCode"    column="shop_province_code"    />
        <result property="shopCityCode"    column="shop_city_code"    />
        <result property="shopAreaCode"    column="shop_area_code"    />
        <result property="shopAreaName"    column="shop_area_name"    />
        <result property="shopAddress"    column="shop_address"    />
        <result property="shopLongitude"    column="shop_longitude"    />
        <result property="shopLatitude"    column="shop_latitude"    />
        <result property="shopDetail"    column="shop_detail"    />
        <result property="marketingFunctionFlag"    column="marketing_function_flag"    />
        <result property="platformCouponFlag"    column="platform_coupon_flag"    />
        <result property="platformBirthdayFlag"    column="platform_birthday_flag"    />
        <result property="shopCustomStatus"    column="shop_custom_status"    />
        <result property="recommendPerson"    column="recommend_person"    />
        <result property="cooperationEndTime"    column="cooperation_end_time"    />
        <result property="cooperationStartTime"    column="cooperation_start_time"    />
        <result property="shopTags"    column="shop_tags"    />
        <result property="signUserId"    column="sign_user_id"    />
        <result property="shopSource"    column="shop_source"    />
    </resultMap>
 
    <sql id="selectShopVo">
        select shop_id, del_flag, shop_status, create_time, create_user_id, update_time, update_user_id, shop_name, shop_number, shop_type, business_start_time, business_end_time, shopowner_name, shopowner_phone, sign_time, sign_province_code, sign_city_code, sign_area_code, sign_area_name, shop_service_phone, belong_user_id, belong_shop_id, supporting_capacity_flag, operation_person_flag, executive_force_flag, pattern_flag, connection_flag, economic_ability_flag, relation_partner, business_history, shop_province_code, shop_city_code, shop_area_code, shop_area_name, shop_address, shop_longitude, shop_latitude, shop_detail, marketing_function_flag, platform_coupon_flag, platform_birthday_flag, shop_custom_status, recommend_person, cooperation_end_time, cooperation_start_time, shop_tags, sign_user_id, shop_source from t_shop
    </sql>
 
    <select id="selectShopList" parameterType="Shop" resultMap="ShopResult">
        <include refid="selectShopVo"/>
        <where>
            <if test="shopStatus != null "> and shop_status = #{shopStatus}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
            <if test="shopName != null  and shopName != ''"> and shop_name like concat('%', #{shopName}, '%')</if>
            <if test="shopNumber != null  and shopNumber != ''"> and shop_number = #{shopNumber}</if>
            <if test="shopType != null "> and shop_type = #{shopType}</if>
            <if test="businessStartTime != null  and businessStartTime != ''"> and business_start_time = #{businessStartTime}</if>
            <if test="businessEndTime != null  and businessEndTime != ''"> and business_end_time = #{businessEndTime}</if>
            <if test="shopownerName != null  and shopownerName != ''"> and shopowner_name like concat('%', #{shopownerName}, '%')</if>
            <if test="shopownerPhone != null  and shopownerPhone != ''"> and shopowner_phone = #{shopownerPhone}</if>
            <if test="signTime != null "> and sign_time = #{signTime}</if>
            <if test="signProvinceCode != null  and signProvinceCode != ''"> and sign_province_code = #{signProvinceCode}</if>
            <if test="signCityCode != null  and signCityCode != ''"> and sign_city_code = #{signCityCode}</if>
            <if test="signAreaCode != null  and signAreaCode != ''"> and sign_area_code = #{signAreaCode}</if>
            <if test="signAreaName != null  and signAreaName != ''"> and sign_area_name like concat('%', #{signAreaName}, '%')</if>
            <if test="shopServicePhone != null  and shopServicePhone != ''"> and shop_service_phone = #{shopServicePhone}</if>
            <if test="belongUserId != null "> and belong_user_id = #{belongUserId}</if>
            <if test="belongShopId != null "> and belong_shop_id = #{belongShopId}</if>
            <if test="supportingCapacityFlag != null "> and supporting_capacity_flag = #{supportingCapacityFlag}</if>
            <if test="operationPersonFlag != null "> and operation_person_flag = #{operationPersonFlag}</if>
            <if test="executiveForceFlag != null "> and executive_force_flag = #{executiveForceFlag}</if>
            <if test="patternFlag != null "> and pattern_flag = #{patternFlag}</if>
            <if test="connectionFlag != null "> and connection_flag = #{connectionFlag}</if>
            <if test="economicAbilityFlag != null "> and economic_ability_flag = #{economicAbilityFlag}</if>
            <if test="relationPartner != null "> and relation_partner = #{relationPartner}</if>
            <if test="businessHistory != null  and businessHistory != ''"> and business_history = #{businessHistory}</if>
            <if test="shopProvinceCode != null  and shopProvinceCode != ''"> and shop_province_code = #{shopProvinceCode}</if>
            <if test="shopCityCode != null  and shopCityCode != ''"> and shop_city_code = #{shopCityCode}</if>
            <if test="shopAreaCode != null  and shopAreaCode != ''"> and shop_area_code = #{shopAreaCode}</if>
            <if test="shopAreaName != null  and shopAreaName != ''"> and shop_area_name like concat('%', #{shopAreaName}, '%')</if>
            <if test="shopAddress != null  and shopAddress != ''"> and shop_address = #{shopAddress}</if>
            <if test="shopLongitude != null  and shopLongitude != ''"> and shop_longitude = #{shopLongitude}</if>
            <if test="shopLatitude != null  and shopLatitude != ''"> and shop_latitude = #{shopLatitude}</if>
            <if test="shopDetail != null  and shopDetail != ''"> and shop_detail = #{shopDetail}</if>
            <if test="marketingFunctionFlag != null "> and marketing_function_flag = #{marketingFunctionFlag}</if>
            <if test="platformCouponFlag != null "> and platform_coupon_flag = #{platformCouponFlag}</if>
            <if test="platformBirthdayFlag != null "> and platform_birthday_flag = #{platformBirthdayFlag}</if>
            <if test="shopCustomStatus != null  and shopCustomStatus != ''"> and shop_custom_status = #{shopCustomStatus}</if>
            <if test="recommendPerson != null  and recommendPerson != ''"> and recommend_person = #{recommendPerson}</if>
            <if test="cooperationEndTime != null "> and cooperation_end_time = #{cooperationEndTime}</if>
            <if test="cooperationStartTime != null "> and cooperation_start_time = #{cooperationStartTime}</if>
            <if test="shopTags != null  and shopTags != ''"> and shop_tags = #{shopTags}</if>
            <if test="signUserId != null "> and sign_user_id = #{signUserId}</if>
            <if test="shopSource != null  and shopSource != ''"> and shop_source = #{shopSource}</if>
        </where>
    </select>
 
    <select id="selectShopByShopId" parameterType="Long" resultMap="ShopResult">
        <include refid="selectShopVo"/>
        where shop_id = #{shopId}
    </select>
 
    <insert id="insertShop" parameterType="Shop" useGeneratedKeys="true" keyProperty="shopId">
        insert into t_shop
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="shopStatus != null">shop_status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUserId != null">create_user_id,</if>
            <if test="updateime != null">update_time,</if>
            <if test="updateUserId != null">update_user_id,</if>
            <if test="shopName != null">shop_name,</if>
            <if test="shopNumber != null">shop_number,</if>
            <if test="shopType != null">shop_type,</if>
            <if test="businessStartTime != null">business_start_time,</if>
            <if test="businessEndTime != null">business_end_time,</if>
            <if test="shopownerName != null">shopowner_name,</if>
            <if test="shopownerPhone != null">shopowner_phone,</if>
            <if test="signTime != null">sign_time,</if>
            <if test="signProvinceCode != null">sign_province_code,</if>
            <if test="signCityCode != null">sign_city_code,</if>
            <if test="signAreaCode != null">sign_area_code,</if>
            <if test="signAreaName != null">sign_area_name,</if>
            <if test="shopServicePhone != null">shop_service_phone,</if>
            <if test="belongUserId != null">belong_user_id,</if>
            <if test="belongShopId != null">belong_shop_id,</if>
            <if test="supportingCapacityFlag != null">supporting_capacity_flag,</if>
            <if test="operationPersonFlag != null">operation_person_flag,</if>
            <if test="executiveForceFlag != null">executive_force_flag,</if>
            <if test="patternFlag != null">pattern_flag,</if>
            <if test="connectionFlag != null">connection_flag,</if>
            <if test="economicAbilityFlag != null">economic_ability_flag,</if>
            <if test="relationPartner != null">relation_partner,</if>
            <if test="businessHistory != null">business_history,</if>
            <if test="shopProvinceCode != null">shop_province_code,</if>
            <if test="shopCityCode != null">shop_city_code,</if>
            <if test="shopAreaCode != null">shop_area_code,</if>
            <if test="shopAreaName != null">shop_area_name,</if>
            <if test="shopAddress != null">shop_address,</if>
            <if test="shopLongitude != null">shop_longitude,</if>
            <if test="shopLatitude != null">shop_latitude,</if>
            <if test="shopDetail != null">shop_detail,</if>
            <if test="marketingFunctionFlag != null">marketing_function_flag,</if>
            <if test="platformCouponFlag != null">platform_coupon_flag,</if>
            <if test="platformBirthdayFlag != null">platform_birthday_flag,</if>
            <if test="shopCustomStatus != null">shop_custom_status,</if>
            <if test="recommendPerson != null">recommend_person,</if>
            <if test="cooperationEndTime != null">cooperation_end_time,</if>
            <if test="cooperationStartTime != null">cooperation_start_time,</if>
            <if test="shopTags != null">shop_tags,</if>
            <if test="signUserId != null">sign_user_id,</if>
            <if test="shopSource != null">shop_source,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="shopStatus != null">#{shopStatus},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUserId != null">#{createUserId},</if>
            <if test="updateime != null">#{updateime},</if>
            <if test="updateUserId != null">#{updateUserId},</if>
            <if test="shopName != null">#{shopName},</if>
            <if test="shopNumber != null">#{shopNumber},</if>
            <if test="shopType != null">#{shopType},</if>
            <if test="businessStartTime != null">#{businessStartTime},</if>
            <if test="businessEndTime != null">#{businessEndTime},</if>
            <if test="shopownerName != null">#{shopownerName},</if>
            <if test="shopownerPhone != null">#{shopownerPhone},</if>
            <if test="signTime != null">#{signTime},</if>
            <if test="signProvinceCode != null">#{signProvinceCode},</if>
            <if test="signCityCode != null">#{signCityCode},</if>
            <if test="signAreaCode != null">#{signAreaCode},</if>
            <if test="signAreaName != null">#{signAreaName},</if>
            <if test="shopServicePhone != null">#{shopServicePhone},</if>
            <if test="belongUserId != null">#{belongUserId},</if>
            <if test="belongShopId != null">#{belongShopId},</if>
            <if test="supportingCapacityFlag != null">#{supportingCapacityFlag},</if>
            <if test="operationPersonFlag != null">#{operationPersonFlag},</if>
            <if test="executiveForceFlag != null">#{executiveForceFlag},</if>
            <if test="patternFlag != null">#{patternFlag},</if>
            <if test="connectionFlag != null">#{connectionFlag},</if>
            <if test="economicAbilityFlag != null">#{economicAbilityFlag},</if>
            <if test="relationPartner != null">#{relationPartner},</if>
            <if test="businessHistory != null">#{businessHistory},</if>
            <if test="shopProvinceCode != null">#{shopProvinceCode},</if>
            <if test="shopCityCode != null">#{shopCityCode},</if>
            <if test="shopAreaCode != null">#{shopAreaCode},</if>
            <if test="shopAreaName != null">#{shopAreaName},</if>
            <if test="shopAddress != null">#{shopAddress},</if>
            <if test="shopLongitude != null">#{shopLongitude},</if>
            <if test="shopLatitude != null">#{shopLatitude},</if>
            <if test="shopDetail != null">#{shopDetail},</if>
            <if test="marketingFunctionFlag != null">#{marketingFunctionFlag},</if>
            <if test="platformCouponFlag != null">#{platformCouponFlag},</if>
            <if test="platformBirthdayFlag != null">#{platformBirthdayFlag},</if>
            <if test="shopCustomStatus != null">#{shopCustomStatus},</if>
            <if test="recommendPerson != null">#{recommendPerson},</if>
            <if test="cooperationEndTime != null">#{cooperationEndTime},</if>
            <if test="cooperationStartTime != null">#{cooperationStartTime},</if>
            <if test="shopTags != null">#{shopTags},</if>
            <if test="signUserId != null">#{signUserId},</if>
            <if test="shopSource != null">#{shopSource},</if>
        </trim>
    </insert>
 
    <update id="updateShop" parameterType="Shop">
        update t_shop
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="shopStatus != null">shop_status = #{shopStatus},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="updateime != null">update_time = #{updateime},</if>
            <if test="updateUserId != null">update_user_id = #{updateUserId},</if>
            <if test="shopName != null">shop_name = #{shopName},</if>
            <if test="shopNumber != null">shop_number = #{shopNumber},</if>
            <if test="shopType != null">shop_type = #{shopType},</if>
            <if test="businessStartTime != null">business_start_time = #{businessStartTime},</if>
            <if test="businessEndTime != null">business_end_time = #{businessEndTime},</if>
            <if test="shopownerName != null">shopowner_name = #{shopownerName},</if>
            <if test="shopownerPhone != null">shopowner_phone = #{shopownerPhone},</if>
            <if test="signTime != null">sign_time = #{signTime},</if>
            <if test="signProvinceCode != null">sign_province_code = #{signProvinceCode},</if>
            <if test="signCityCode != null">sign_city_code = #{signCityCode},</if>
            <if test="signAreaCode != null">sign_area_code = #{signAreaCode},</if>
            <if test="signAreaName != null">sign_area_name = #{signAreaName},</if>
            <if test="shopServicePhone != null">shop_service_phone = #{shopServicePhone},</if>
            <if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
            <if test="belongShopId != null">belong_shop_id = #{belongShopId},</if>
            <if test="supportingCapacityFlag != null">supporting_capacity_flag = #{supportingCapacityFlag},</if>
            <if test="operationPersonFlag != null">operation_person_flag = #{operationPersonFlag},</if>
            <if test="executiveForceFlag != null">executive_force_flag = #{executiveForceFlag},</if>
            <if test="patternFlag != null">pattern_flag = #{patternFlag},</if>
            <if test="connectionFlag != null">connection_flag = #{connectionFlag},</if>
            <if test="economicAbilityFlag != null">economic_ability_flag = #{economicAbilityFlag},</if>
            <if test="relationPartner != null">relation_partner = #{relationPartner},</if>
            <if test="businessHistory != null">business_history = #{businessHistory},</if>
            <if test="shopProvinceCode != null">shop_province_code = #{shopProvinceCode},</if>
            <if test="shopCityCode != null">shop_city_code = #{shopCityCode},</if>
            <if test="shopAreaCode != null">shop_area_code = #{shopAreaCode},</if>
            <if test="shopAreaName != null">shop_area_name = #{shopAreaName},</if>
            <if test="shopAddress != null">shop_address = #{shopAddress},</if>
            <if test="shopLongitude != null">shop_longitude = #{shopLongitude},</if>
            <if test="shopLatitude != null">shop_latitude = #{shopLatitude},</if>
            <if test="shopDetail != null">shop_detail = #{shopDetail},</if>
            <if test="marketingFunctionFlag != null">marketing_function_flag = #{marketingFunctionFlag},</if>
            <if test="platformCouponFlag != null">platform_coupon_flag = #{platformCouponFlag},</if>
            <if test="platformBirthdayFlag != null">platform_birthday_flag = #{platformBirthdayFlag},</if>
            <if test="shopCustomStatus != null">shop_custom_status = #{shopCustomStatus},</if>
            <if test="recommendPerson != null">recommend_person = #{recommendPerson},</if>
            <if test="cooperationEndTime != null">cooperation_end_time = #{cooperationEndTime},</if>
            <if test="cooperationStartTime != null">cooperation_start_time = #{cooperationStartTime},</if>
            <if test="shopTags != null">shop_tags = #{shopTags},</if>
            <if test="signUserId != null">sign_user_id = #{signUserId},</if>
            <if test="shopSource != null">shop_source = #{shopSource},</if>
        </trim>
        where shop_id = #{shopId}
    </update>
 
    <delete id="deleteShopByShopId" parameterType="Long">
        delete from t_shop where shop_id = #{shopId}
    </delete>
 
    <delete id="deleteShopByShopIds" parameterType="String">
        delete from t_shop where shop_id in
        <foreach item="shopId" collection="array" open="(" separator="," close=")">
            #{shopId}
        </foreach>
    </delete>
 
    <select id="pageShop" resultType="com.ruoyi.shop.domain.vo.MgtShopPageVo">
        SELECT
        ts.shop_id shopId,
        ts.sign_time signTime,
        ts.shop_name shopName,
        ts.shop_number shopNumber,
        ts.shop_tags shopTags,
        sus.nick_name signUser,
        null firstWithdraw,
        sub.nick_name belongUser,
        sd.dept_name belongDept,
        ts.shop_source shopSource,
        ts.sign_area_name signAreaName,
        CONCAT(ts.cooperation_start_time,'-',ts.cooperation_end_time) cooperationTime,
        CONCAT(ts.shop_area_name,ts.shop_address) shopAddress,
        ts.shopowner_name shopownerName,
        ts.shopowner_phone shopownerPhone,
        ts.shop_status shopStatus,
        tsm.shop_marketing_total shopActivityCount,
        ts.shop_custom_status shopCustomStatus
        FROM t_shop ts
        LEFT JOIN sys_user sus ON sus.user_id = ts.sign_user_id
        LEFT JOIN sys_user sub ON sub.user_id = ts.belong_user_id
        LEFT JOIN sys_dept sd ON sub.dept_id = sd.dept_id
        LEFT JOIN t_shop_marketing tsm ON tsm.shop_id = ts.shop_id
 
    </select>
 
</mapper>