企业同步

This commit is contained in:
zhangchenbiao
2023-06-05 11:34:44 +08:00
parent 09f651ed0d
commit 0576ed223a
77 changed files with 3365 additions and 149 deletions

View File

@@ -44,7 +44,7 @@
<select id="getDistinctDbServer" resultMap="BaseResultMap">
select
distinct db_server, db_port, db_user, db_pwd
distinct db_server, db_port, db_user, db_pwd, db_name
from
enterprise_config
</select>

View File

@@ -0,0 +1,118 @@
<?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.EnterpriseUserDepartmentMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserDepartmentDO">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="department_id" jdbcType="VARCHAR" property="departmentId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="is_has_auth" jdbcType="BIT" property="isHasAuth"/>
</resultMap>
<sql id="Base_Column_List">
id, user_id, department_id, create_time, update_time, is_has_auth
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into enterprise_user_department_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
user_id,
</if>
<if test="record.departmentId != null">
department_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.isHasAuth != null">
is_has_auth,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
#{record.userId},
</if>
<if test="record.departmentId != null">
#{record.departmentId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.isHasAuth != null">
#{record.isHasAuth},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update enterprise_user_department_${enterpriseId}
<set>
<if test="record.userId != null">
user_id = #{record.userId},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.isHasAuth != null">
is_has_auth = #{record.isHasAuth},
</if>
</set>
where id = #{record.id}
</update>
<select id="getIdsByUserId" resultType="java.lang.Integer">
select id from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 0
</select>
<delete id="deleteByIdList">
delete from enterprise_user_department_${eid} where
<if test="list != null and list.size() > 0 ">
id in
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</delete>
<select id="selectUserDeptByUserId"
resultType="com.cool.store.entity.EnterpriseUserDepartmentDO">
select
id,
user_id as userId,
department_id as departmentId,
create_time as createTime,
update_time as updateTime
from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 0
</select>
<insert id="batchInsert">
insert into enterprise_user_department_${eid}
(user_id, department_id, create_time, is_has_auth)
values
<foreach collection="deptUsers" item="deptUser" separator=",">
(#{deptUser.userId}, #{deptUser.departmentId}, now(), #{deptUser.isHasAuth})
</foreach>
</insert>
<select id="selectUserDeptAuthByUserId"
resultType="com.cool.store.entity.EnterpriseUserDepartmentDO">
select
id,
user_id as userId,
department_id as departmentId,
create_time as createTime,
update_time as updateTime
from enterprise_user_department_${eid} where user_id = #{userId} and is_has_auth = 1
</select>
</mapper>

View File

@@ -670,4 +670,219 @@
order by id
</select>
<update id="updateEnterpriseUser">
update enterprise_user_${eid}
<set>
<if test="enterpriseUserDO.name != null and enterpriseUserDO.name !=''">`name` = #{enterpriseUserDO.name},</if>
<if test="enterpriseUserDO.tel != null and enterpriseUserDO.tel !=''">`tel` = #{enterpriseUserDO.tel},</if>
<if test="enterpriseUserDO.workPlace != null and enterpriseUserDO.workPlace !=''">`work_place` =
#{enterpriseUserDO.workPlace},
</if>
<if test="enterpriseUserDO.mobile != null and enterpriseUserDO.mobile !=''">`mobile` =
#{enterpriseUserDO.mobile},
</if>
<if test="enterpriseUserDO.email != null and enterpriseUserDO.email !=''">`email` = #{enterpriseUserDO.email},
</if>
<if test="enterpriseUserDO.orgEmail != null and enterpriseUserDO.orgEmail !=''">`org_email` =
#{enterpriseUserDO.orgEmail},
</if>
<if test="enterpriseUserDO.active != null">`active` =
#{enterpriseUserDO.active},
</if>
<if test="enterpriseUserDO.orderInDepts != null and enterpriseUserDO.orderInDepts !=''">`order_in_depts` =
#{enterpriseUserDO.orderInDepts},
</if>
<if test="enterpriseUserDO.mainAdmin != null">`main_admin` = #{enterpriseUserDO.mainAdmin},</if>
<if test="enterpriseUserDO.isAdmin != null">`is_admin` = #{enterpriseUserDO.isAdmin},</if>
<if test="enterpriseUserDO.isBoss != null">`is_boss` = #{enterpriseUserDO.isBoss},</if>
<if test="enterpriseUserDO.dingid != null and enterpriseUserDO.dingid !=''">`dingId` =
#{enterpriseUserDO.dingid},
</if>
<if test="enterpriseUserDO.unionid != null and enterpriseUserDO.unionid !=''">`unionid` =
#{enterpriseUserDO.unionid},
</if>
<if test="enterpriseUserDO.isLeaderInDepts != null and enterpriseUserDO.isLeaderInDepts !=''">
`is_leader_in_depts` = #{enterpriseUserDO.isLeaderInDepts},
</if>
<if test="enterpriseUserDO.isHide != null">`is_hide` = #{enterpriseUserDO.isHide},</if>
<if test="enterpriseUserDO.position != null and enterpriseUserDO.position !=''">`position` =
#{enterpriseUserDO.position},
</if>
<if test="enterpriseUserDO.avatar != null and enterpriseUserDO.avatar !=''">`avatar` =
#{enterpriseUserDO.avatar},
</if>
<if test="enterpriseUserDO.jobnumber != null and enterpriseUserDO.jobnumber !=''">`jobnumber` =
#{enterpriseUserDO.jobnumber},
</if>
<if test="enterpriseUserDO.extattr != null and enterpriseUserDO.extattr !=''">`extattr` =
#{enterpriseUserDO.extattr},
</if>
<if test="enterpriseUserDO.isEnterprise != null">`is_enterprise` =
#{enterpriseUserDO.isEnterprise},
</if>
<if test="enterpriseUserDO.roles != null and enterpriseUserDO.roles !=''">`roles` = #{enterpriseUserDO.roles},
</if>
<if test="enterpriseUserDO.monitoredDepartments != null and enterpriseUserDO.monitoredDepartments !=''">`
monitored_departments` = #{enterpriseUserDO.monitoredDepartments},
</if>
<if test="enterpriseUserDO.departments != null and enterpriseUserDO.departments !=''">`departments` =
#{enterpriseUserDO.departments},
</if>
<if test="enterpriseUserDO.isLeader != null">`is_leader` = #{enterpriseUserDO.isLeader},</if>
<if test="enterpriseUserDO.faceUrl != null and enterpriseUserDO.faceUrl !=''">`face_url` =
#{enterpriseUserDO.faceUrl},
</if>
<if test="enterpriseUserDO.createTime != null">`create_time` = #{enterpriseUserDO.createTime},</if>
<if test="enterpriseUserDO.language != null and enterpriseUserDO.language !=''">`language` =
#{enterpriseUserDO.language},
</if>
<if test="enterpriseUserDO.userStatus != null">`user_status` =
#{enterpriseUserDO.userStatus},
</if>
<if test="enterpriseUserDO.thirdOaUniqueFlag != null and enterpriseUserDO.thirdOaUniqueFlag !=''">`third_oa_unique_flag` =
#{enterpriseUserDO.thirdOaUniqueFlag},
</if>
<if test="enterpriseUserDO.userRegionIds != null and enterpriseUserDO.userRegionIds !=''">
`user_region_ids` = #{enterpriseUserDO.userRegionIds},
</if>
<if test="enterpriseUserDO.subordinateChange != null and enterpriseUserDO.subordinateChange !=''">
`subordinate_change` = #{enterpriseUserDO.subordinateChange},
</if>
<if test="enterpriseUserDO.subordinateRange != null and enterpriseUserDO.subordinateRange !=''">
`subordinate_range` = #{enterpriseUserDO.subordinateRange},
</if>
<if test="enterpriseUserDO.remark != null and enterpriseUserDO.remark !=''">
`remark` = #{enterpriseUserDO.remark},
</if>
</set>
where user_id =#{enterpriseUserDO.userId}
</update>
<select id="getMainAdminUserIds" resultType="string">
select user_id from enterprise_user_${eid} where main_admin = true and active = true
</select>
<select id="selectSpecifyNodeUserIds" resultType="string">
select
user_id
from
enterprise_user_${eid}
where
departments like concat('%/',#{dingDeptId},'/%')
</select>
<select id="selectAllUserIds" resultType="java.lang.String">
select user_id as userId from enterprise_user_${eid}
</select>
<select id="selectByUserIdIgnoreActive" resultType="com.cool.store.entity.EnterpriseUserDO">
select
id as id,
user_id as userId,
`name` as name,
tel as tel,
work_place as workPlace,
remark as remark,
mobile as mobile,
email as email,
org_email as orgEmail,
active as active,
order_in_depts as orderInDepts,
is_admin as isAdmin,
is_boss as isBoss,
dingId as dingId,
unionid as unionid,
is_leader_in_depts as isLeaderInDepts,
is_hide as isHide,
`position` as position,
avatar as avatar,
face_url as faceUrl,
jobnumber as jobnumber,
extattr as extattr,
is_enterprise as isEnterprise,
roles as roles,
monitored_departments as monitoredDepartments,
departments as departments,
is_leader as isLeader,
create_time as createTime,
`language` as language,
third_oa_unique_flag as thirdOaUniqueFlag,
subordinate_change as subordinateChange,
subordinate_range as subordinateRange
from enterprise_user_${enterpriseId} where user_id = #{userId, jdbcType=VARCHAR}
</select>
<insert id="insertEnterpriseUser">
insert into enterprise_user_${eid}
( `id`,
`user_id`,
`name`,
`tel`,
`work_place`,
`remark`,
`mobile`,
`email`,
`org_email`,
`active`,
`order_in_depts`,
`main_admin`,
`is_admin`,
`is_boss`,
`dingId`,
`unionid`,
`is_leader_in_depts`,
`is_hide`,
`position`,
`avatar`,
`jobnumber`,
`extattr`,
`is_enterprise`,
`roles`,
`monitored_departments`,
`departments`,
`is_leader`,
`face_url`,
`create_time`,
`user_status`,
`third_oa_unique_flag`,
`subordinate_range`
)
values
(
#{entity.id},
#{entity.userId},
#{entity.name},
#{entity.tel},
#{entity.workPlace},
#{entity.remark},
#{entity.mobile},
#{entity.email},
#{entity.orgEmail},
#{entity.active},
#{entity.orderInDepts},
#{entity.mainAdmin},
#{entity.isAdmin},
#{entity.isBoss},
#{entity.dingid},
#{entity.unionid},
#{entity.isLeaderInDepts},
#{entity.isHide},
#{entity.position},
#{entity.avatar},
#{entity.jobnumber},
#{entity.extattr},
#{entity.isEnterprise},
#{entity.roles},
#{entity.monitoredDepartments},
#{entity.departments},
#{entity.isLeader},
#{entity.faceUrl},
now(),
#{entity.userStatus},
#{entity.thirdOaUniqueFlag},
#{entity.subordinateRange}
)
</insert>
</mapper>

View File

@@ -100,4 +100,37 @@
left join sys_role_${eip} c on c.id = b.role_id
where b.user_id = #{userId}
</select>
<delete id="deleteBatchByPrimaryKey">
delete from enterprise_user_role_${eid} where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectIdsByUserId" resultType="java.lang.Long">
select id from enterprise_user_role_${eid} where user_id = #{userId}
</select>
<select id="selectByUserIdAndRoleId" resultMap="BaseResultMap">
select * from enterprise_user_role_${eid}
where user_id = #{userId} and role_id = #{roleId}
order by id asc
limit 1
</select>
<insert id="save">
insert ignore into enterprise_user_role_${eid}
(
`role_id`,
`user_id`,
`create_time`
)
values
(
#{entity.roleId},
#{entity.userId},
#{entity.createTime}
)
</insert>
</mapper>

View File

@@ -376,6 +376,7 @@
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted,
region_path as regionPath,
store_id as storeId
from region_${eid}
where region_type = 'store'
@@ -385,4 +386,204 @@
</foreach>
)
</select>
<select id="getByRegionId" resultType="com.cool.store.entity.RegionDO">
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,
syn_ding_dept_id as synDingDeptId,
store_id as storeId,
region_type as regionType,
region_path as regionPath,
deleted,
store_num as storeNum
from region_${eid}
where id = #{regionId}
</select>
<select id="getRegionByRegionId" resultType="com.cool.store.dto.region.RegionNode">
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,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
region_path as regionPath,
store_num as storeCount
from region_${eid} where id = #{regionId, jdbcType=BIGINT} and deleted = 0
</select>
<insert id="insertOrUpdate" useGeneratedKeys="true" keyProperty="record.id">
insert into region_${eid}
(
id,
name,
<if test="record.parentId != null">
parent_id,
</if>
region_type,
create_time,
syn_ding_dept_id,
unclassified_flag,
third_dept_id
) value
(
#{record.id, jdbcType=BIGINT},
#{record.name, jdbcType=VARCHAR},
<if test="record.parentId != null">
#{record.parentId, jdbcType=BIGINT},
</if>
#{record.regionType, jdbcType=VARCHAR},
#{record.createTime, jdbcType=BIGINT},
#{record.synDingDeptId, jdbcType=VARCHAR},
#{record.unclassifiedFlag},
#{record.thirdDeptId}
)
ON DUPLICATE KEY UPDATE name=values(name), parent_id=values(parent_id), syn_ding_dept_id=values(syn_ding_dept_id),third_dept_id=values(third_dept_id),
update_time = values(update_time), region_type = values(region_type), deleted = values(deleted)
</insert>
<select id="getSpecifiedRegionIdAndDeptId" resultType="com.cool.store.dto.region.RegionSyncDTO">
select
id ,
syn_ding_dept_id as synDingDeptId
from region_${eid}
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},'/%')
</if>
</select>
<select id="getRegionByDingDeptIds" resultType="com.cool.store.entity.RegionDO">
select
id ,
region_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,
syn_ding_dept_id as synDingDeptId,
region_type as regionType,
deleted as deleted
from region_${eid}
where deleted = 0
and syn_ding_dept_id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</select>
<select id="getBySynDingDeptId" resultType="com.cool.store.entity.RegionDO">
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,
syn_ding_dept_id as synDingDeptId,
store_id as storeId,
region_type as regionType,
region_path as regionPath,
deleted,
store_num as storeNum
from region_${eid}
where syn_ding_dept_id = #{synDingDeptId}
</select>
<insert id="ignoreInsert" keyColumn="id" keyProperty="region.id" useGeneratedKeys="true">
insert ignore into region_${eid}
(
region_id,
name,
parent_id,
group_id,
create_time,
create_name
<if test="region.regionPath !=null and region.regionPath!=''">
,region_path
</if>
<if test="region.regionType !=null and region.regionType!=''">
,region_type
</if>
<if test="region.storeId !=null and region.storeId!=''">
,store_id
</if>
<if test="region.synDingDeptId !=null and region.synDingDeptId!=''">
,syn_ding_dept_id
</if>
,order_num
)
values
(
#{region.regionId, jdbcType=VARCHAR},
#{region.name, jdbcType=VARCHAR},
#{region.parentId, jdbcType=VARCHAR},
#{region.groupId, jdbcType=VARCHAR},
#{region.createTime, jdbcType=BIGINT},
#{region.createName, jdbcType=VARCHAR}
<if test="region.regionPath !=null and region.regionPath!=''">
,#{region.regionPath}
</if>
<if test="region.regionType !=null and region.regionType!=''">
,#{region.regionType}
</if>
<if test="region.storeId !=null and region.storeId!=''">
,#{region.storeId}
</if>
<if test="region.synDingDeptId !=null and region.synDingDeptId!=''">
,#{region.synDingDeptId}
</if>
,(SELECT max(order_num)+1 FROM region_${eid} AS num)
)
</insert>
<update id="updateSyncRegion" >
update region_${eid}
set `parent_id` = #{item.parentId},
`name` = #{item.name},
<if test="item.regionType != null and item.regionType != ''">
`region_type` = #{item.regionType},
</if>
`deleted` = #{item.deleted},
`update_time` = #{item.updateTime},
<if test="item.storeId != null and item.storeId != ''">
store_id = #{item.storeId},
</if>
`region_path` = #{item.regionPath}
where id = #{item.id}
</update>
<update id="removeRegions">
update region_${eid}
set
deleted = 1,
parent_id = -1
where id in
<foreach collection="regionIds" index="index" item="regionId"
separator="," open="(" close=")">
#{regionId, jdbcType=BIGINT}
</foreach>
and id != 1
</update>
</mapper>

