新增组织架构相关
This commit is contained in:
@@ -5,12 +5,13 @@
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="role_id" jdbcType="VARCHAR" property="roleId"/>
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
||||
<result column="type" jdbcType="INTEGER" property="type"/>
|
||||
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, role_id, user_id, deleted, create_time, update_time
|
||||
id, role_id, user_id, type, deleted, create_time, update_time
|
||||
</sql>
|
||||
<insert id="batchInsertOrUpdate">
|
||||
<foreach collection="recordList" separator=";" item="record">
|
||||
@@ -22,6 +23,9 @@
|
||||
<if test="record.userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
type,
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
@@ -39,6 +43,9 @@
|
||||
<if test="record.userId != null">
|
||||
#{record.userId},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
#{record.type},
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
#{record.deleted},
|
||||
</if>
|
||||
@@ -61,6 +68,9 @@
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
@@ -74,7 +84,11 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteUserRole">
|
||||
update enterprise_user_role set deleted = 1 where role_id = #{roleId} and user_id not in <foreach collection="userIds" item="userId" separator="," open="(" close=")">#{userId}</foreach>
|
||||
<update id="deleteRoleInUser">
|
||||
update enterprise_user_role set deleted = 1 where role_id = #{roleId} and type = #{type} and user_id not in <foreach collection="excludeUserIds" item="userId" separator="," open="(" close=")">#{userId}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="deleteUserInRole">
|
||||
update enterprise_user_role set deleted = 1 where role_id != #{roleId} and user_id = #{userId} and type = #{type}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -158,4 +158,23 @@
|
||||
<update id="deleteNotExistRegion">
|
||||
update region set deleted = 1 , update_time = UNIX_TIMESTAMP() where region_id not in <foreach collection="regionIds" separator="," item="regionId" open="(" close=")"> #{regionId}</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getRegionByRegionIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
region
|
||||
where
|
||||
region_id in <foreach collection="regionIds" item="regionId" separator="," open="(" close=")">#{regionId}</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getRegionBaseInfoList" resultMap="BaseResultMap">
|
||||
select
|
||||
region_id, name, parent_id
|
||||
from
|
||||
region
|
||||
where
|
||||
deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -126,7 +126,16 @@
|
||||
from
|
||||
sys_role r inner join enterprise_user_role e on r.role_id = e.role_id
|
||||
where
|
||||
e.user_id = #{userId}
|
||||
e.user_id = #{userId} and r.deleted = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getRoleByName" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
sys_role
|
||||
where
|
||||
role_name = #{roleName} and role_type = #{roleType} and deleted = 0 limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -104,10 +104,19 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserRegion">
|
||||
<update id="deleteUserRegion">
|
||||
update user_region_mapping set deleted = 1 where region_id = #{regionId} and type = #{type}
|
||||
<if test="excludeUserIds != null and excludeUserIds.size() > 0">
|
||||
and user_id not in <foreach collection="excludeUserIds" separator="," open="(" close=")" item="userId" >#{userId}</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<update id="deleteRegionUserByExcludeRegionIds">
|
||||
update user_region_mapping set deleted = 1 where region_id not in <foreach collection="excludeRegionIds" open="(" close=")" separator="," item="regionId">#{regionId}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="deleteRegionUserByExcludeUserIds">
|
||||
update user_region_mapping set deleted = 1 where user_id not in <foreach collection="excludeUserIds" open="(" close=")" separator="," item="userId">#{userId}</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user