# Conflicts: # coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java
434 lines
19 KiB
XML
434 lines
19 KiB
XML
<?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.cool.store.mapper.ShopInfoMapper">
|
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopInfoDO">
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
<result column="region_id" jdbcType="BIGINT" property="regionId"/>
|
|
<result column="line_id" jdbcType="BIGINT" property="lineId"/>
|
|
<result column="partner_id" jdbcType="VARCHAR" property="partnerId"/>
|
|
<result column="point_id" jdbcType="BIGINT" property="pointId"/>
|
|
<result column="shop_name" jdbcType="VARCHAR" property="shopName"/>
|
|
<result column="shop_code" jdbcType="VARCHAR" property="shopCode"/>
|
|
<result column="store_num" jdbcType="VARCHAR" property="storeNum"/>
|
|
<result column="shop_manager_user_id" jdbcType="VARCHAR" property="shopManagerUserId"/>
|
|
<result column="supervisor_user_id" jdbcType="VARCHAR" property="supervisorUserId"/>
|
|
<result column="plan_open_time" jdbcType="TIMESTAMP" property="planOpenTime"/>
|
|
<result column="cur_progress" jdbcType="DECIMAL" property="curProgress"/>
|
|
<result column="shop_type" jdbcType="TINYINT" property="shopType"/>
|
|
<result column="shop_stage" jdbcType="TINYINT" property="shopStage"/>
|
|
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
<result column="join_mode" jdbcType="TINYINT" property="joinMode"/>
|
|
<result column="detail_address" jdbcType="VARCHAR" property="detailAddress"/>
|
|
<result column="franchise_brand" jdbcType="VARCHAR" property="franchiseBrand"/>
|
|
<result column="development_manager" jdbcType="VARCHAR" property="developmentManager"/>
|
|
<result column="want_shop_area_id" jdbcType="BIGINT" property="wantShopAreaId"/>
|
|
<result column="investment_manager" jdbcType="VARCHAR" property="investmentManager"/>
|
|
<result column="shop_status" jdbcType="TINYINT" property="shopStatus"/>
|
|
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
|
|
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
|
</resultMap>
|
|
|
|
<sql id="allColumn">
|
|
id
|
|
, region_id, line_id, partner_id, point_id, shop_name,
|
|
shop_code, store_num, shop_manager_user_id, supervisor_user_id,
|
|
plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time,
|
|
join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id
|
|
</sql>
|
|
|
|
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
|
insert into xfsg_shop_info(region_id, line_id, partner_id, shop_name,
|
|
store_num,supervisor_user_id,create_time,join_mode,franchise_brand,
|
|
development_manager,want_shop_area_id,investment_manager) values
|
|
<foreach collection="shopInfoList" item="shop" separator=",">
|
|
(#{shop.regionId}, #{shop.lineId}, #{shop.partnerId}, #{shop.shopName},
|
|
#{shop.storeNum},#{shop.supervisorUserId},#{shop.createTime},#{shop.joinMode},#{shop.franchiseBrand},#{shop.developmentManager},
|
|
#{shop.wantShopAreaId},#{shop.investmentManager})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="getShopList" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
|
|
</select>
|
|
|
|
<select id="getShopInfoByPointId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from xfsg_shop_info where point_id = #{pointId} and deleted= '0'
|
|
</select>
|
|
|
|
<select id="getStageShopCount" resultType="com.cool.store.vo.shop.StageShopCountVO">
|
|
select sum(if(shop_stage = 1, 1, 0)) as selectPointCount,
|
|
sum(if(shop_stage = 2, 1, 0)) as buildShopCount,
|
|
sum(if(shop_stage = 3, 1, 0)) as openShopCount
|
|
from xfsg_shop_info
|
|
where deleted = '0'
|
|
and line_id = #{lineId}
|
|
</select>
|
|
|
|
<update id="unbindPoint">
|
|
update xfsg_shop_info
|
|
set point_id = null
|
|
where id = #{shopId}
|
|
</update>
|
|
|
|
<select id="getShopListByIds" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from
|
|
xfsg_shop_info where id in
|
|
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
|
#{shopId}
|
|
</foreach>
|
|
</select>
|
|
|
|
|
|
<select id="queryStoreNumeListByid" resultType="com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO">
|
|
select id as shopId,store_num as storeNum
|
|
from xfsg_shop_info
|
|
where 1=1
|
|
<if test="shopIdList != null and shopIdList.size >0">
|
|
and id in
|
|
<foreach collection="shopIdList" separator="," open="(" close=")" item="shopId">
|
|
#{shopId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getSelectedShopNum" resultType="com.cool.store.dto.point.LineCountDTO">
|
|
select
|
|
line_id as lineId,
|
|
count(1) as selectedShopNum
|
|
from xfsg_shop_info
|
|
where deleted = 0 and point_id > 0 and line_id in
|
|
<foreach collection="lineIds" item="lineId" index="index" open="(" separator="," close=")">
|
|
#{lineId}
|
|
</foreach>
|
|
group by line_id
|
|
</select>
|
|
|
|
<select id="ListByCondition" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
|
select
|
|
a.id as id,
|
|
a.line_id as lineId,
|
|
a.shop_name as shopName,
|
|
a.shop_code as shopCode,
|
|
a.store_num as storeNum,
|
|
a.shop_manager_user_id as shopManagerUserId,
|
|
a.supervisor_user_id as supervisorUserId,
|
|
a.region_id as regionId,
|
|
b.username as username,
|
|
b.mobile as mobile,
|
|
b.investment_manager as investmentManager,
|
|
DATE_ADD(b.create_time, INTERVAL 50 DAY) as planOpenTime,
|
|
a.create_time as createTime
|
|
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
|
where a.deleted = 0
|
|
<if test="request.keyword != null and request.keyword != ''">
|
|
and (b.username like concat('%', #{request.keyword}, '%') or b.mobile like concat('%', #{request.keyword},
|
|
'%'))
|
|
</if>
|
|
<if test="request.shopName!=null and request.shopName!=''">
|
|
and a.shop_name like concat('%', #{request.shopName}, '%')
|
|
</if>
|
|
<if test="request.investmentUserId != null and request.investmentUserId != ''">
|
|
and b.investment_manager = #{request.investmentUserId}
|
|
</if>
|
|
<if test="request.supervisorUserId != null and request.supervisorUserId != ''">
|
|
and a.supervisor_user_id = #{request.supervisorUserId}
|
|
</if>
|
|
<if test="request.planOpenStartTime != null and request.planOpenStartTime != ''">
|
|
and DATE_ADD(b.create_time, INTERVAL 50 DAY) >= #{request.planOpenStartTime}
|
|
</if>
|
|
<if test="request.planOpenEndTime != null and request.planOpenEndTime != ''">
|
|
<![CDATA[and DATE_ADD(b.create_time, INTERVAL 50 DAY) <= #{request.planOpenEndTime}]]>
|
|
</if>
|
|
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
|
and a.region_id in
|
|
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
|
#{regionId}
|
|
</foreach>
|
|
</if>
|
|
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
|
and a.region_id in
|
|
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
|
#{regionId}
|
|
</foreach>
|
|
</if>
|
|
order by a.update_time desc
|
|
</select>
|
|
<select id="getRegionIdByid" resultType="java.lang.Long">
|
|
select r.parent_id
|
|
from xfsg_shop_info xsi
|
|
join region_${enterpriseId} r on r.id = xsi.region_id
|
|
where xsi.id = #{shopId}
|
|
</select>
|
|
<select id="selectByStoreNum" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from xfsg_shop_info
|
|
where store_num = #{storeNum}
|
|
</select>
|
|
<select id="selectShopListByRegionId" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select
|
|
xsi.id,xsi.line_id as lineId,xsi.region_id as regionId,xsi.shop_name as shopName,xsi.store_num as
|
|
storeNum,xsi.shop_code as shopCode
|
|
from xfsg_shop_info xsi
|
|
left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id
|
|
where
|
|
xsi.deleted = 0
|
|
<if test="regionIds != null and regionIds.size() > 0">
|
|
and xsi.region_id in
|
|
<foreach collection="regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
|
#{regionId}
|
|
</foreach>
|
|
</if>
|
|
AND xssi.shop_sub_stage_status != -100
|
|
and xssi.shop_sub_stage = #{shopSubStage}
|
|
<if test="subStageStatus != null and subStageStatus.size()>0">
|
|
and xssi.shop_sub_stage_status in
|
|
<foreach collection="subStageStatus" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="keyWord != null and keyWord != '' ">
|
|
and xsi.shop_name Like concat("%",#{keyWord},"%") or xsi.store_num Like concat("%",#{keyWord},"%")
|
|
</if>
|
|
</select>
|
|
<select id="platformBuildList" resultType="com.cool.store.response.PlatformBuildListResponse">
|
|
select
|
|
DISTINCT
|
|
xsi.id as shopId,
|
|
xsi.shop_name as shopName,
|
|
xsi.shop_code as shopCode,
|
|
xsi.region_id as regionId,
|
|
xli.id as lineId,
|
|
xli.mobile as mobile,
|
|
xli.username as partnerName
|
|
from xfsg_shop_info xsi
|
|
left join xfsg_line_info xli on xsi.line_id = xli.id
|
|
left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id
|
|
where
|
|
xsi.deleted = 0
|
|
and xssi.shop_stage = 3
|
|
and xssi.shop_sub_stage_status != -100
|
|
and
|
|
xsi.region_id in
|
|
<foreach collection="list" open="(" separator="," close=")" index="index" item="item">
|
|
#{item}
|
|
</foreach>
|
|
<if test="request.shopKeyword != null and request.shopKeyword != ''">
|
|
and (xsi.shop_name like concat("%",#{request.shopKeyword},"%") or xsi.shop_code like
|
|
concat("%",#{request.shopKeyword},"%"))
|
|
</if>
|
|
<if test="request.partnerKeyword != null and request.partnerKeyword != ''">
|
|
and (xli.mobile like concat("%",#{request.partnerKeyword},"%") or xli.username like
|
|
concat("%",#{request.partnerKeyword},"%"))
|
|
</if>
|
|
<if test="request.regionIds != null and request.regionIds.size()>0">
|
|
and xsi.region_id in
|
|
<foreach collection="request.regionIds" open="(" separator="," close=")" index="index" item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
order by xsi.create_time desc
|
|
</select>
|
|
|
|
<select id="selectByIdOrSelectAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from
|
|
xfsg_shop_info
|
|
<where>
|
|
<if test="shopId!=null">
|
|
and id = #{shopId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getShopAndStoreList" resultType="com.cool.store.dto.LicenseSyncDTO">
|
|
select
|
|
a.id as shopId,
|
|
a.shop_code as shopCode,
|
|
b.store_id as storeId
|
|
from
|
|
xfsg_shop_info a
|
|
left join store_${enterpriseId} b on a.shop_code = b.store_num
|
|
where b.store_id is not null and a.id in
|
|
<foreach collection="shopIds" item="shopId" separator="," open="(" close=")">
|
|
#{shopId}
|
|
</foreach>
|
|
</select>
|
|
<select id="ListByBranchShopRequest" resultType="com.cool.store.dto.Preparation.PreparationDTO">
|
|
select
|
|
a.id as id,
|
|
a.line_id as lineId,
|
|
a.shop_name as shopName,
|
|
a.want_shop_area_id as wantShopAreaId,
|
|
a.shop_code as shopCode,
|
|
a.store_num as storeNum,
|
|
a.shop_manager_user_id as shopManagerUserId,
|
|
a.supervisor_user_id as supervisorUserId,
|
|
a.region_id as regionId,
|
|
b.username as username,
|
|
b.mobile as mobile,
|
|
a.investment_manager as investmentManager,
|
|
DATE_ADD(a.create_time, INTERVAL 50 DAY) as planOpenTime,
|
|
a.create_time as createTime,
|
|
a.join_mode as joinMode,
|
|
a.franchise_brand as franchiseBrand,
|
|
a.shop_status as shopStatus
|
|
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
|
where a.deleted = 0
|
|
<if test="request.partnerKeyword != null and request.partnerKeyword != ''">
|
|
and (b.username like concat('%', #{request.partnerKeyword}, '%') or b.mobile like concat('%',
|
|
#{request.partnerKeyword}, '%'))
|
|
</if>
|
|
<if test="request.shopKeyword!=null and request.shopKeyword!=''">
|
|
and (a.shop_name like concat('%',#{request.shopKeyword}, '%') or a.shop_code like concat('%',
|
|
#{request.shopKeyword}, '%') )
|
|
</if>
|
|
<if test="request.regionIds != null and request.regionIds.size() > 0">
|
|
and a.region_id in
|
|
<foreach collection="request.regionIds" item="regionId" index="index" open="(" separator="," close=")">
|
|
#{regionId}
|
|
</foreach>
|
|
</if>
|
|
<if test="request.investmentManagerUserId != null and request.investmentManagerUserId != ''">
|
|
and a.investment_manager = #{request.investmentManagerUserId}
|
|
</if>
|
|
<if test="request.openTimeStart != null ">
|
|
and DATE_ADD(a.create_time, INTERVAL 50 DAY) >= #{request.openTimeStart}
|
|
</if>
|
|
<if test="request.openTimeEnd != null ">
|
|
<![CDATA[and DATE_ADD(a.create_time, INTERVAL 50 DAY) <= #{request.openTimeEnd}]]>
|
|
</if>
|
|
<if test="request.joinMode!=null and request.joinMode.size >0">
|
|
and a.join_mode in
|
|
<foreach collection="request.joinMode" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="request.franchiseBrand!=null and request.franchiseBrand.size>0">
|
|
and
|
|
<foreach collection="request.franchiseBrand" item="item" index="index" open="(" separator="or" close=")">
|
|
FIND_IN_SET(#{item}, a.franchise_brand)>0
|
|
</foreach>
|
|
</if>
|
|
<if test="request.shopStatus!=null and request.shopStatus.size>0">
|
|
and a.shop_status in
|
|
<foreach collection="request.shopStatus" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="request.wantShopAreaAllIds != null and request.wantShopAreaAllIds.size() > 0">
|
|
and a.want_shop_area_id in
|
|
<foreach collection="request.wantShopAreaAllIds" item="wantShopAreaId" index="index" open="(" separator=","
|
|
close=")">
|
|
#{wantShopAreaId}
|
|
</foreach>
|
|
</if>
|
|
<if test="request.flag == 1">
|
|
and a.investment_manager = #{userId}
|
|
</if>
|
|
<if test="request.authRegionIds != null and request.authRegionIds.size() > 0">
|
|
and a.region_id in
|
|
<foreach collection="request.authRegionIds" item="regionId" index="index" open="(" separator="," close=")">
|
|
#{regionId}
|
|
</foreach>
|
|
</if>
|
|
order by a.update_time desc
|
|
</select>
|
|
<select id="getShopListByRegion" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from xfsg_shop_info where line_id = #{lineId} and deleted= '0'
|
|
<if test="userId==null">
|
|
and shop_status in(0,1)
|
|
</if>
|
|
<if test="userId!=null and userId!=''">
|
|
and( investment_manager = #{userId}
|
|
<if test="list!=null and list.size>0">
|
|
or region_id in
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test=" list.size==0">
|
|
or 1=1
|
|
</if>
|
|
)
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
<select id="getShopPointListByDevelopmentManager" resultType="com.cool.store.dto.point.ShopPointDTO">
|
|
select
|
|
a.id as shopId,
|
|
a.point_id as pointId,
|
|
a.shop_name as shopName,
|
|
a.want_shop_area_id as wantShopAreaId,
|
|
b.user_portrait as userPortrait,
|
|
b.id as lineId,
|
|
b.username as userName,
|
|
b.mobile as mobile,
|
|
b.investment_manager as investmentManager
|
|
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
|
where a.deleted = 0 and a.development_manager = #{request.developmentManager} and shop_status in (0, 1) and
|
|
point_id is null
|
|
<if test="request.keyword != null and request.keyword!=''">
|
|
and (b.username like concat('%', #{request.keyword}, '%') or b.mobile like concat('%', #{request.keyword},
|
|
'%'))
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="selectAllDataOrByLineId" resultMap="BaseResultMap">
|
|
select * from xfsg_shop_info
|
|
<where>
|
|
<if test="lineId!=null">
|
|
and line_id = #{lineId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="selectByLines" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select *
|
|
from xfsg_shop_info
|
|
where line_id in
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<foreach collection="regionIds" item="item" index="index" open="and region_id in (" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
<select id="getShopIdByShopStatus" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select id ,partner_id as partnerId
|
|
from xfsg_shop_info
|
|
where shop_status = #{shopStatus}
|
|
</select>
|
|
<select id="getShopListAndStatusIsOverByLineId" resultType="com.cool.store.response.MiniShopsResponse">
|
|
select id, shop_name as shopName
|
|
from xfsg_shop_info
|
|
where line_id = #{lineId} and shop_status = 1
|
|
</select>
|
|
|
|
<update id="batchUpdate" parameterType="list">
|
|
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
|
UPDATE xfsg_shop_info
|
|
SET
|
|
development_manager = #{item.developmentManager},
|
|
join_mode = #{item.joinMode},
|
|
shop_status = #{item.shopStatus},
|
|
franchise_brand = #{item.franchiseBrand},
|
|
investment_manager = #{item.investmentManager},
|
|
want_shop_area_id = #{item.wantShopAreaId}
|
|
WHERE id = #{item.id}
|
|
</foreach>
|
|
</update>
|
|
</mapper> |