This commit is contained in:
zhangchenbiao
2023-05-31 15:36:45 +08:00
parent 39cef07e6a
commit b00a91d060
12 changed files with 1424 additions and 0 deletions

View File

@@ -0,0 +1,184 @@
<?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.EnterpriseUserGroupMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserGroupDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="group_id" jdbcType="VARCHAR" property="groupId"/>
<result column="group_name" jdbcType="VARCHAR" property="groupName"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="deleted" jdbcType="BIT" property="deleted"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.EnterpriseUserGroupDO">
<result column="common_edit_userids" jdbcType="LONGVARCHAR" property="commonEditUserids"/>
</resultMap>
<sql id="Base_Column_List">
id, group_id, group_name, create_time, create_user_id, update_time, update_user_id,
deleted
</sql>
<sql id="Blob_Column_List">
common_edit_userids
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into enterprise_user_group_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.groupId != null">
group_id,
</if>
<if test="record.groupName != null">
group_name,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.createUserId != null">
create_user_id,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.updateUserId != null">
update_user_id,
</if>
<if test="record.deleted != null">
deleted,
</if>
<if test="record.commonEditUserids != null">
common_edit_userids,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.groupId != null">
#{record.groupId},
</if>
<if test="record.groupName != null">
#{record.groupName},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.createUserId != null">
#{record.createUserId},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.updateUserId != null">
#{record.updateUserId},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
<if test="record.commonEditUserids != null">
#{record.commonEditUserids},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update enterprise_user_group_${enterpriseId}
<set>
<if test="record.groupId != null">
group_id = #{record.groupId},
</if>
<if test="record.groupName != null">
group_name = #{record.groupName},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted},
</if>
<if test="record.commonEditUserids != null">
common_edit_userids = #{record.commonEditUserids},
</if>
</set>
where id = #{record.id}
</update>
<select id="countByGroupName" resultType="int">
select count(1)
from enterprise_user_group_${enterpriseId}
where group_name = #{groupName}
<if test="groupId != null">
and group_id != #{groupId}
</if>
and deleted = 0
</select>
<delete id="deleteByGroupIdList">
delete from enterprise_user_group_${enterpriseId}
where group_id in
<foreach collection="groupIdList" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</delete>
<select id="listUserGroup" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from enterprise_user_group_${enterpriseId}
<if test="groupName != null and groupName !=''">
where group_name like concat('%',#{groupName},'%')
</if>
</select>
<select id="getByGroupId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from enterprise_user_group_${enterpriseId}
where group_id = #{groupId}
</select>
<select id="listByGroupIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from enterprise_user_group_${enterpriseId}
where group_id in
<foreach collection="groupIdList" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</select>
<update id="updateByGroupId">
update enterprise_user_group_${enterpriseId}
<set>
<if test="record.groupId != null">
group_id = #{record.groupId},
</if>
<if test="record.groupName != null">
group_name = #{record.groupName},
</if>
<if test="record.commonEditUserids != null">
common_edit_userids = #{record.commonEditUserids},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted},
</if>
</set>
where group_id = #{record.groupId}
</update>
</mapper>

View File

@@ -0,0 +1,181 @@
<?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.EnterpriseUserGroupMappingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserGroupMappingDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="group_id" jdbcType="VARCHAR" property="groupId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="deleted" jdbcType="BIT" property="deleted"/>
</resultMap>
<sql id="Base_Column_List">
id, user_id, group_id, create_time, create_user_id, update_time, update_user_id,
deleted
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into enterprise_user_group_mapping_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
user_id,
</if>
<if test="record.groupId != null">
group_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.createUserId != null">
create_user_id,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.updateUserId != null">
update_user_id,
</if>
<if test="record.deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
#{record.userId},
</if>
<if test="record.groupId != null">
#{record.groupId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.createUserId != null">
#{record.createUserId},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.updateUserId != null">
#{record.updateUserId},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update enterprise_user_group_mapping_${enterpriseId}
<set>
<if test="record.userId != null">
user_id = #{record.userId},
</if>
<if test="record.groupId != null">
group_id = #{record.groupId},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.createUserId != null">
create_user_id = #{record.createUserId},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.updateUserId != null">
update_user_id = #{record.updateUserId},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted},
</if>
</set>
where id = #{record.id}
</update>
<delete id="deleteUserGroupMappingByGroupId">
delete from enterprise_user_group_mapping_${enterpriseId}
where group_id in (#{groupId})
</delete>
<insert id="batchInsertMapping">
insert into enterprise_user_group_mapping_${enterpriseId}
(
group_id,
user_id
)
values
<foreach collection="userIdList" separator="," item="userId">
(
#{groupId},
#{userId}
)
</foreach>
</insert>
<delete id="deleteMappingByGroupIdList">
delete from enterprise_user_group_mapping_${enterpriseId}
where group_id = #{groupId}
<if test="userIdList != null and userIdList.size > 0">
<foreach collection="userIdList" open="and user_id in (" close=")" separator="," item="userId">
#{userId}
</foreach>
</if>
</delete>
<delete id="deleteMappingByUserIdList">
delete from enterprise_user_group_mapping_${enterpriseId}
where user_id in
<if test="userIdList != null and userIdList.size > 0">
<foreach collection="userIdList" open="(" close=")" separator="," item="userId">
#{userId}
</foreach>
</if>
</delete>
<select id="listByGroupIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from enterprise_user_group_mapping_${enterpriseId}
where group_id in (
<foreach collection="groupIdList" item="groupId" separator=",">
#{groupId}
</foreach>
)
</select>
<select id="listByUserIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from enterprise_user_group_mapping_${enterpriseId}
where user_id in (
<foreach collection="userIdList" item="userId" separator=",">
#{userId}
</foreach>
)
</select>
<insert id="batchInsertOrUpdateUserGroupMapping">
insert into enterprise_user_group_mapping_${enterpriseId}
(
user_id,
group_id,
create_time,
create_user_id,
update_time,
update_user_id
)
values
<foreach collection="userGroupMappingList" item="entity" separator=",">
(
#{entity.userId},
#{entity.groupId},
now(),
#{entity.createUserId},
now(),
#{entity.updateUserId}
)
</foreach>
ON DUPLICATE KEY UPDATE
update_time = now()
</insert>
</mapper>

View File

@@ -0,0 +1,454 @@
<?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.StoreMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.StoreDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="store_id" jdbcType="VARCHAR" property="storeId"/>
<result column="store_name" jdbcType="VARCHAR" property="storeName"/>
<result column="store_num" jdbcType="VARCHAR" property="storeNum"/>
<result column="avatar" jdbcType="VARCHAR" property="avatar"/>
<result column="ding_id" jdbcType="VARCHAR" property="dingId"/>
<result column="region_id" jdbcType="BIGINT" property="regionId"/>
<result column="province" jdbcType="VARCHAR" property="province"/>
<result column="city" jdbcType="VARCHAR" property="city"/>
<result column="county" jdbcType="VARCHAR" property="county"/>
<result column="store_address" jdbcType="VARCHAR" property="storeAddress"/>
<result column="location_address" jdbcType="VARCHAR" property="locationAddress"/>
<result column="is_lock" jdbcType="CHAR" property="isLock"/>
<result column="longitude_latitude" jdbcType="VARCHAR" property="longitudeLatitude"/>
<result column="longitude" jdbcType="VARCHAR" property="longitude"/>
<result column="latitude" jdbcType="VARCHAR" property="latitude"/>
<result column="is_delete" jdbcType="CHAR" property="isDelete"/>
<result column="telephone" jdbcType="VARCHAR" property="telephone"/>
<result column="business_hours" jdbcType="VARCHAR" property="businessHours"/>
<result column="store_acreage" jdbcType="VARCHAR" property="storeAcreage"/>
<result column="store_bandwidth" jdbcType="VARCHAR" property="storeBandwidth"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="create_name" jdbcType="VARCHAR" property="createName"/>
<result column="create_user" jdbcType="VARCHAR" property="createUser"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="update_name" jdbcType="VARCHAR" property="updateName"/>
<result column="update_user" jdbcType="VARCHAR" property="updateUser"/>
<result column="aliyun_corp_id" jdbcType="VARCHAR" property="aliyunCorpId"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="vds_corp_id" jdbcType="VARCHAR" property="vdsCorpId"/>
<result column="syn_ding_dept_id" jdbcType="VARCHAR" property="synDingDeptId"/>
<result column="region_path" jdbcType="VARCHAR" property="regionPath"/>
<result column="has_camera" jdbcType="BIT" property="hasCamera"/>
<result column="store_status" jdbcType="CHAR" property="storeStatus"/>
<result column="third_dept_id" jdbcType="VARCHAR" property="thirdDeptId"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.StoreDO">
<result column="remark" jdbcType="LONGVARCHAR" property="remark"/>
<result column="extend_field" jdbcType="LONGVARCHAR" property="extendField"/>
<result column="address_point" jdbcType="BINARY" property="addressPoint"/>
</resultMap>
<sql id="Base_Column_List">
id, store_id, store_name, store_num, avatar, ding_id, region_id, 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, create_user, update_time, update_name, update_user, aliyun_corp_id,
source, vds_corp_id, syn_ding_dept_id, region_path, has_camera, store_status, third_dept_id
</sql>
<sql id="Blob_Column_List">
remark, extend_field, address_point
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into store_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.storeId != null">
store_id,
</if>
<if test="record.storeName != null">
store_name,
</if>
<if test="record.storeNum != null">
store_num,
</if>
<if test="record.avatar != null">
avatar,
</if>
<if test="record.dingId != null">
ding_id,
</if>
<if test="record.regionId != null">
region_id,
</if>
<if test="record.province != null">
province,
</if>
<if test="record.city != null">
city,
</if>
<if test="record.county != null">
county,
</if>
<if test="record.storeAddress != null">
store_address,
</if>
<if test="record.locationAddress != null">
location_address,
</if>
<if test="record.isLock != null">
is_lock,
</if>
<if test="record.longitudeLatitude != null">
longitude_latitude,
</if>
<if test="record.longitude != null">
longitude,
</if>
<if test="record.latitude != null">
latitude,
</if>
<if test="record.isDelete != null">
is_delete,
</if>
<if test="record.telephone != null">
telephone,
</if>
<if test="record.businessHours != null">
business_hours,
</if>
<if test="record.storeAcreage != null">
store_acreage,
</if>
<if test="record.storeBandwidth != null">
store_bandwidth,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.createName != null">
create_name,
</if>
<if test="record.createUser != null">
create_user,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.updateName != null">
update_name,
</if>
<if test="record.updateUser != null">
update_user,
</if>
<if test="record.aliyunCorpId != null">
aliyun_corp_id,
</if>
<if test="record.source != null">
source,
</if>
<if test="record.vdsCorpId != null">
vds_corp_id,
</if>
<if test="record.synDingDeptId != null">
syn_ding_dept_id,
</if>
<if test="record.regionPath != null">
region_path,
</if>
<if test="record.hasCamera != null">
has_camera,
</if>
<if test="record.storeStatus != null">
store_status,
</if>
<if test="record.thirdDeptId != null">
third_dept_id,
</if>
<if test="record.remark != null">
remark,
</if>
<if test="record.extendField != null">
extend_field,
</if>
<if test="record.addressPoint != null">
address_point,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.storeId != null">
#{record.storeId},
</if>
<if test="record.storeName != null">
#{record.storeName},
</if>
<if test="record.storeNum != null">
#{record.storeNum},
</if>
<if test="record.avatar != null">
#{record.avatar},
</if>
<if test="record.dingId != null">
#{record.dingId},
</if>
<if test="record.regionId != null">
#{record.regionId},
</if>
<if test="record.province != null">
#{record.province},
</if>
<if test="record.city != null">
#{record.city},
</if>
<if test="record.county != null">
#{record.county},
</if>
<if test="record.storeAddress != null">
#{record.storeAddress},
</if>
<if test="record.locationAddress != null">
#{record.locationAddress},
</if>
<if test="record.isLock != null">
#{record.isLock},
</if>
<if test="record.longitudeLatitude != null">
#{record.longitudeLatitude},
</if>
<if test="record.longitude != null">
#{record.longitude},
</if>
<if test="record.latitude != null">
#{record.latitude},
</if>
<if test="record.isDelete != null">
#{record.isDelete},
</if>
<if test="record.telephone != null">
#{record.telephone},
</if>
<if test="record.businessHours != null">
#{record.businessHours},
</if>
<if test="record.storeAcreage != null">
#{record.storeAcreage},
</if>
<if test="record.storeBandwidth != null">
#{record.storeBandwidth},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.createName != null">
#{record.createName},
</if>
<if test="record.createUser != null">
#{record.createUser},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.updateName != null">
#{record.updateName},
</if>
<if test="record.updateUser != null">
#{record.updateUser},
</if>
<if test="record.aliyunCorpId != null">
#{record.aliyunCorpId},
</if>
<if test="record.source != null">
#{record.source},
</if>
<if test="record.vdsCorpId != null">
#{record.vdsCorpId},
</if>
<if test="record.synDingDeptId != null">
#{record.synDingDeptId},
</if>
<if test="record.regionPath != null">
#{record.regionPath},
</if>
<if test="record.hasCamera != null">
#{record.hasCamera},
</if>
<if test="record.storeStatus != null">
#{record.storeStatus},
</if>
<if test="record.thirdDeptId != null">
#{record.thirdDeptId},
</if>
<if test="record.remark != null">
#{record.remark},
</if>
<if test="record.extendField != null">
#{record.extendField},
</if>
<if test="record.addressPoint != null">
#{record.addressPoint},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update store_${enterpriseId}
<set>
<if test="record.storeId != null">
store_id = #{record.storeId},
</if>
<if test="record.storeName != null">
store_name = #{record.storeName},
</if>
<if test="record.storeNum != null">
store_num = #{record.storeNum},
</if>
<if test="record.avatar != null">
avatar = #{record.avatar},
</if>
<if test="record.dingId != null">
ding_id = #{record.dingId},
</if>
<if test="record.regionId != null">
region_id = #{record.regionId},
</if>
<if test="record.province != null">
province = #{record.province},
</if>
<if test="record.city != null">
city = #{record.city},
</if>
<if test="record.county != null">
county = #{record.county},
</if>
<if test="record.storeAddress != null">
store_address = #{record.storeAddress},
</if>
<if test="record.locationAddress != null">
location_address = #{record.locationAddress},
</if>
<if test="record.isLock != null">
is_lock = #{record.isLock},
</if>
<if test="record.longitudeLatitude != null">
longitude_latitude = #{record.longitudeLatitude},
</if>
<if test="record.longitude != null">
longitude = #{record.longitude},
</if>
<if test="record.latitude != null">
latitude = #{record.latitude},
</if>
<if test="record.isDelete != null">
is_delete = #{record.isDelete},
</if>
<if test="record.telephone != null">
telephone = #{record.telephone},
</if>
<if test="record.businessHours != null">
business_hours = #{record.businessHours},
</if>
<if test="record.storeAcreage != null">
store_acreage = #{record.storeAcreage},
</if>
<if test="record.storeBandwidth != null">
store_bandwidth = #{record.storeBandwidth},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.createName != null">
create_name = #{record.createName},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.updateName != null">
update_name = #{record.updateName},
</if>
<if test="record.updateUser != null">
update_user = #{record.updateUser},
</if>
<if test="record.aliyunCorpId != null">
aliyun_corp_id = #{record.aliyunCorpId},
</if>
<if test="record.source != null">
source = #{record.source},
</if>
<if test="record.vdsCorpId != null">
vds_corp_id = #{record.vdsCorpId},
</if>
<if test="record.synDingDeptId != null">
syn_ding_dept_id = #{record.synDingDeptId},
</if>
<if test="record.regionPath != null">
region_path = #{record.regionPath},
</if>
<if test="record.hasCamera != null">
has_camera = #{record.hasCamera},
</if>
<if test="record.storeStatus != null">
store_status = #{record.storeStatus},
</if>
<if test="record.thirdDeptId != null">
third_dept_id = #{record.thirdDeptId},
</if>
<if test="record.remark != null">
remark = #{record.remark},
</if>
<if test="record.extendField != null">
extend_field = #{record.extendField},
</if>
<if test="record.addressPoint != null">
address_point = #{record.addressPoint},
</if>
</set>
where id = #{record.id}
</update>
<select id="listStoreByRegionIdList" resultType="com.cool.store.dto.store.StoreAreaDTO">
select
store_name as storeName,
store_id as storeId,
region_path as regionPath,
region_id as areaId,
region_id as regionId
from store_${eid}
where is_delete = 'effective'
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
region_path like concat('%/', #{regionId}, '/%')
</foreach>
</select>
<select id="getStoreListByStoreIds" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from store_${enterpriseId}
where is_delete = 'effective'
and store_id in (
<foreach collection="storeIdList" separator="," item="item">
#{item}
</foreach>
)
</select>
<select id="listStoreByRegionIdListNotChild" resultType="com.cool.store.dto.store.StoreAreaDTO">
select
store_name as storeName,
store_id as storeId,
region_path as regionPath,
region_id as regionId,
region_id as areaId
from store_${eid}
where is_delete = 'effective'
<if test="regionIdList != null and regionIdList.size >0 ">
and region_id in
<foreach collection="regionIdList" item="regionId" separator="," open="(" close=" )">
#{regionId,jdbcType=BIGINT}
</foreach>
</if>
</select>
<select id="countStore" resultType="java.lang.Integer">
select count(store_id) from store_${eid}
where is_delete ='effective'
</select>
<select id="listStoreIdList" resultType="java.lang.String">
select store_id from store_${eid}
where is_delete ='effective'
</select>
</mapper>

View File

@@ -0,0 +1,167 @@
<?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.SubordinateMappingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.SubordinateMappingDO">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="region_id" jdbcType="VARCHAR" property="regionId"/>
<result column="personal_id" jdbcType="VARCHAR" property="personalId"/>
<result column="type" jdbcType="TINYINT" property="type"/>
<result column="create_id" jdbcType="VARCHAR" property="createId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_id" jdbcType="VARCHAR" property="updateId"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="user_range" jdbcType="VARCHAR" property="userRange"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
</resultMap>
<sql id="Base_Column_List">
id, user_id, region_id, personal_id, type, create_id, create_time, update_id, update_time,
user_range, source
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into subordinate_mapping_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
user_id,
</if>
<if test="record.regionId != null">
region_id,
</if>
<if test="record.personalId != null">
personal_id,
</if>
<if test="record.type != null">
type,
</if>
<if test="record.createId != null">
create_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateId != null">
update_id,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.userRange != null">
user_range,
</if>
<if test="record.source != null">
source,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.userId != null">
#{record.userId},
</if>
<if test="record.regionId != null">
#{record.regionId},
</if>
<if test="record.personalId != null">
#{record.personalId},
</if>
<if test="record.type != null">
#{record.type},
</if>
<if test="record.createId != null">
#{record.createId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateId != null">
#{record.updateId},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.userRange != null">
#{record.userRange},
</if>
<if test="record.source != null">
#{record.source},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update subordinate_mapping_${enterpriseId}
<set>
<if test="record.userId != null">
user_id = #{record.userId},
</if>
<if test="record.regionId != null">
region_id = #{record.regionId},
</if>
<if test="record.personalId != null">
personal_id = #{record.personalId},
</if>
<if test="record.type != null">
type = #{record.type},
</if>
<if test="record.createId != null">
create_id = #{record.createId},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime},
</if>
<if test="record.updateId != null">
update_id = #{record.updateId},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime},
</if>
<if test="record.userRange != null">
user_range = #{record.userRange},
</if>
<if test="record.source != null">
source = #{record.source},
</if>
</set>
where id = #{record.id}
</update>
<select id="selectByUserIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from subordinate_mapping_${enterpriseId}
where user_id in
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
#{userId}
</foreach>
and type = 0
</select>
<insert id="batchInsertSubordinateMapping">
insert into subordinate_mapping_${enterpriseId}
(
user_id,
region_id,
personal_id,
`type`,
create_id,
create_time,
update_id,
update_time,
user_range,
source
)
values
<foreach collection="subordinateMappingDOS" item="entity" separator=",">
(
#{entity.userId},
#{entity.regionId},
#{entity.personalId},
#{entity.type},
#{entity.createId},
now(),
#{entity.updateId},
now(),
#{entity.userRange},
#{entity.source}
)
</foreach>
</insert>
</mapper>