<?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="com.ruoyi.system.api.domain.poji.shop.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="updateTime" 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" />
|
<result property="frozenFlag" column="frozen_flag" />
|
<result property="cooperativeFlag" column="cooperative_flag" />
|
<result property="modifyPricePermission" column="modify_price_permission" />
|
|
</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="com.ruoyi.system.api.domain.poji.shop.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>
|
<if test="frozenFlag != null and frozenFlag != ''"> and frozen_flag = #{frozenFlag}</if>
|
<if test="cooperativeFlag != null and cooperativeFlag != ''"> and cooperative_flag = #{cooperativeFlag}</if>
|
<if test="modifyPricePermission != null and modifyPricePermission != ''">and modify_price_permission = #{modifyPricePermission}</if>
|
</where>
|
</select>
|
|
<select id="selectShopByShopId" parameterType="Long" resultMap="ShopResult">
|
<include refid="selectShopVo"/>
|
where shop_id = #{shopId}
|
</select>
|
|
<insert id="insertShop" parameterType="com.ruoyi.system.api.domain.poji.shop.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="updateTime != 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>
|
<if test="modifyPricePermission != null">modify_price_permission,</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="updateTime != null">#{updateTime},</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>
|
<if test="modifyPricePermission != null">#{modifyPricePermission},</if>
|
</trim>
|
</insert>
|
|
<update id="updateShop" parameterType="com.ruoyi.system.api.domain.poji.shop.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="updateTime != null">update_time = #{updateTime},</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>
|
<if test="modifyPricePermission != null">modify_price_permission = #{modifyPricePermission},</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="pageMgtShop" 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,
|
ts.sign_user_id signUserId,
|
null firstWithdraw,
|
ts.belong_user_id belongUserId,
|
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,
|
CASE ts.shop_status
|
WHEN 0 THEN "冻结"
|
WHEN 1 THEN "正常"
|
WHEN 2 THEN "终止合作"
|
WHEN 3 THEN "进件中"
|
END shopStatus,
|
tsm.shop_marketing_total shopActivityCount,
|
ts.shop_custom_status shopCustomStatus,
|
ts.frozen_flag frozenFlag,
|
ts.cooperative_flag cooperativeFlag,
|
CASE ts.cooperative_flag WHEN 0 THEN "否" WHEN 1 THEN "是" END deadlineFlag
|
FROM t_shop ts
|
LEFT JOIN t_shop_marketing tsm ON tsm.shop_id = ts.shop_id
|
WHERE ts.del_flag = 0
|
<if test="param.shopType!=null and param.shopType!=''">
|
AND ts.shop_type = #{param.shopType}
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.signStartTime!=null and param.signStartTime!=''">
|
AND Date(ts.sign_time) >= #{param.signStartTime}
|
</if>
|
<if test="param.signEndTime!=null and param.signEndTime!=''">
|
AND Date(ts.sign_time) <= #{param.signEndTime}
|
</if>
|
<if test="param.signProvinceCode!=null and param.signProvinceCode!=''">
|
AND ts.sign_province_code REGEXP CONCAT('(^|;)' , #{param.signProvinceCode} , '(;|$)') -- 正则表达式 (^|;) 匹配字符串开头或分号,(;|$) 匹配分号或字符串结尾。
|
</if>
|
<if test="param.signCityCode!=null and param.signCityCode!=''">
|
AND ts.sign_city_code = REGEXP CONCAT('(^|;)' ,#{param.signCityCode} , '(;|$)')
|
</if>
|
<if test="param.signAreaCode!=null and param.signAreaCode!=''">
|
AND ts.sign_area_code = REGEXP CONCAT('(^|;)' ,#{param.signAreaCode}, '(;|$)')
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus==0">
|
AND ts.frozen_flag = 1
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus==1">
|
AND ts.frozen_flag = 0
|
</if>
|
<if test="param.recommendPerson!=null and param.recommendPerson!=''">
|
AND ts.recommend_person = #{param.recommendPerson}
|
</if>
|
<if test="param.belongUserId != null">
|
AND ts.belong_user_id = #{param.belongUserId}
|
</if>
|
<if test="param.belongUserIds != null and param.belongUserIds.size() > 0">
|
AND ts.belong_user_id in
|
<foreach collection="param.belongUserIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.belongShopId!=null and param.belongShopId!=''">
|
AND ts.belong_shop_id = #{param.belongShopId}
|
</if>
|
<if test="param.shopSource!=null and param.shopSource!=''">
|
AND ts.shop_source = #{param.shopSource}
|
</if>
|
<if test="param.shopCustomStatus!=null and param.shopCustomStatus!=''">
|
AND FIND_IN_SET(#{param.shopCustomStatus},ts.shop_custom_status) > 0
|
</if>
|
<if test="param.expireFlag!=null and param.expireFlag!=''">
|
AND ts.shop_status = 2
|
</if>
|
<if test="param.shopTags!=null and param.shopTags!=''">
|
AND ts.shop_tags REGEXP #{param.shopTags}
|
</if>
|
<if test="param.supportingCapacityFlag!=null and param.supportingCapacityFlag!=''">
|
AND ts.supporting_capacity_flag = #{param.supportingCapacityFlag}
|
</if>
|
<if test="param.operationPersonFlag!=null and param.operationPersonFlag!=''">
|
AND ts.operation_person_flag = #{param.operationPersonFlag}
|
</if>
|
<if test="param.executiveForceFlag!=null and param.executiveForceFlag!=''">
|
AND ts.executive_force_flag = #{param.executiveForceFlag}
|
</if>
|
<if test="param.patternFlag!=null and param.patternFlag!=''">
|
AND ts.pattern_flag = #{param.patternFlag}
|
</if>
|
<if test="param.connectionFlag!=null and param.connectionFlag!=''">
|
AND ts.connection_flag = #{param.connectionFlag}
|
</if>
|
<if test="param.economicAbilityFlag!=null and param.economicAbilityFlag!=''">
|
AND ts.economic_ability_flag = #{param.economicAbilityFlag}
|
</if>
|
<if test="param.relationPartner!=null and param.relationPartner!=''">
|
AND ts.relation_partner = #{param.relationPartner}
|
</if>
|
<if test="param.keyword!=null and param.keyword!=''">
|
AND (ts.shop_name LIKE CONCAT('%',#{param.keyword},'%') OR ts.shopowner_name LIKE CONCAT('%',#{param.keyword},'%')
|
OR ts.shopowner_phone LIKE CONCAT('%',#{param.keyword},'%') OR ts.shop_number LIKE CONCAT('%',#{param.keyword},'%'))
|
</if>
|
<if test="list !=null and list.size()>0" >
|
AND ts.shop_id IN
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != associatedAccount and associatedAccount.size() > 0">
|
and ts.shop_id in (select shop_id from t_shop_rel_user where del_flag = 0 and user_id in
|
<foreach collection="associatedAccount" item="iten" index="index" open="(" separator="," close=")">
|
#{iten}
|
</foreach>
|
)
|
</if>
|
ORDER BY ts.create_time DESC
|
</select>
|
|
|
<select id="pageMerAgencyVo" resultType="com.ruoyi.shop.domain.vo.MerAgencyPageVo">
|
SELECT
|
ts.shop_id shopId,
|
ts.shop_status shopStatus,
|
ts.shop_name shopName,
|
CONCAT(ts.shop_area_name,ts.shop_address) shopAddress,
|
ts.shopowner_name shopownerName,
|
ts.shopowner_phone shopownerPhone,
|
ts.cooperation_end_time cooperationEndTime,
|
ts.cooperative_flag cooperativeFlag,
|
tsf.file_url shopPicture
|
FROM t_shop ts
|
LEFT JOIN t_shop_file tsf ON tsf.shop_id = ts.shop_id AND tsf.del_flag = 0 AND tsf.file_type = 1
|
WHERE ts.del_flag = 0 AND ts.belong_shop_id = #{param.shopId}
|
<if test="param.shopStatus!=null and param.shopStatus==1">
|
AND ts.shop_status = 1
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus==0">
|
AND ts.frozen_flag = 1
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus==2">
|
AND ts.cooperation_end_time IS NOT NULL AND (CURRENT_DATE < Date(ts.cooperation_start_time) OR CURRENT_DATE > Date(ts.cooperation_end_time))
|
</if>
|
<if test="param.keyword!=null and param.keyword!=''">
|
AND (ts.shop_name LIKE CONCAT('%',#{param.keyword},'%') OR ts.shopowner_name LIKE CONCAT('%',#{param.keyword},'%')
|
OR ts.shopowner_phone LIKE CONCAT('%',#{param.keyword},'%'))
|
</if>
|
<if test="param.startCooperDate!=null and param.startCooperDate!=''">
|
AND Date(ts.cooperation_start_time) >= #{param.startCooperDate}
|
</if>
|
<if test="param.endCooperDate!=null and param.endCooperDate!=''">
|
AND Date(ts.cooperation_end_time) <= #{param.endCooperDate}
|
</if>
|
ORDER BY ts.create_time
|
</select>
|
|
<select id="getNearbyShop" resultType="com.ruoyi.shop.domain.vo.AppNearShopVo">
|
SELECT ts.shop_id shopId,
|
6378.138 * 2 * ASIN(SQRT(POW(SIN((#{param.latitude} * PI() / 180 - ts.shop_latitude * PI() / 180) / 2), 2)
|
+ COS(#{param.latitude} * PI() / 180) * COS(ts.shop_latitude * PI() / 180) * POW(
|
SIN((#{param.longitude} * PI() / 180 - ts.shop_longitude * PI() / 180) / 2), 2
|
))) AS distance
|
FROM t_shop ts
|
WHERE del_flag = 0 AND shop_status = 1
|
ORDER BY distance ASC LIMIT 1
|
</select>
|
|
|
<select id="getNearbyShops" resultType="com.ruoyi.shop.domain.vo.AppNearShopVo">
|
SELECT
|
ts.shop_id shopId,
|
6378.138 * 2 * ASIN(SQRT(POW(SIN((#{param.latitude} * PI() / 180 - ts.shop_latitude * PI() / 180) / 2), 2)
|
+ COS(#{param.latitude} * PI() / 180) * COS(ts.shop_latitude * PI() / 180) * POW(
|
SIN((#{param.longitude} * PI() / 180 - ts.shop_longitude * PI() / 180) / 2), 2
|
))) AS distance,
|
shop_longitude as longitude,
|
shop_latitude as latitude
|
FROM t_shop ts
|
WHERE del_flag = 0 AND shop_status = 1
|
ORDER BY distance ASC LIMIT 0, 5
|
</select>
|
|
|
<select id="pageMgtShopProportion" resultType="com.ruoyi.shop.domain.vo.MgtShopProportionPageVo">
|
SELECT
|
tsp.proportion_id proportionId,
|
ts.shop_id shopId,
|
ts.shop_name shopName,
|
ts.shop_address shopAddress,
|
ts.shopowner_name shopownerName,
|
tsp.proportion_percent proportionPercent
|
FROM t_shop ts
|
INNER JOIN t_shop_proportion tsp ON ts.shop_id = tsp.shop_id AND tsp.del_flag = 0
|
WHERE ts.del_flag = 0 AND ts.shop_type = #{param.shopType}
|
<if test="param.shopName!=null and param.shopName!=''">
|
AND ts.shop_name LIKE CONCAT('%',#{param.shopName},'%')
|
</if>
|
</select>
|
|
<update id="deleteShopTag">
|
UPDATE t_shop SET shop_tags = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', shop_tags, ','), CONCAT(',',#{shopTag},','), ','))
|
WHERE FIND_IN_SET(#{shopTag}, shop_tags) > 0
|
</update>
|
|
<select id="getShopIdByCode" resultType="java.lang.Long">
|
SELECT
|
ts.shop_id
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.shopName!=null and param.shopName!=''">
|
AND ts.shop_name LIKE CONCAT('%',#{param.shopName},'%')
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.belongUserId!=null and param.belongUserId!=''">
|
AND ts.belong_user_id = #{param.belongUserId}
|
</if>
|
</select>
|
|
<select id="listMgtShopSimpleVo" resultType="com.ruoyi.shop.domain.vo.MgtShopListSimpleVo">
|
SELECT
|
shop_id,
|
shop_name,
|
shopowner_name shopUser
|
FROM t_shop
|
WHERE del_flag = 0
|
<if test="param.shopType!=null and param.shopType!=''">
|
AND shop_type = #{param.shopType}
|
</if>
|
<if test="param.keyword!=null and param.keyword!=''">
|
AND shop_name LIKE CONCAT('%',#{param.keyword},'%')
|
</if>
|
<if test="list !=null and list.size()>0" >
|
AND shop_id IN
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="listShopSimpleVoByIds" resultType="com.ruoyi.system.api.domain.vo.MgtSimpleShopVo">
|
SELECT
|
shop_id,
|
shop_name,
|
shop_service_phone
|
FROM t_shop
|
WHERE del_flag = 0
|
<if test="null != shopIds and '' != shopIds">
|
AND FIND_IN_SET(shop_id,#{shopIds}) > 0
|
</if>
|
</select>
|
|
<select id="pageMgtShopByCityCode" resultType="com.ruoyi.system.api.domain.vo.MgtSimpleShopVo">
|
SELECT
|
shop_id,
|
shop_name
|
FROM t_shop
|
WHERE del_flag = 0 AND shop_status = 1
|
<if test="param.cityCodeList !=null and param.cityCodeList.size()>0" >
|
AND shop_city_code IN
|
<foreach collection="param.cityCodeList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="pageMgtShopAuth" resultType="com.ruoyi.shop.domain.vo.MgtShopAuthPageVo">
|
SELECT
|
tsa.auth_id authId,
|
ts.shop_id shopId,
|
ts.shop_name shopName,
|
ts.shopowner_name shopownerName,
|
ts.shopowner_phone shopownerPhone,
|
CASE tsa.main_type
|
WHEN 1 THEN '个人'
|
WHEN 2 THEN '企业'
|
END mainType,
|
tsa.audit_status auditStatus,
|
tsa.sign_state signState,
|
tsa.sign_url signUrl,
|
CASE tsa.audit_status
|
WHEN 0 THEN '待审核'
|
WHEN 1 THEN '审核中'
|
WHEN 2 THEN '审核中'
|
WHEN 3 THEN '审核中'
|
WHEN 4 THEN '已拒绝'
|
WHEN 5 THEN '审核中'
|
WHEN 6 THEN '已通过'
|
WHEN 7 THEN '已拒绝'
|
WHEN 8 THEN '已拒绝'
|
END auditStatusDesc,
|
ts.account_flag accountFlag,
|
CASE tsa.audit_status
|
WHEN 4 THEN 1
|
WHEN 5 THEN 1
|
END auditStatusSort
|
FROM t_shop ts
|
INNER JOIN t_shop_authentication tsa ON ts.shop_id = tsa.shop_id AND tsa.del_flag = 0
|
WHERE ts.del_flag = 0
|
<if test="param.shopName!=null and param.shopName!=''">
|
AND ts.shop_name LIKE CONCAT('%',#{param.shopName},'%')
|
</if>
|
<if test="param.shopownerName!=null and param.shopownerName!=''">
|
AND ts.shopowner_name LIKE CONCAT('%',#{param.shopownerName},'%')
|
</if>
|
<if test="param.shopownerPhone!=null and param.shopownerPhone!=''">
|
AND ts.shopowner_phone LIKE CONCAT('%',#{param.shopownerPhone},'%')
|
</if>
|
<if test="param.mainType!=null and param.mainType!=''">
|
AND tsa.main_type = #{param.mainType}
|
</if>
|
<if test="param.auditStatus!=null">
|
AND tsa.audit_status = #{param.auditStatus}
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus!=''">
|
AND ts.shop_status = #{param.shopStatus}
|
</if>
|
<if test="list!=null and list.size()>0">
|
AND ts.shop_id IN
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
ORDER BY auditStatusSort ASC,ts.create_time DESC
|
</select>
|
|
|
|
<select id="pageMgtShopHFTXAuth" resultType="com.ruoyi.shop.domain.vo.MgtShopHFTXAuthPageVo">
|
select
|
a.shop_id as shopId,
|
a.shop_name as shopName,
|
a.shopowner_name as shopownerName,
|
a.shopowner_phone as shopownerPhone,
|
CASE b.type WHEN 1 THEN '个人' WHEN 2 THEN '企业' END mainType,
|
CASE b.audit_status WHEN 'U' THEN '审核中' WHEN 'Y' THEN '审核通过' WHEN 'N' THEN '审核拒绝' WHEN 'F' THEN '失败' END auditStatus,
|
b.audit_desc as auditDesc,
|
b.share_ratio as shareRatio,
|
if(b.id is null, 1, 2) as status
|
from t_shop a
|
left join t_shop_authentication_hftx b on (a.shop_id = b.shop_id)
|
where a.del_flag = 0
|
<if test="param.shopName!=null and param.shopName!=''">
|
AND a.shop_name LIKE CONCAT('%',#{param.shopName},'%')
|
</if>
|
<if test="param.shopownerName!=null and param.shopownerName!=''">
|
AND a.shopowner_name LIKE CONCAT('%',#{param.shopownerName},'%')
|
</if>
|
<if test="param.shopownerPhone!=null and param.shopownerPhone!=''">
|
AND a.shopowner_phone LIKE CONCAT('%',#{param.shopownerPhone},'%')
|
</if>
|
<if test="param.mainType!=null and param.mainType!=''">
|
AND b.type = #{param.mainType}
|
</if>
|
<if test="param.auditStatus != null and '' != param.auditStatus">
|
AND b.audit_status = #{param.auditStatus}
|
</if>
|
<if test="param.shopStatus!=null and param.shopStatus!=''">
|
AND a.shop_status = #{param.shopStatus}
|
</if>
|
<if test="list!=null and list.size()>0">
|
AND a.shop_id IN
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
ORDER BY a.create_time DESC
|
</select>
|
|
|
|
<select id="shopTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo">
|
SELECT
|
COUNT(shop_id) AS shopTotal,
|
SUM(CASE WHEN shop_type = 1 THEN 1 ELSE 0 END) AS dealerTotal,
|
SUM(CASE WHEN shop_type = 2 THEN 1 ELSE 0 END) AS agencyTotal
|
FROM t_shop
|
WHERE del_flag = 0
|
<if test="null != userIds and userIds.size() > 0">
|
and belong_user_id in
|
<foreach collection="userIds" index="index" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="getPlTotalShopTotal" resultType="com.ruoyi.shop.domain.vo.MgtPlTotalShopTotalVo">
|
SELECT
|
COUNT(shop_id) AS shopTotal,
|
SUM(CASE WHEN shop_type = 1 THEN 1 ELSE 0 END) AS dealerTotal,
|
SUM(CASE WHEN shop_type = 2 THEN 1 ELSE 0 END) AS agencyTotal,
|
SUM(CASE WHEN cooperative_flag = 0 THEN 1 ELSE 0 END) AS terminateTotal
|
FROM t_shop
|
WHERE del_flag = 0
|
<if test="null != userIds and userIds.size() > 0">
|
and belong_user_id in
|
<foreach collection="userIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="listShopIdByTotal" resultType="java.lang.Long">
|
SELECT
|
ts.shop_id
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
</select>
|
|
<select id="listShopIdByPlTotal" resultType="java.lang.Long">
|
SELECT
|
ts.shop_id
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userId!=null and param.userId!=''">
|
AND ts.belong_user_id = #{param.userId}
|
</if>
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
</select>
|
|
|
<select id="listShopTypeTotal" resultType="com.ruoyi.system.api.domain.vo.MgtMapIntTotalVo">
|
SELECT
|
ts.shop_type mapKey,
|
COUNT(ts.shop_id) mapValue
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
GROUP BY ts.shop_type
|
</select>
|
|
<select id="listShopStatusTotal" resultType="com.ruoyi.system.api.domain.vo.MgtMapIntTotalVo">
|
SELECT
|
ts.shop_custom_status mapKey,
|
COUNT(ts.shop_id) mapValue
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
GROUP BY ts.shop_custom_status
|
</select>
|
|
<select id="listShopAreaRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapIntTotalVo">
|
SELECT
|
SUBSTRING_INDEX(SUBSTRING_INDEX(ts.shop_area_name, ',', 2), ',', -1) mapKey,
|
COUNT(ts.shop_id) mapValue
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
GROUP BY mapKey
|
ORDER BY COUNT(ts.shop_id) DESC LIMIT 15
|
</select>
|
|
<select id="listShopSalesRank" resultType="java.lang.Long">
|
SELECT
|
ts.shop_name mapKey,
|
tst.total_order_money mapValue
|
FROM t_shop ts
|
INNER JOIN t_shop_total tst ON ts.shop_id = tst.shop_id
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
ORDER BY tst.total_order_money DESC LIMIT 15
|
</select>
|
|
<select id="listShopRecommendRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapIntTotalVo">
|
SELECT
|
ts.recommend_person mapKey,
|
COUNT(ts.shop_id) mapValue
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach collection="param.userIdList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.shopProvinceCode!=null and param.shopProvinceCode!=''">
|
AND ts.shop_province_code = #{param.shopProvinceCode}
|
</if>
|
<if test="param.shopCityCode!=null and param.shopCityCode!=''">
|
AND ts.shop_city_code = #{param.shopCityCode}
|
</if>
|
<if test="param.shopAreaCode!=null and param.shopAreaCode!=''">
|
AND ts.shop_area_code = #{param.shopAreaCode}
|
</if>
|
<if test="param.startDate!=null and param.startDate!=''">
|
AND Date(ts.create_time) >= #{param.startDate}
|
</if>
|
<if test="param.endDate!=null and param.endDate!=''">
|
AND Date(ts.create_time) <= #{param.endDate}
|
</if>
|
GROUP BY ts.recommend_person
|
ORDER BY COUNT(ts.shop_id) DESC
|
</select>
|
|
<select id="pageStaffShop" resultType="com.ruoyi.shop.domain.vo.StaffShopPageVo">
|
SELECT
|
ts.shop_id shopId,
|
ts.sign_time signTime,
|
ts.shop_name shopName,
|
ts.shop_tags shopTags,
|
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,
|
tsf.file_url shopPicture,
|
tbs.shop_name belongShopName,
|
ts.frozen_flag frozenFlag
|
FROM t_shop ts
|
LEFT JOIN t_shop_file tsf ON tsf.shop_id = ts.shop_id AND tsf.del_flag = 0 AND file_type = 1
|
LEFT JOIN t_shop tbs ON tbs.shop_id = ts.belong_shop_id AND tbs.del_flag = 0
|
WHERE ts.del_flag = 0
|
<if test="param.shopType!=null and param.shopType!=''">
|
AND ts.shop_type = #{param.shopType}
|
</if>
|
<if test="param.signStartTime!=null and param.signStartTime!=''">
|
AND Date(ts.sign_time) >= #{param.signStartTime}
|
</if>
|
<if test="param.signEndTime!=null and param.signEndTime!=''">
|
AND Date(ts.sign_time) <= #{param.signEndTime}
|
</if>
|
<if test="param.signProvinceCode!=null and param.signProvinceCode!=''">
|
AND ts.sign_province_code = REGEXP CONCAT('(^|;)' ,#{param.signProvinceCode}, '(;|$)')
|
</if>
|
<if test="param.signCityCode!=null and param.signCityCode!=''">
|
AND ts.sign_city_code = REGEXP CONCAT('(^|;)' ,#{param.signCityCode}, '(;|$)')
|
</if>
|
<if test="param.signAreaCode!=null and param.signAreaCode!=''">
|
AND ts.sign_area_code = REGEXP CONCAT('(^|;)' ,#{param.signAreaCode}, '(;|$)')
|
</if>
|
<if test="param.recommendPerson!=null and param.recommendPerson!=''">
|
AND ts.recommend_person = #{param.recommendPerson}
|
</if>
|
<if test="param.belongUserId!=null and param.belongUserId!=''">
|
AND ts.belong_user_id = #{param.belongUserId}
|
</if>
|
<if test="param.userIdList!=null and param.userIdList.size()>0">
|
AND ts.belong_user_id IN
|
<foreach item="id" collection="param.userIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
<if test="param.shopCustomStatus!=null and param.shopCustomStatus!=''">
|
AND FIND_IN_SET(#{param.shopCustomStatus},ts.shop_custom_status) > 0
|
</if>
|
<if test="param.supportingCapacityFlag!=null and param.supportingCapacityFlag!=''">
|
AND ts.supporting_capacity_flag = #{param.supportingCapacityFlag}
|
</if>
|
<if test="param.operationPersonFlag!=null and param.operationPersonFlag!=''">
|
AND ts.operation_person_flag = #{param.operationPersonFlag}
|
</if>
|
<if test="param.executiveForceFlag!=null and param.executiveForceFlag!=''">
|
AND ts.executive_force_flag = #{param.executiveForceFlag}
|
</if>
|
<if test="param.patternFlag!=null and param.patternFlag!=''">
|
AND ts.pattern_flag = #{param.patternFlag}
|
</if>
|
<if test="param.connectionFlag!=null and param.connectionFlag!=''">
|
AND ts.connection_flag = #{param.connectionFlag}
|
</if>
|
<if test="param.economicAbilityFlag!=null and param.economicAbilityFlag!=''">
|
AND ts.economic_ability_flag = #{param.economicAbilityFlag}
|
</if>
|
<if test="param.relationPartner!=null and param.relationPartner!=''">
|
AND ts.relation_partner = #{param.relationPartner}
|
</if>
|
<if test="param.keyword!=null and param.keyword!=''">
|
AND (ts.shop_name LIKE CONCAT('%',#{param.keyword},'%') OR ts.shopowner_name LIKE CONCAT('%',#{param.keyword},'%')
|
OR ts.shopowner_phone LIKE CONCAT('%',#{param.keyword},'%') OR ts.shop_number LIKE CONCAT('%',#{param.keyword},'%')
|
OR tbs.shop_name LIKE CONCAT('%',#{param.keyword},'%'))
|
</if>
|
ORDER BY ts.create_time DESC
|
</select>
|
|
<select id="getStaffSimpleTotal" resultType="com.ruoyi.shop.domain.vo.StaffShopSimpleTotalVo">
|
SELECT
|
COUNT(shop_id) shopTotal,
|
SUM(CASE shop_status WHEN 0 THEN 1 WHEN 2 THEN 1 WHEN 3 THEN 1 ELSE 0 END) closeShopTotal,
|
SUM(CASE shop_status WHEN 1 THEN 1 ELSE 0 END) openShopTotal
|
FROM t_shop ts
|
WHERE ts.del_flag = 0 AND ts.shop_type = #{shopType}
|
<if test="null != userIdList">
|
AND ts.belong_user_id IN
|
<foreach item="id" collection="userIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="getStaffHomeTotal" resultType="com.ruoyi.shop.domain.vo.StaffHomeShopTotalVo">
|
SELECT
|
COUNT(shop_id) shopTotal,
|
SUM(CASE shop_type WHEN 1 THEN 1 ELSE 0 END) dealerTotal,
|
SUM(CASE shop_type WHEN 2 THEN 1 ELSE 0 END) agencyTotal
|
FROM t_shop ts
|
WHERE ts.del_flag = 0
|
<if test="null != userIdList">
|
AND ts.belong_user_id IN
|
<foreach item="id" collection="userIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
</select>
|
|
<update id="updateExtendContacts">
|
update t_shop SET
|
<if test="extendContacts!=null and extendContacts != ''">
|
extend_contacts = #{extendContacts},
|
</if>
|
<if test="extendContacts ==null or extendContacts == ''">
|
extend_contacts = null,
|
</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateUserId != null">update_user_id = #{updateUserId}</if>
|
WHERE shop_id = #{shopId}
|
</update>
|
|
<update id="setBelongShopIdNull">
|
UPDATE t_shop
|
SET belong_shop_id = NULL
|
WHERE belong_shop_id = #{shopId} and del_flag = 0 and shopstatus!=-1 and shop_type = 2
|
</update>
|
<update id="updateShopByOneClinkSyncing">
|
UPDATE t_shop
|
SET
|
shop_detail = #{param.shopDetail},
|
platform_coupon_flag = #{param.platformCouponFlag},
|
platform_birthday_flag = #{param.platformBirthdayFlag},
|
update_user_id = #{param.userId},
|
update_time = NOW()
|
WHERE
|
shop_id IN
|
<foreach item="id" collection="param.shopIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</update>
|
|
<select id="listShopIdByCityCode" resultType="java.lang.Long">
|
SELECT shop_id
|
FROM t_shop
|
WHERE del_flag = 0
|
AND shop_city_code IN
|
<foreach item="id" collection="cityCodes" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
|
|
<select id="listShopByCityCode" resultMap="ShopResult">
|
<include refid="selectShopVo"/>
|
WHERE del_flag = 0 and shop_status = 1
|
AND shop_city_code IN
|
<foreach item="id" collection="cityCodes" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
|
<select id="getTaskMsgList" resultType="com.ruoyi.system.api.domain.vo.MgtUserTaskMsgVo">
|
SELECT
|
ts.belong_user_id userId,
|
CONCAT('[', GROUP_CONCAT(tst.task_title SEPARATOR '],['), ']') taskTitle
|
FROM t_shop_task tst
|
INNER JOIN t_shop ts ON tst.shop_id = ts.shop_id AND ts.del_flag = 0
|
WHERE tst.del_flag = 0 AND tst.task_status = 1 AND tst.task_date = CURRENT_DATE
|
GROUP BY userId
|
UNION ALL
|
SELECT
|
tsru.user_id userId,
|
CONCAT('[', GROUP_CONCAT(tst.task_content SEPARATOR '],['), ']') taskTitle
|
FROM t_agency_task tst
|
INNER JOIN t_shop_rel_user tsru ON tsru.shop_id = tst.shop_id AND tsru.del_flag = 0
|
WHERE tst.del_flag = 0 AND tst.task_status = 1 AND tst.task_date = CURRENT_DATE
|
GROUP BY userId
|
</select>
|
|
<select id="getFranchiseeIdsBYDealerId" resultType="com.ruoyi.system.api.domain.poji.shop.Shop">
|
select
|
*
|
from t_shop
|
where
|
del_flag=0
|
and
|
belong_shop_id = #{shopId}
|
</select>
|
<select id="getMgtShopPageVoByShopIds" resultType="com.ruoyi.system.api.domain.vo.MgtOneClinkSyncingShopPageVo">
|
SELECT
|
ts.shop_id shopId,
|
ts.shop_number shopNumber,
|
ts.shop_name shopName,
|
ts.shop_tags shopTags,
|
ts.shop_source shopSource,
|
belong.shop_name belongShopName,
|
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,
|
tsm.shop_marketing_total shopActivityCount,
|
ts.shop_custom_status shopCustomStatus,
|
ts.frozen_flag frozenFlag
|
FROM t_shop ts
|
LEFT JOIN t_shop_marketing tsm ON tsm.shop_id = ts.shop_id
|
left join t_shop belong on ts.belong_shop_id = belong.shop_id
|
WHERE ts.del_flag = 0
|
<if test="list !=null and list.size()>0" >
|
AND ts.shop_id IN
|
<foreach collection="list" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
|
</select>
|
|
</mapper>
|