Files
zxjp-web/coolstore-partner-dao/src/main/resources/mapper/ApplyLicenseMapper.xml
shuo.wang f1b256205e fix
2025-05-21 19:36:44 +08:00

135 lines
4.4 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.ApplyLicenseMapper">
<sql id="baseColumn">
id,
shop_id,
business_license,
license_type,
license_legal_person,
license_legal_id_card_no,
license_legal_id_card_front,
license_legal_id_card_back,
license_legal_mobile,
credit_code,
credit_url,
license_address,
issueTime,
validity,
id_card_positive_credit_url,
id_card_negative_credit_url,
food_business_license_code,
main_business,
operator,
food_license_legal_person,
business_project,
food_license_address,
food_business_start_time,
food_business_end_time,
food_business_license_url,
food_license_remark,
business_license_remark,
remark_url,
submit_status,
create_time,
update_time,
deleted,
two_certificates_one,
legal_is_same_partner,
single_shop,
commitment_url,
food_shop_list_url
</sql>
<update id="updateByShopId">
update xfsg_license_transact
set submit_status = #{entity.submitStatus}
where shop_id = #{entity.shopId}
</update>
<select id="licenseList" resultType="com.cool.store.response.LicenseListResponse">
select
o.shop_id as shopId,
s.shop_name as storeName,
s.store_num as storeNum,
s.shop_manager_user_id as shopManagerUserId,
l.username as franchiseeName,
l.mobile as franchiseeMobile,
l.region_id AS fightRegionId,
l.investment_manager AS investmentManager,
s.supervisor_user_id AS supervisorUserId,
o.create_time as submitTime,
o.submit_status as status
FROM
xfsg_license_transact o
LEFT JOIN xfsg_shop_info s ON o.shop_id = s.id
LEFT JOIN xfsg_line_info l ON l.id = s.line_id
<where>
o.deleted = 0
<if test="userId != null and userId != ''">
and l.investment_manager = #{userId}
</if>
<if test="fightRegions != null">
and l.region_id in
<foreach item="regionId" collection="fightRegions" open="(" separator="," close=")">
#{regionId}
</foreach>
</if>
<if test="request.storeName != null and request.storeName != ''">
AND s.shop_name like concat('%',#{request.storeName},'%')
</if>
<if test="request.submitStartTime != null and request.submitEndTime">
AND
o.create_time BETWEEN
FROM_UNIXTIME(#{request.submitStartTime} / 1000)
AND FROM_UNIXTIME(#{request.submitEndTime} / 1000)
</if>
<if test="request.regionId != null and request.regionId != ''">
AND l.region_id = #{request.regionId}
</if>
<if test="request.status != null">
AND o.submit_status = #{request.status}
</if>
</where>
</select>
<select id="selectByShopId" resultType="com.cool.store.entity.LicenseTransactDO">
select <include refid="baseColumn"/>
from xfsg_license_transact
where shop_id = #{shopId}
and deleted = 0
</select>
<select id="queryNotSyncList" resultType="com.cool.store.entity.LicenseTransactDO">
select <include refid="baseColumn"/>
from xfsg_license_transact
where sync_flag = 0
and deleted = 0
</select>
<select id="getByShopIds" resultType="com.cool.store.entity.LicenseTransactDO">
select <include refid="baseColumn"/>
from xfsg_license_transact
where deleted = 0
<if test="list != null and list.size > 0">
<foreach item="item" collection="list" open="and shop_id in (" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<update id="updateSyncFlagByIds">
update xfsg_license_transact
set sync_flag = 1
where deleted = 0
<if test="ids != null and ids.size > 0">
<foreach item="item" collection="ids" open="and id in (" separator="," close=")">
#{item}
</foreach>
</if>
</update>
</mapper>