企业开通相关逻辑整理

This commit is contained in:
zhangchenbiao
2023-05-30 10:53:05 +08:00
parent c95a79a114
commit 145e278d3d
56 changed files with 2019 additions and 35 deletions

View File

@@ -202,4 +202,142 @@
</set>
where id = #{record.id}
</update>
<select id="selectRegionIdsBySynDingDeptIds" resultType="java.lang.Long">
select
id
from region_${eid}
where
deleted = 0 and syn_ding_dept_id in
<foreach collection="synDingDeptIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="getRegionByRegionIds" resultMap="BaseResultMap">
select
id ,
id as regionId,
name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
syn_ding_dept_id as synDingDeptId,
update_time as updateTime,
update_name as updateName,
region_path as regionPath,
store_num as storeNum,
store_id as storeId,
region_type as regionType
from region_${eid} where id in
<foreach collection="regionIds" index="index" item="regionId"
separator="," open="(" close=")">
#{regionId, jdbcType=BIGINT}
</foreach>
and deleted = 0
</select>
<select id="getUnclassifiedRegionDO" resultMap="BaseResultMap">
select
id ,
id as regionId,
name as name ,
parent_id as parentId,
group_id as groupId,
create_time as createTime,
create_name as createName,
update_time as updateTime,
update_name as updateName,
vds_group_corp_id as vdsGroupCorpId,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted,
region_path as regionPath,
store_num as storeNum,
unclassified_flag as unclassifiedFlag
from region_${enterpriseId}
where deleted = 0 and unclassified_flag = 1
and (name = #{name} or id = 1) limit 1
</select>
<insert id="insertRoot">
insert ignore into region_${eid}
(
id,
region_id,
name,
parent_id,
group_id,
create_time,
syn_ding_dept_id,
create_name,
region_type,
region_path,
store_num,
unclassified_flag)
values
(
#{region.id, jdbcType=BIGINT},
#{region.regionId, jdbcType=VARCHAR},
#{region.name, jdbcType=VARCHAR},
#{region.parentId, jdbcType=VARCHAR},
#{region.groupId, jdbcType=VARCHAR},
#{region.createTime, jdbcType=BIGINT},
#{region.synDingDeptId, jdbcType=VARCHAR},
#{region.createName, jdbcType=VARCHAR},
#{region.regionType, jdbcType=VARCHAR},
#{region.regionPath},
#{region.storeNum},
#{region.unclassifiedFlag}
)
</insert>
<insert id="batchInsertRegionsByDepartments">
insert into region_${eid}
(
id,
name,
parent_id,
group_id,
create_time,
syn_ding_dept_id,
region_path,
region_type,
order_num,
create_name,
store_id
)
values
<foreach collection="regions" item="region" separator=",">
(
#{region.id},
#{region.name},
#{region.parentId},
#{region.groupId},
#{region.createTime},
#{region.synDingDeptId},
#{region.regionPath},
#{region.regionType},
#{region.orderNum},
#{region.createName},
#{region.storeId}
)
</foreach>
ON DUPLICATE KEY UPDATE
name=values(name), parent_id=values(parent_id), region_path=values(region_path),region_type=values(region_type),order_num=values(order_num)
</insert>
<select id="selectRegionBySynDingDeptIds" resultMap="BaseResultMap">
select
id,
syn_ding_dept_id
from region_${eid}
where deleted = 0 and syn_ding_dept_id in (
<foreach collection="synDingDeptIds" item="item" separator=",">
#{item}
</foreach>
)
</select>
</mapper>