mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 修改框架中批量接口,改为原生mybatis执行foreach,改善性能
This commit is contained in:
@ -30,4 +30,12 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept> {
|
||||
*/
|
||||
public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param depts 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.system.mapper;
|
||||
import com.ruoyi.common.core.page.BaseMapperPlus;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与部门关联表 数据层
|
||||
*
|
||||
@ -10,4 +12,12 @@ import com.ruoyi.system.domain.SysRoleDept;
|
||||
*/
|
||||
public interface SysRoleDeptMapper extends BaseMapperPlus<SysRoleDept> {
|
||||
|
||||
/**
|
||||
* 批量新增角色部门信息
|
||||
*
|
||||
* @param roleDeptList 角色部门列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleDept(List<SysRoleDept> roleDeptList);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.system.mapper;
|
||||
import com.ruoyi.common.core.page.BaseMapperPlus;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联表 数据层
|
||||
*
|
||||
@ -10,4 +12,12 @@ import com.ruoyi.system.domain.SysRoleMenu;
|
||||
*/
|
||||
public interface SysRoleMenuMapper extends BaseMapperPlus<SysRoleMenu> {
|
||||
|
||||
/**
|
||||
* 批量新增角色菜单信息
|
||||
*
|
||||
* @param roleMenuList 角色菜单列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleMenu(List<SysRoleMenu> roleMenuList);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.system.mapper;
|
||||
import com.ruoyi.common.core.page.BaseMapperPlus;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与岗位关联表 数据层
|
||||
*
|
||||
@ -10,4 +12,12 @@ import com.ruoyi.system.domain.SysUserPost;
|
||||
*/
|
||||
public interface SysUserPostMapper extends BaseMapperPlus<SysUserPost> {
|
||||
|
||||
/**
|
||||
* 批量新增用户岗位信息
|
||||
*
|
||||
* @param userPostList 用户角色列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserPost(List<SysUserPost> userPostList);
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package com.ruoyi.system.mapper;
|
||||
import com.ruoyi.common.core.page.BaseMapperPlus;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与角色关联表 数据层
|
||||
*
|
||||
@ -10,4 +12,12 @@ import com.ruoyi.system.domain.SysUserRole;
|
||||
*/
|
||||
public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 批量新增用户角色信息
|
||||
*
|
||||
* @param userRoleList 用户角色列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserRole(List<SysUserRole> userRoleList);
|
||||
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
||||
}
|
||||
if (children.size() > 0) {
|
||||
updateBatchById(children);
|
||||
baseMapper.updateDeptChildren(children);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,9 +240,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
list.add(rm);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
for (SysRoleMenu sysRoleMenu : list) {
|
||||
rows += roleMenuMapper.insert(sysRoleMenu);
|
||||
}
|
||||
rows = roleMenuMapper.batchRoleMenu(list);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
@ -263,9 +261,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
list.add(rd);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
for (SysRoleDept sysRoleDept : list) {
|
||||
rows += roleDeptMapper.insert(sysRoleDept);
|
||||
}
|
||||
rows = roleDeptMapper.batchRoleDept(list);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
@ -311,9 +311,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
list.add(ur);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
for (SysUserRole sysUserRole : list) {
|
||||
userRoleMapper.insert(sysUserRole);
|
||||
}
|
||||
userRoleMapper.batchUserRole(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -335,9 +333,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
list.add(up);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
for (SysUserPost sysUserPost : list) {
|
||||
userPostMapper.insert(sysUserPost);
|
||||
}
|
||||
userPostMapper.batchUserPost(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user