614 lines
27 KiB
XML
614 lines
27 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"/>
|
|
<result column="store_type" jdbcType="TINYINT" property="storeType"/>
|
|
<result column="province" jdbcType="VARCHAR" property="province"/>
|
|
<result column="province_code" jdbcType="INTEGER" property="provinceCode"/>
|
|
<result column="city" jdbcType="VARCHAR" property="city"/>
|
|
<result column="city_code" jdbcType="INTEGER" property="cityCode"/>
|
|
<result column="district" jdbcType="VARCHAR" property="district"/>
|
|
<result column="district_code" jdbcType="INTEGER" property="districtCode"/>
|
|
<result column="manager_region_id" jdbcType="BIGINT" property="managerRegionId"/>
|
|
<result column="shop_decoration_attributes" jdbcType="INTEGER" property="shopDecorationAttributes"/>
|
|
<result column="hqt_shop_id" jdbcType="VARCHAR" property="hqtShopId"/>
|
|
<result column="store_id" jdbcType="VARCHAR" property="storeId"/>
|
|
</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,store_type
|
|
, province,province_code,city,city_code,district,district_code,manager_region_id,shop_decoration_attributes,hqt_shop_id,store_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,store_id) 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},#{shop.storeId})
|
|
</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="selectByStoreCode" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select
|
|
<include refid="allColumn"/>
|
|
from xfsg_shop_info
|
|
where shop_code = #{storeCode}
|
|
</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>
|
|
order by xsi.update_time desc
|
|
</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
|
|
<if test="list !=null and list.size >0">
|
|
and
|
|
xsi.region_id in
|
|
<foreach collection="list" open="(" separator="," close=")" index="index" item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<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 a.shop_code is not null
|
|
and a.shop_code !=''
|
|
and b.store_id is not null
|
|
and b.is_delete = 'effective'
|
|
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.point_id as pointId,
|
|
a.store_type as storeType,
|
|
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,
|
|
a.detail_address as shopAddress,
|
|
a.manager_region_id as managerRegionId,
|
|
a.store_id as storeId
|
|
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
|
|
<if test="request.contractStartTime !=null and request.contractEndTime != null">
|
|
left join xfsg_sign_franchise c on a.id = c.shop_id
|
|
</if>
|
|
where a.deleted = 0
|
|
<if test="request.contractStartTime !=null and request.contractEndTime !=null">
|
|
and c.create_time between #{request.contractStartTime} and #{request.contractEndTime}
|
|
</if>
|
|
<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>
|
|
<if test="regionIds!=null and regionIds.size >0">
|
|
<foreach collection="regionIds" item="item" index="index" open="and region_id in (" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
<select id="getShopIdBySuccessOpen" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select a.id as id, a.partner_id as partnerId
|
|
from xfsg_shop_info a
|
|
inner join store_${eid} b on a.shop_code = b.store_num
|
|
|
|
</select>
|
|
<select id="getShopListSuccessOpen" resultType="com.cool.store.response.MiniShopsResponse">
|
|
select a.shop_name as shopName,
|
|
a.id as shopId,
|
|
a.shop_code as shopCode,
|
|
a.detail_address as detailAddress
|
|
from xfsg_shop_info a
|
|
inner join store_${eid} c on a.shop_code = c.store_num
|
|
where a.line_id = #{lineId} and c.is_delete = 'effective' and a.deleted = 0 and a.shop_status != 2
|
|
</select>
|
|
<select id="getOpenName" resultType="java.lang.String">
|
|
select b.store_name
|
|
from xfsg_shop_info a
|
|
inner join store_${eid} b on a.shop_code = b.store_num
|
|
where a.id = #{shopId}
|
|
</select>
|
|
<select id="getShopCodeList" resultType="java.lang.String">
|
|
select shop_code
|
|
from xfsg_shop_info
|
|
where deleted = 0 and line_id = #{lineId} and shop_code is not null
|
|
</select>
|
|
<select id="currentShopWhetherOpen" resultType="com.cool.store.response.MiniShopsResponse">
|
|
select a.shop_name as shopName,
|
|
a.shop_code as shopCode
|
|
from xfsg_shop_info a
|
|
inner join store_${eid} b on a.shop_code = b.store_num
|
|
where a.id = #{shopId}
|
|
</select>
|
|
|
|
<select id="getShopIdList" resultType="java.lang.Long">
|
|
select id
|
|
from xfsg_shop_info
|
|
where deleted = 0 and line_id = #{lineId} and shop_code is not null
|
|
</select>
|
|
<select id="getListByTime" resultType="com.cool.store.entity.ShopInfoDO">
|
|
select a.id as id ,
|
|
a.create_time,
|
|
a.partner_id as partnerId,
|
|
a.line_id as lineId
|
|
from xfsg_shop_info a
|
|
LEFT JOIN xfsg_partner_user_info b ON a.partner_id = b.partner_id
|
|
where
|
|
a.create_time >= '2025-04-19 00:00:00'
|
|
and b.downstream_system_salting is null;
|
|
</select>
|
|
<select id="getShopFranchiseReportList" resultType="com.cool.store.dto.FranchiseReportDTO">
|
|
select
|
|
|
|
a.id as shopId,
|
|
a.region_id as regionId,
|
|
a.store_type as storeType,
|
|
a.shop_code as shopCode,
|
|
a.investment_manager as investmentManager,
|
|
a.shop_name as shopName,
|
|
a.join_mode as joinMode,
|
|
a.franchise_brand as franchiseBrand,
|
|
b.actual_complete_time as actualCompleteTime
|
|
from xfsg_shop_info a
|
|
left join xfsg_shop_stage_info b on a.id = b.shop_id
|
|
where
|
|
a.deleted = 0 and a.shop_status != 2 and a.franchise_brand = 1
|
|
and b.shop_sub_stage = 150 and b.is_terminated = 1
|
|
<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.storeTypes !=null and request.storeTypes.size >0">
|
|
and a.store_type in
|
|
<foreach collection="request.storeTypes" item="storeType" index="index" open="(" separator="," close=")">
|
|
#{storeType}
|
|
</foreach>
|
|
</if>
|
|
and b.actual_complete_time >= #{request.buildStartTime} and b.actual_complete_time <= #{request.buildEndTime}
|
|
order by b.actual_complete_time desc
|
|
</select>
|
|
<select id="selectShopListByUser" 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
|
|
AND xssi.shop_sub_stage_status != -100
|
|
and xssi.shop_sub_stage = #{shopSubStage}
|
|
<if test="userId!=null and userId!= ''">
|
|
and xsi.investment_manager = #{userId}
|
|
</if>
|
|
|
|
<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="selectIsCreateStore" resultType="com.cool.store.dto.IsCreateStoreDTO">
|
|
|
|
SELECT a.shop_name as shopName,a.id as shopId, c.id as `pid`,c.name as pidName
|
|
FROM xfsg_shop_info a
|
|
LEFT JOIN store_${enterpriseId} b ON a.shop_code = b.store_num
|
|
LEFT JOIN region_${enterpriseId} c on b.region_id = c.`id`
|
|
WHERE b.store_num is not null
|
|
and a.shop_code is not null
|
|
and a.deleted =0
|
|
and a.shop_status != 2
|
|
and a.shop_code != ""
|
|
and c.deleted = 0
|
|
and b.is_delete = 'effective'
|
|
and a.region_id != 459
|
|
</select>
|
|
<select id="getNumByShopCode" resultType="java.lang.Integer">
|
|
select count(1) from xfsg_shop_info where shop_code = #{shopCode} and deleted = 0 and shop_status != 2
|
|
</select>
|
|
<select id="getPushHqtShopList" resultType="com.cool.store.entity.ShopInfoDO">
|
|
SELECT * FROM xfsg_shop_info a
|
|
LEFT JOIN xfsg_shop_stage_info AS t0 ON a.id = t0.shop_id
|
|
WHERE t0.shop_sub_stage_status = 891 and a.deleted = 0 and a.shop_status != 2 and
|
|
a.id in
|
|
(SELECT a.`shop_id`
|
|
FROM xfsg_shop_stage_info a
|
|
LEFT JOIN `xfsg_decoration_measure` b on a.`shop_id` = b.`shop_id`
|
|
WHERE a.shop_sub_stage_status = 840 and b.`id` is null)
|
|
;
|
|
</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>
|
|
<update id="updateShopCode">
|
|
update xfsg_shop_info set shop_code = #{shopCode} where id = #{shopId}
|
|
</update>
|
|
<update id="updateShopCity">
|
|
<foreach collection="list" item="item" index="index" separator=";">
|
|
update xfsg_shop_info set shop_name = #{item.shopName}, province =#{item.province}, city = #{item.city}, district=#{item.district}, detail_address = #{item.detailAddress} where id = #{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="updateManagerRegionId">
|
|
<foreach collection="list" item="item" separator=";">
|
|
update xfsg_shop_info set manager_region_id = #{item.managerRegionId} where id = #{item.id}
|
|
</foreach>
|
|
</update>
|
|
<update id="updateHqtShopId">
|
|
update xfsg_shop_info set hqt_shop_id = #{hqtShopId} where id = #{shopId}
|
|
</update>
|
|
</mapper> |