update
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
store_num, store_id, unclassified_flag, order_num, third_dept_id
|
||||
</sql>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into region_${enterpriseId}
|
||||
insert into region
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.regionId != null">
|
||||
region_id,
|
||||
@@ -143,7 +143,7 @@
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective">
|
||||
update region_${enterpriseId}
|
||||
update region
|
||||
<set>
|
||||
<if test="record.regionId != null">
|
||||
region_id = #{record.regionId},
|
||||
@@ -207,7 +207,7 @@
|
||||
<select id="selectRegionIdsBySynDingDeptIds" resultType="java.lang.Long">
|
||||
select
|
||||
id
|
||||
from region_${eid}
|
||||
from region
|
||||
where
|
||||
deleted = 0 and syn_ding_dept_id in
|
||||
<foreach collection="synDingDeptIds" item="item" separator="," open="(" close=")">
|
||||
@@ -231,7 +231,7 @@
|
||||
store_num as storeNum,
|
||||
store_id as storeId,
|
||||
region_type as regionType
|
||||
from region_${eid} where id in
|
||||
from region where id in
|
||||
<foreach collection="regionIds" index="index" item="regionId"
|
||||
separator="," open="(" close=")">
|
||||
#{regionId, jdbcType=BIGINT}
|
||||
@@ -257,13 +257,13 @@
|
||||
region_path as regionPath,
|
||||
store_num as storeNum,
|
||||
unclassified_flag as unclassifiedFlag
|
||||
from region_${enterpriseId}
|
||||
from region
|
||||
where deleted = 0 and unclassified_flag = 1
|
||||
and (name = #{name} or id = 1) limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertRoot">
|
||||
insert ignore into region_${eid}
|
||||
insert ignore into region
|
||||
(
|
||||
id,
|
||||
region_id,
|
||||
@@ -295,7 +295,7 @@
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsertRegionsByDepartments">
|
||||
insert into region_${eid}
|
||||
insert into region
|
||||
(
|
||||
id,
|
||||
name,
|
||||
@@ -333,7 +333,7 @@
|
||||
select
|
||||
id,
|
||||
syn_ding_dept_id
|
||||
from region_${eid}
|
||||
from region
|
||||
where deleted = 0 and syn_ding_dept_id in (
|
||||
<foreach collection="synDingDeptIds" item="item" separator=",">
|
||||
#{item}
|
||||
@@ -357,7 +357,7 @@
|
||||
region_path as regionPath,
|
||||
deleted as deleted,
|
||||
third_dept_id as thirdDeptId
|
||||
from region_${eid}
|
||||
from region
|
||||
where deleted = 0 and id > 0
|
||||
and region_type != 'store'
|
||||
</select>
|
||||
@@ -378,7 +378,7 @@
|
||||
deleted as deleted,
|
||||
region_path as regionPath,
|
||||
store_id as storeId
|
||||
from region_${eid}
|
||||
from region
|
||||
where region_type = 'store'
|
||||
and id in (
|
||||
<foreach collection="regionIds" item="item" separator=",">
|
||||
@@ -404,7 +404,7 @@
|
||||
region_path as regionPath,
|
||||
deleted,
|
||||
store_num as storeNum
|
||||
from region_${eid}
|
||||
from region
|
||||
where id = #{regionId}
|
||||
</select>
|
||||
|
||||
@@ -423,11 +423,11 @@
|
||||
region_type as regionType,
|
||||
region_path as regionPath,
|
||||
store_num as storeCount
|
||||
from region_${eid} where id = #{regionId, jdbcType=BIGINT} and deleted = 0
|
||||
from region where id = #{regionId, jdbcType=BIGINT} and deleted = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="record.id">
|
||||
insert into region_${eid}
|
||||
insert into region
|
||||
(
|
||||
id,
|
||||
name,
|
||||
@@ -460,7 +460,7 @@
|
||||
select
|
||||
id ,
|
||||
syn_ding_dept_id as synDingDeptId
|
||||
from region_${eid}
|
||||
from region
|
||||
where (id > 0 or id = -3) and (deleted = 0 or syn_ding_dept_id is not null)
|
||||
<if test="parentId!=null">
|
||||
and region_path like concat('%/',#{parentId},'/%')
|
||||
@@ -481,7 +481,7 @@
|
||||
syn_ding_dept_id as synDingDeptId,
|
||||
region_type as regionType,
|
||||
deleted as deleted
|
||||
from region_${eid}
|
||||
from region
|
||||
where deleted = 0
|
||||
and syn_ding_dept_id in (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
@@ -507,12 +507,12 @@
|
||||
region_path as regionPath,
|
||||
deleted,
|
||||
store_num as storeNum
|
||||
from region_${eid}
|
||||
from region
|
||||
where syn_ding_dept_id = #{synDingDeptId}
|
||||
</select>
|
||||
|
||||
<insert id="ignoreInsert" keyColumn="id" keyProperty="region.id" useGeneratedKeys="true">
|
||||
insert ignore into region_${eid}
|
||||
insert ignore into region
|
||||
(
|
||||
region_id,
|
||||
name,
|
||||
@@ -554,12 +554,12 @@
|
||||
<if test="region.synDingDeptId !=null and region.synDingDeptId!=''">
|
||||
,#{region.synDingDeptId}
|
||||
</if>
|
||||
,(SELECT max(order_num)+1 FROM region_${eid} AS num)
|
||||
,(SELECT max(order_num)+1 FROM region AS num)
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateSyncRegion" >
|
||||
update region_${eid}
|
||||
update region
|
||||
set `parent_id` = #{item.parentId},
|
||||
`name` = #{item.name},
|
||||
<if test="item.regionType != null and item.regionType != ''">
|
||||
@@ -575,7 +575,7 @@
|
||||
</update>
|
||||
|
||||
<update id="removeRegions">
|
||||
update region_${eid}
|
||||
update region
|
||||
set
|
||||
deleted = 1,
|
||||
parent_id = -1
|
||||
|
||||
Reference in New Issue
Block a user