路由更新
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||||
<result column="code" property="code" jdbcType="VARCHAR"/>
|
||||
<result column="description" property="description" jdbcType="VARCHAR"/>
|
||||
<result column="module_id" property="moduleID" jdbcType="VARCHAR"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
@@ -48,7 +49,7 @@
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, permission_id, name, code, description, creator, updater,
|
||||
id, permission_id, name, code, description, module_id, creator, updater,
|
||||
create_time, update_time, delete_time, deleted
|
||||
</sql>
|
||||
|
||||
@@ -82,7 +83,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 根据角色ID查询权限列表 -->
|
||||
<select id="selectPermissionsByRoleId" resultMap="BaseResultMap">
|
||||
<select id="selectPermissionsByRoleID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
p.id, p.permission_id, p.name, p.code, p.description,
|
||||
p.creator, p.updater,
|
||||
@@ -91,7 +92,7 @@
|
||||
INNER JOIN tb_sys_permission p ON p.permission_id = rp.permission_id
|
||||
WHERE p.deleted = 0
|
||||
AND rp.deleted = 0
|
||||
AND rp.role_id = #{roleId}
|
||||
AND rp.role_id = #{roleID}
|
||||
ORDER BY p.create_time ASC
|
||||
</select>
|
||||
|
||||
@@ -111,8 +112,8 @@
|
||||
FROM tb_sys_permission
|
||||
WHERE deleted = 0
|
||||
AND name = #{permissionName}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
<if test="excludeID != null and excludeID != ''">
|
||||
AND id != #{excludeID}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -122,8 +123,8 @@
|
||||
FROM tb_sys_permission
|
||||
WHERE deleted = 0
|
||||
AND code = #{permissionCode}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
<if test="excludeID != null and excludeID != ''">
|
||||
AND id != #{excludeID}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -287,4 +288,44 @@
|
||||
AND tsrp.permission_id = #{permission.permissionID}
|
||||
ORDER BY tsr.role_id, tsr.create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据模块ID查询权限列表 -->
|
||||
<select id="selectPermissionsByModuleID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_sys_permission
|
||||
WHERE module_id = #{moduleID} AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 绑定权限到模块 -->
|
||||
<update id="bindPermissionsToModule">
|
||||
UPDATE tb_sys_permission
|
||||
SET module_id = #{moduleID}, update_time = NOW()
|
||||
WHERE permission_id IN
|
||||
<foreach collection="permissionIds" item="permissionId" open="(" separator="," close=")">
|
||||
#{permissionId}
|
||||
</foreach>
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 解绑模块的权限 -->
|
||||
<update id="unbindPermissionsFromModule">
|
||||
UPDATE tb_sys_permission
|
||||
SET module_id = NULL, update_time = NOW()
|
||||
WHERE permission_id IN
|
||||
<foreach collection="permissionIds" item="permissionId" open="(" separator="," close=")">
|
||||
#{permissionId}
|
||||
</foreach>
|
||||
AND module_id = #{moduleID}
|
||||
AND deleted = 0
|
||||
</update>
|
||||
|
||||
<!-- 获取模块的权限ID列表 -->
|
||||
<select id="getModulePermissionIds" resultType="String">
|
||||
SELECT permission_id
|
||||
FROM tb_sys_permission
|
||||
WHERE module_id = #{moduleID} AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user