View File

@@ -437,7 +437,7 @@
<if test="regionIdList != null and regionIdList.size >0 ">
and region_id in
<foreach collection="regionIdList" item="regionId" separator="," open="(" close=" )">
#{regionId,jdbcType=BIGINT}
#{regionId}
</foreach>
</if>
</select>
@@ -451,4 +451,187 @@
select store_id from store_${eid}
where is_delete ='effective'
</select>
<select id="getSpecifiedStoreIdsAndDeptId" resultType="com.cool.store.dto.region.RegionSyncDTO">
select
id,
syn_ding_dept_id as synDingDeptId
from store_${eid}
where 1=1
<if test="isDelete!=null and isDelete!=''">
and (is_delete=#{isDelete} or syn_ding_dept_id is not null)
</if>
<if test="parentId!=null and parentId!=''">
and region_path like concat('%/',#{parentId},'/%')
</if>
</select>
<select id="getStoreBySynId" resultMap="BaseResultMap">
select * from store_${eid} where syn_ding_dept_id = #{synId}
</select>
<insert id="insertStore">
insert into store_${enterpriseId}
(
store_id,
store_name,
store_num,
region_id,
avatar,
province,
city,
county,
store_address,
location_address,
is_lock,
longitude_latitude,
longitude,
latitude,
is_delete,
telephone,
business_hours,
store_acreage,
store_bandwidth,
create_time,
create_name,
remark,
region_path,
extend_field,
syn_ding_dept_id,
source,
store_status,
address_point
)
values
(
#{storeDO.storeId},
#{storeDO.storeName},
#{storeDO.storeNum},
#{storeDO.regionId},
#{storeDO.avatar},
#{storeDO.province},
#{storeDO.city},
#{storeDO.county},
#{storeDO.storeAddress},
#{storeDO.locationAddress},
#{storeDO.isLock,jdbcType=CHAR},
#{storeDO.longitudeLatitude},
#{storeDO.longitude},
#{storeDO.latitude},
#{storeDO.isDelete,jdbcType=CHAR},
#{storeDO.telephone},
#{storeDO.businessHours},
#{storeDO.storeAcreage},
#{storeDO.storeBandwidth},
#{storeDO.createTime},
#{storeDO.createName},
#{storeDO.remark},
#{storeDO.regionPath},
#{storeDO.extendField},
#{storeDO.synDingDeptId},
#{storeDO.source},
#{storeDO.storeStatus},
ST_GeomFromText(#{storeDO.addressPoint})
)
</insert>
<update id="updateStore">
update store_${enterpriseId} set
<trim suffixOverrides=",">
<if test="storeDO.storeName != null ">
store_name = #{storeDO.storeName},
</if>
<if test="storeDO.storeNum != null ">
store_num = #{storeDO.storeNum},
</if>
<if test="storeDO.regionPath!= null ">
region_path = #{storeDO.regionPath},
</if>
<if test="storeDO.regionId!= null and storeDO.regionId != 0 ">
region_id = #{storeDO.regionId},
</if>
<if test="storeDO.avatar!= null ">
avatar = #{storeDO.avatar},
</if>
<if test="storeDO.province!= null ">
province = #{storeDO.province},
</if>
<if test="storeDO.city!= null ">
city = #{storeDO.city},
</if>
<if test="storeDO.county!= null ">
county = #{storeDO.county},
</if>
<if test="storeDO.storeAddress!= null ">
store_address = #{storeDO.storeAddress},
</if>
<if test="storeDO.locationAddress!= null ">
location_address = #{storeDO.locationAddress},
</if>
<if test="storeDO.longitudeLatitude!= null ">
longitude_latitude = #{storeDO.longitudeLatitude},
</if>
<if test="storeDO.longitude!= null ">
longitude = #{storeDO.longitude},
</if>
<if test="storeDO.latitude!= null ">
latitude = #{storeDO.latitude},
</if>
<if test="storeDO.addressPoint!= null ">
address_point = ST_GeomFromText(#{storeDO.addressPoint}),
</if>
<if test="storeDO.telephone!= null ">
telephone = #{storeDO.telephone},
</if>
<if test="storeDO.businessHours!= null ">
business_hours = #{storeDO.businessHours},
</if>
<if test="storeDO.storeAcreage!= null ">
store_acreage = #{storeDO.storeAcreage},
</if>
<if test="storeDO.storeBandwidth!= null ">
store_bandwidth = #{storeDO.storeBandwidth},
</if>
<if test="storeDO.updateTime != null ">
update_time = #{storeDO.updateTime},
</if>
<if test="storeDO.updateName != null ">
update_name = #{storeDO.updateName},
</if>
<if test="storeDO.remark!= null ">
remark = #{storeDO.remark},
</if>
<if test="storeDO.isDelete != null ">
is_delete = #{storeDO.isDelete},
</if>
<if test="storeDO.storeStatus != null ">
store_status = #{storeDO.storeStatus},
</if>
<if test="storeDO.extendField != null ">
extend_field = #{storeDO.extendField}
</if>
</trim>
where store_id=#{storeDO.storeId}
</update>
<select id="getStoreIdByIdList" resultType="java.lang.String">
select store_id from store_${eid}
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<update id="deleteStoreByStoreIds">
update store_${enterpriseId}
set is_delete='invalid',
update_name=#{userId, jdbcType=VARCHAR},
update_time=#{updateTime, jdbcType=BIGINT}
where store_id in
<foreach collection="storeIds" item="storeId" separator="," open="(" close=")">
#{storeId, jdbcType=VARCHAR}
</foreach>
</update>
</mapper>

View File

@@ -164,4 +164,15 @@
)
</foreach>
</insert>
<delete id="deletedByUserIds">
delete from subordinate_mapping_${enterpriseId}
where
user_id in
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
#{userId}
</foreach>
and type = 0
</delete>
</mapper>

View File

@@ -229,4 +229,30 @@
from sys_department_${eid}
where parent_id = #{parentId}
</select>
<delete id="deleteByNotInIds">
delete from sys_department_${eid}
where id not in
<foreach collection="list" item="item" open="(" separator="," close=")" >
#{item}
</foreach>
and id != '1'
</delete>
<select id="getSyncDeptTreeList" resultType="com.cool.store.dto.dept.SyncTreeNode">
select
id,
name,
parent_id as pid
from sys_department_${eid}
</select>
<select id="selectAll" resultType="com.cool.store.entity.SysDepartmentDO">
select
id,
name,
parent_id as parentId,
depart_order as departOrder
from sys_department_${eid}
</select>
</mapper>

View File

@@ -112,4 +112,45 @@
#{userId}
</foreach>
</select>
<delete id="deleteAuthMappingByIds">
delete from user_auth_mapping_${eid}
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectIdsByUserId" resultType="java.lang.Long">
select id from user_auth_mapping_${eid} where user_id = #{userId}
</select>
<insert id="insertUserAuthMapping">
insert into user_auth_mapping_${eid}
(
`user_id`,
`mapping_id`,
`type`,
`source`,
`create_id`,
`create_time`
)
values
(
#{auth.userId},
#{auth.mappingId},
#{auth.type},
#{auth.source},
#{auth.createId},
#{auth.createTime}
)
</insert>
<delete id="deleteAuthMappingByIdAndType">
delete from user_auth_mapping_${eid}
where type=#{type} and mapping_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -122,4 +122,11 @@
</foreach>
</if>
</select>
<delete id="deletedByIds">
delete from user_region_mapping_${enterpriseId} where id in
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</delete>
</mapper>