upd: 编码规范
This commit is contained in:
+2
-4
@@ -7,9 +7,7 @@ import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface RoleDeptMapper {
|
||||
void insertBatchByRoleId(@Param("roleId") Long roleId, @Param("depts") Set<Dept> depts);
|
||||
|
||||
void insertBatchWithRoleId(@Param("roleId") Long roleId, @Param("depts") Set<Dept> depts);
|
||||
void deleteByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
void deleteBatchByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
void deleteByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
}
|
||||
|
||||
+3
-3
@@ -88,7 +88,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||
save(BeanUtil.copyProperties(resources, Role.class));
|
||||
// 判断是否有部门数据,若有,则需创建关联
|
||||
if (CollectionUtil.isNotEmpty(resources.getDepts())) {
|
||||
roleDeptMapper.insertBatchByRoleId(resources.getId(), resources.getDepts());
|
||||
roleDeptMapper.insertBatchWithRoleId(resources.getId(), resources.getDepts());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||
roleDeptMapper.deleteByRoleId(resources.getId());
|
||||
// 判断是否有部门数据,若有,则需更新关联
|
||||
if (CollectionUtil.isNotEmpty(resources.getDepts())) {
|
||||
roleDeptMapper.insertBatchByRoleId(resources.getId(), resources.getDepts());
|
||||
roleDeptMapper.insertBatchWithRoleId(resources.getId(), resources.getDepts());
|
||||
}
|
||||
// 更新相关缓存
|
||||
delCaches(role.getId(), null);
|
||||
@@ -139,7 +139,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||
}
|
||||
removeBatchByIds(ids);
|
||||
// 删除角色部门关联数据、角色菜单关联数据
|
||||
roleDeptMapper.deleteBatchByRoleIds(ids);
|
||||
roleDeptMapper.deleteByRoleIds(ids);
|
||||
roleMenuMapper.deleteByRoleIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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="cn.odboy.application.system.mapper.RoleDeptMapper">
|
||||
<insert id="insertBatchByRoleId">
|
||||
<insert id="insertBatchWithRoleId">
|
||||
insert into sys_roles_depts (role_id, dept_id)
|
||||
values
|
||||
<foreach collection="depts" item="item" open="(" separator="),(" close=")">
|
||||
@@ -15,7 +15,7 @@
|
||||
where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBatchByRoleIds">
|
||||
<delete id="deleteByRoleIds">
|
||||
delete from sys_roles_depts
|
||||
where role_id in
|
||||
<foreach collection="roleIds" item="id" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user