refactor: 完成ORM包的集成测试

This commit is contained in:
valarchie
2022-10-29 22:32:40 +08:00
parent ba26482b3d
commit 451a5034bc
38 changed files with 780 additions and 425 deletions

View File

@@ -78,7 +78,7 @@ public class DeptApplicationService {
@Transactional
public void addDept(AddDeptCommand addCommand, LoginUser loginUser) {
DeptModel deptModel = addCommand.toModel();
if (deptService.checkDeptNameUnique(deptModel.getDeptName(), null, deptModel.getParentId())) {
if (!deptService.isDeptNameUnique(deptModel.getDeptName(), null, deptModel.getParentId())) {
throw new ApiException(ErrorCode.Business.DEPT_NAME_IS_NOT_UNIQUE, deptModel.getDeptName());
}
@@ -94,7 +94,7 @@ public class DeptApplicationService {
getDeptModel(updateCommand.getDeptId());
DeptModel deptModel = updateCommand.toModel();
if (deptService.checkDeptNameUnique(deptModel.getDeptName(), deptModel.getDeptId(), deptModel.getParentId())) {
if (!deptService.isDeptNameUnique(deptModel.getDeptName(), deptModel.getDeptId(), deptModel.getParentId())) {
throw new ApiException(ErrorCode.Business.DEPT_NAME_IS_NOT_UNIQUE, deptModel.getDeptName());
}
@@ -112,7 +112,7 @@ public class DeptApplicationService {
DeptModel deptModel = getDeptModel(deptId);
deptModel.checkExistChildDept(deptService);
deptModel.checkExistLinkedUsers(userService);
deptModel.checkExistLinkedUsers(deptService);
deptService.removeById(deptId);
}

View File

@@ -29,13 +29,13 @@ public class DeptModel extends SysDeptEntity {
public void checkExistChildDept(ISysDeptService deptService) {
if (deptService.hasDirectChildDept(getDeptId())) {
if (deptService.hasChildrenDept(getDeptId(), null)) {
throw new ApiException(ErrorCode.Business.DEPT_EXIST_CHILD_DEPT_NOT_ALLOW_DELETE);
}
}
public void checkExistLinkedUsers(ISysUserService userService) {
if (userService.checkDeptExistUser(getDeptId())) {
public void checkExistLinkedUsers(ISysDeptService deptService) {
if (deptService.isDeptAssignedToUsers(getDeptId())) {
throw new ApiException(ErrorCode.Business.DEPT_EXIST_LINK_USER_NOT_ALLOW_DELETE);
}
}
@@ -58,7 +58,7 @@ public class DeptModel extends SysDeptEntity {
*/
public void checkStatusAllowChange(ISysDeptService deptService) {
if (CommonStatusEnum.DISABLE.getValue().equals(getStatus()) &&
deptService.existChildrenDeptById(getDeptId(), true)) {
deptService.hasChildrenDept(getDeptId(), true)) {
throw new ApiException(ErrorCode.Business.DEPT_STATUS_ID_IS_NOT_ALLOWED_CHANGE);
}

View File

@@ -18,6 +18,7 @@ import com.agileboot.domain.system.menu.query.MenuQuery;
import com.agileboot.infrastructure.web.domain.login.LoginUser;
import com.agileboot.infrastructure.web.util.AuthenticationUtils;
import com.agileboot.orm.entity.SysMenuEntity;
import com.agileboot.orm.enums.MenuTypeEnum;
import com.agileboot.orm.service.ISysMenuService;
import java.util.LinkedList;
import java.util.List;
@@ -47,7 +48,7 @@ public class MenuApplicationService {
public List<Tree<Long>> getDropdownList(LoginUser loginUser) {
List<SysMenuEntity> menuEntityList =
loginUser.isAdmin() ? menuService.list() : menuService.selectMenuListByUserId(loginUser.getUserId());
loginUser.isAdmin() ? menuService.list() : menuService.getMenuListByUserId(loginUser.getUserId());
return buildMenuTreeSelect(menuEntityList);
}
@@ -55,11 +56,11 @@ public class MenuApplicationService {
public TreeSelectedDTO getRoleDropdownList(LoginUser loginUser, Long roleId) {
List<SysMenuEntity> menus = loginUser.isAdmin() ?
menuService.list() : menuService.selectMenuListByUserId(loginUser.getUserId());
menuService.list() : menuService.getMenuListByUserId(loginUser.getUserId());
TreeSelectedDTO tree = new TreeSelectedDTO();
tree.setMenus(buildMenuTreeSelect(menus));
tree.setCheckedKeys(menuService.selectMenuListByRoleId(roleId));
tree.setCheckedKeys(menuService.getMenuIdsByRoleId(roleId));
return tree;
}
@@ -128,19 +129,22 @@ public class MenuApplicationService {
public List<Tree<Long>> buildMenuEntityTree(Long userId) {
List<SysMenuEntity> menus;
List<SysMenuEntity> allMenus;
if (AuthenticationUtils.isAdmin(userId)) {
menus = menuService.listMenuListWithoutButton();
allMenus = menuService.list();
} else {
menus = menuService.listMenuListWithoutButtonByUserId(userId);
allMenus = menuService.getMenuListByUserId(userId);
}
List<SysMenuEntity> noButtonMenus = allMenus.stream()
.filter(menu -> !MenuTypeEnum.BUTTON.getValue().equals(menu.getMenuType()))
.collect(Collectors.toList());
TreeNodeConfig config = new TreeNodeConfig();
//默认为id可以不设置
config.setIdKey("menuId");
return TreeUtil.build(menus, 0L, config, (menu, tree) -> {
return TreeUtil.build(noButtonMenus, 0L, config, (menu, tree) -> {
// 也可以使用 tree.setId(dept.getId());等一些默认值
tree.setId(menu.getMenuId());
tree.setParentId(menu.getParentId());

View File

@@ -19,7 +19,7 @@ public class MenuModel extends SysMenuEntity {
public void checkMenuNameUnique(ISysMenuService menuService) {
if (menuService.checkMenuNameUnique(getMenuName(), getMenuId(), getParentId())) {
if (!menuService.isMenuNameUnique(getMenuName(), getMenuId(), getParentId())) {
throw new ApiException(ErrorCode.Business.MENU_NAME_IS_NOT_UNIQUE);
}
}
@@ -39,13 +39,13 @@ public class MenuModel extends SysMenuEntity {
}
public void checkHasChildMenus(ISysMenuService menuService) {
if (menuService.hasChildByMenuId(getMenuId())) {
if (menuService.hasChildrenMenu(getMenuId())) {
throw new ApiException(ErrorCode.Business.MENU_EXIST_CHILD_MENU_NOT_ALLOW_DELETE);
}
}
public void checkMenuAlreadyAssignToRole(ISysMenuService menuService) {
if (menuService.checkMenuExistRole(getMenuId())) {
if (menuService.isMenuAssignToRoles(getMenuId())) {
throw new ApiException(ErrorCode.Business.MENU_ALREADY_ASSIGN_TO_ROLE_NOT_ALLOW_DELETE);
}
}

View File

@@ -43,11 +43,11 @@ public class PostApplicationService {
PostModel postModel = addCommand.toModel();
// check这种全局唯一性的判断 不适合放在 model领域类当中 所以放在db service中 比较合适
if (postService.checkPostNameUnique(null, postModel.getPostName())) {
if (!postService.isPostNameUnique(null, postModel.getPostName())) {
throw new ApiException(ErrorCode.Business.POST_NAME_IS_NOT_UNIQUE, postModel.getPostName());
}
if (postService.checkPostCodeUnique(null, postModel.getPostCode())) {
if (!postService.isPostCodeUnique(null, postModel.getPostCode())) {
throw new ApiException(ErrorCode.Business.POST_CODE_IS_NOT_UNIQUE, postModel.getPostCode());
}
@@ -60,11 +60,11 @@ public class PostApplicationService {
PostModel postModel = updateCommand.toModel();
// check这种全局唯一性的判断 不适合放在 model领域类当中 所以放在db service中 比较合适
if (postService.checkPostNameUnique(postModel.getPostId(), postModel.getPostName())) {
if (!postService.isPostNameUnique(postModel.getPostId(), postModel.getPostName())) {
throw new ApiException(ErrorCode.Business.POST_NAME_IS_NOT_UNIQUE, postModel.getPostName());
}
if (postService.checkPostCodeUnique(postModel.getPostId(), postModel.getPostCode())) {
if (!postService.isPostCodeUnique(postModel.getPostId(), postModel.getPostCode())) {
throw new ApiException(ErrorCode.Business.POST_CODE_IS_NOT_UNIQUE, postModel.getPostCode());
}

View File

@@ -18,7 +18,7 @@ public class PostModel extends SysPostEntity {
public void checkCanBeDelete(ISysPostService postService) {
if (postService.isAssignedToUser(this.getPostId())) {
if (postService.isAssignedToUsers(this.getPostId())) {
throw new ApiException(ErrorCode.Business.POST_ALREADY_ASSIGNED_TO_USER_CAN_NOT_BE_DELETED);
}
}

View File

@@ -147,13 +147,13 @@ public class RoleApplicationService {
public PageDTO getAllocatedUserList(AllocatedRoleQuery query) {
Page<SysUserEntity> page = userService.selectAllocatedList(query);
Page<SysUserEntity> page = userService.getUserListByRole(query);
List<UserDTO> dtoList = page.getRecords().stream().map(UserDTO::new).collect(Collectors.toList());
return new PageDTO(dtoList, page.getTotal());
}
public PageDTO getUnallocatedUserList(UnallocatedRoleQuery query) {
Page<SysUserEntity> page = userService.selectUnallocatedList(query);
Page<SysUserEntity> page = userService.getUserListByRole(query);
List<UserDTO> dtoList = page.getRecords().stream().map(UserDTO::new).collect(Collectors.toList());
return new PageDTO(dtoList, page.getTotal());
}

View File

@@ -8,7 +8,6 @@ import com.agileboot.orm.entity.SysRoleEntity;
import com.agileboot.orm.entity.SysRoleMenuEntity;
import com.agileboot.orm.service.ISysRoleMenuService;
import com.agileboot.orm.service.ISysRoleService;
import com.agileboot.orm.service.ISysUserService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -32,19 +31,19 @@ public class RoleModel extends SysRoleEntity {
private List<Long> deptIds;
public void checkRoleNameUnique(ISysRoleService roleService) {
if (roleService.checkRoleNameUnique(getRoleId(), getRoleName())) {
if (!roleService.isRoleNameUnique(getRoleId(), getRoleName())) {
throw new ApiException(ErrorCode.Business.ROLE_NAME_IS_NOT_UNIQUE, getRoleName());
}
}
public void checkRoleCanBeDelete(ISysUserService userService) {
if (userService.checkExistUserLinkToRole(getRoleId())) {
public void checkRoleCanBeDelete(ISysRoleService userService) {
if (userService.isAssignedToUsers(getRoleId())) {
throw new ApiException(ErrorCode.Business.ROLE_NAME_IS_NOT_UNIQUE, getRoleName());
}
}
public void checkRoleKeyUnique(ISysRoleService roleService) {
if (roleService.checkRoleKeyUnique(getRoleId(), getRoleKey())) {
if (!roleService.isRoleKeyUnique(getRoleId(), getRoleKey())) {
throw new ApiException(ErrorCode.Business.ROLE_KEY_IS_NOT_UNIQUE, getRoleKey());
}
}

View File

@@ -24,4 +24,5 @@ public class AllocatedRoleQuery extends AbstractPageQuery {
return queryWrapper;
}
}

View File

@@ -22,7 +22,8 @@ public class UnallocatedRoleQuery extends AbstractPageQuery {
queryWrapper.like(StrUtil.isNotEmpty(username),"u.username", username)
.like(StrUtil.isNotEmpty(phoneNumber), "u.phone_number", phoneNumber)
.and(o-> o.ne("r.role_id", roleId)
.or().isNull("u.role_id"));
.or().isNull("u.role_id")
.or().eq("u.role_id", 0));
return queryWrapper;
}

View File

@@ -62,7 +62,7 @@ public class UserApplicationService {
public PageDTO getUserList(SearchUserQuery query) {
Page<SearchUserDO> searchUserDOPage = userService.selectUserList(query);
Page<SearchUserDO> searchUserDOPage = userService.getUserList(query);
List<UserDTO> userDTOList = searchUserDOPage.getRecords().stream().map(UserDTO::new).collect(Collectors.toList());
return new PageDTO(userDTOList, searchUserDOPage.getTotal());
}

View File

@@ -18,21 +18,21 @@ import lombok.NoArgsConstructor;
public class UserModel extends SysUserEntity {
public void checkUsernameIsUnique(ISysUserService userService) {
if (userService.checkUserNameUnique(getUsername())) {
if (!userService.isUserNameUnique(getUsername())) {
throw new ApiException(ErrorCode.Business.USER_NAME_IS_NOT_UNIQUE);
}
}
public void checkPhoneNumberIsUnique(ISysUserService userService) {
if (StrUtil.isNotEmpty(getPhoneNumber()) && userService.checkPhoneUnique(getPhoneNumber(),
if (StrUtil.isNotEmpty(getPhoneNumber()) && !userService.isPhoneUnique(getPhoneNumber(),
getUserId())) {
throw new ApiException(ErrorCode.Business.USER_PHONE_NUMBER_IS_NOT_UNIQUE);
}
}
public void checkEmailIsUnique(ISysUserService userService) {
if (StrUtil.isNotEmpty(getEmail()) && userService.checkEmailUnique(getEmail(), getUserId())) {
if (StrUtil.isNotEmpty(getEmail()) && !userService.isEmailUnique(getEmail(), getUserId())) {
throw new ApiException(ErrorCode.Business.USER_EMAIL_IS_NOT_UNIQUE);
}
}

View File

@@ -0,0 +1,25 @@
package com.agileboot.infrastructure.mybatisplus;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import java.util.List;
/**
* 由于H2不支持大部分Mysql的函数 所以要自己实现
* 在H2的初始化 h2sql/agileboot_schema.sql加上这句
* CREATE ALIAS UNIX_TIMESTAMP FOR "com.agileboot.infrastructure.mybatisplus.MySqlFunction.find_in_set";
* @author valarchie
*/
public class MySqlFunction {
public static boolean findInSet(String target, String setString) {
if (setString == null) {
return false;
}
List<String> split = StrUtil.split(setString, ",");
return CollUtil.contains(split, target);
}
}

View File

@@ -129,7 +129,8 @@ public class PermissionService {
}
if (role.getDataScope() == DataScopeEnum.CURRENT_DEPT_AND_CHILDREN_DEPT &&
deptService.isChildOfTheDept(loginUser.getDeptId(), targetDeptId)) {
(deptService.isChildOfTheDept(loginUser.getDeptId(), targetDeptId)
|| Objects.equals(loginUser.getDeptId(), targetDeptId))) {
return true;
}

View File

@@ -73,7 +73,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
if (LoginUser.isAdmin(userId)) {
perms.add("*:*:*");
} else {
perms.addAll(userService.selectMenuPermsByUserId(userId));
perms.addAll(userService.getMenuPermissionsForUser(userId));
}
return perms;
}

View File

@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:33067/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:33067/agileboot4?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: 12345
# 从库数据源

View File

@@ -29,16 +29,16 @@ INSERT INTO `sys_config` VALUES ('5', '账号自助-是否开启用户注册功
-- ----------------------------
-- Records of sys_dept
-- ----------------------------
INSERT INTO `sys_dept` VALUES ('100', '0', '0', 'AgileBoot科技', '0', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('101', '100', '0,100', '深圳总公司', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('102', '100', '0,100', '长沙分公司', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('103', '101', '0,100,101', '研发部门', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('104', '101', '0,100,101', '市场部门', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('105', '101', '0,100,101', '测试部门', '3', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('106', '101', '0,100,101', '财务部门', '4', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('107', '101', '0,100,101', '运维部门', '5', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('108', '102', '0,100,102', '市场部门', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('109', '102', '0,100,102', '财务部门', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '0', null, 'admin', '2022-05-21 08:30:54', '1', 'admin', '2022-10-05 22:16:49', '0');
INSERT INTO `sys_dept` VALUES ('1', '0', '0', 'AgileBoot科技', '0', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('2', '1', '0,1', '深圳总公司', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('3', '1', '0,1', '长沙分公司', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('4', '2', '0,1,2', '研发部门', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('5', '2', '0,1,2', '市场部门', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('6', '2', '0,1,2', '测试部门', '3', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('7', '2', '0,1,2', '财务部门', '4', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('8', '2', '0,1,2', '运维部门', '5', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('9', '3', '0,1,3', '市场部门', '1', null, 'valarchie', '15888888888', 'valarchie@163.com', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_dept` VALUES ('10', '3', '0,1,3', '财务部门', '2', null, 'valarchie', '15888888888', 'valarchie@163.com', '0', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
@@ -53,85 +53,64 @@ INSERT INTO `sys_menu` VALUES ('1', '系统管理', '0', '1', 'system', null, ''
INSERT INTO `sys_menu` VALUES ('2', '系统监控', '0', '2', 'monitor', null, '', '0', '1', '1', '1', '1', '', 'monitor', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '系统监控目录', '0');
INSERT INTO `sys_menu` VALUES ('3', '系统工具', '0', '3', 'tool', null, '', '0', '1', '1', '1', '1', '', 'tool', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '系统工具目录', '0');
INSERT INTO `sys_menu` VALUES ('4', 'AgileBoot官网', '0', '4', 'http://ruoyi.vip', null, '', '1', '1', '1', '1', '1', '', 'guide', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '若依官网地址', '0');
INSERT INTO `sys_menu` VALUES ('100', '用户管理', '1', '1', 'user', 'system/user/index', '', '0', '1', '2', '1', '1', 'system:user:list', 'user', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '用户管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('101', '角色管理', '1', '2', 'role', 'system/role/index', '', '0', '1', '2', '1', '1', 'system:role:list', 'peoples', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '角色管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', '0', '1', '2', '1', '1', 'system:menu:list', 'tree-table', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '菜单管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', '0', '1', '2', '1', '1', 'system:dept:list', 'tree', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '部门管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', '0', '1', '2', '1', '1', 'system:post:list', 'post', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '岗位管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', '0', '1', '2', '1', '1', 'system:dict:list', 'dict', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '字典管理菜单', '1');
INSERT INTO `sys_menu` VALUES ('106', '参数设置', '1', '7', 'config', 'system/config/index', '', '0', '1', '2', '1', '1', 'system:config:list', 'edit', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '参数设置菜单', '0');
INSERT INTO `sys_menu` VALUES ('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', '0', '1', '2', '1', '1', 'system:notice:list', 'message', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '通知公告菜单', '0');
INSERT INTO `sys_menu` VALUES ('108', '日志管理', '1', '9', 'log', '', '', '0', '1', '1', '1', '1', '', 'log', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '日志管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', '0', '1', '2', '1', '1', 'monitor:online:list', 'online', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '在线用户菜单', '0');
INSERT INTO `sys_menu` VALUES ('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', '0', '1', '2', '1', '1', 'monitor:job:list', 'job', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '定时任务菜单', '1');
INSERT INTO `sys_menu` VALUES ('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', '0', '1', '2', '1', '1', 'monitor:druid:list', 'druid', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '数据监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', '0', '1', '2', '1', '1', 'monitor:server:list', 'server', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '服务监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', '0', '1', '2', '1', '1', 'monitor:cache:list', 'redis', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '缓存监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', '0', '1', '2', '1', '1', 'tool:build:list', 'build', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '表单构建菜单', '1');
INSERT INTO `sys_menu` VALUES ('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '0', '1', '2', '1', '1', 'tool:gen:list', 'code', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '代码生成菜单', '1');
INSERT INTO `sys_menu` VALUES ('116', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', '0', '1', '2', '1', '1', 'tool:swagger:list', 'swagger', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '系统接口菜单', '0');
INSERT INTO `sys_menu` VALUES ('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', '0', '1', '2', '1', '1', 'monitor:operlog:list', 'form', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '操作日志菜单', '0');
INSERT INTO `sys_menu` VALUES ('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', '0', '1', '2', '1', '1', 'monitor:logininfor:list', 'logininfor', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '登录日志菜单', '0');
INSERT INTO `sys_menu` VALUES ('1001', '用户查询', '100', '1', '', '', '', '0', '1', '3', '1', '1', 'system:user:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1002', '用户新增', '100', '2', '', '', '', '0', '1', '3', '1', '1', 'system:user:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1003', '用户修改', '100', '3', '', '', '', '0', '1', '3', '1', '1', 'system:user:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1004', '用户删除', '100', '4', '', '', '', '0', '1', '3', '1', '1', 'system:user:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1005', '用户导出', '100', '5', '', '', '', '0', '1', '3', '1', '1', 'system:user:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1006', '用户导入', '100', '6', '', '', '', '0', '1', '3', '1', '1', 'system:user:import', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1007', '重置密码', '100', '7', '', '', '', '0', '1', '3', '1', '1', 'system:user:resetPwd', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1008', '角色查询', '101', '1', '', '', '', '0', '1', '3', '1', '1', 'system:role:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1009', '角色新增', '101', '2', '', '', '', '0', '1', '3', '1', '1', 'system:role:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1010', '角色修改', '101', '3', '', '', '', '0', '1', '3', '1', '1', 'system:role:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1011', '角色删除', '101', '4', '', '', '', '0', '1', '3', '1', '1', 'system:role:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1012', '角色导出', '101', '5', '', '', '', '0', '1', '3', '1', '1', 'system:role:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1013', '菜单查询', '102', '1', '', '', '', '0', '1', '3', '1', '1', 'system:menu:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1014', '菜单新增', '102', '2', '', '', '', '0', '1', '3', '1', '1', 'system:menu:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1015', '菜单修改', '102', '3', '', '', '', '0', '1', '3', '1', '1', 'system:menu:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1016', '菜单删除', '102', '4', '', '', '', '0', '1', '3', '1', '1', 'system:menu:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1017', '部门查询', '103', '1', '', '', '', '0', '1', '3', '1', '1', 'system:dept:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1018', '部门新增', '103', '2', '', '', '', '0', '1', '3', '1', '1', 'system:dept:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1019', '部门修改', '103', '3', '', '', '', '0', '1', '3', '1', '1', 'system:dept:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1020', '部门删除', '103', '4', '', '', '', '0', '1', '3', '1', '1', 'system:dept:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1021', '岗位查询', '104', '1', '', '', '', '0', '1', '3', '1', '1', 'system:post:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1022', '岗位新增', '104', '2', '', '', '', '0', '1', '3', '1', '1', 'system:post:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1023', '岗位修改', '104', '3', '', '', '', '0', '1', '3', '1', '1', 'system:post:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1024', '岗位删除', '104', '4', '', '', '', '0', '1', '3', '1', '1', 'system:post:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1025', '岗位导出', '104', '5', '', '', '', '0', '1', '3', '1', '1', 'system:post:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1026', '字典查询', '105', '1', '#', '', '', '0', '1', '3', '1', '1', 'system:dict:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1027', '字典新增', '105', '2', '#', '', '', '0', '1', '3', '1', '1', 'system:dict:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1028', '字典修改', '105', '3', '#', '', '', '0', '1', '3', '1', '1', 'system:dict:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1029', '字典删除', '105', '4', '#', '', '', '0', '1', '3', '1', '1', 'system:dict:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1030', '字典导出', '105', '5', '#', '', '', '0', '1', '3', '1', '1', 'system:dict:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1031', '参数查询', '106', '1', '#', '', '', '0', '1', '3', '1', '1', 'system:config:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1032', '参数新增', '106', '2', '#', '', '', '0', '1', '3', '1', '1', 'system:config:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1033', '参数修改', '106', '3', '#', '', '', '0', '1', '3', '1', '1', 'system:config:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1034', '参数删除', '106', '4', '#', '', '', '0', '1', '3', '1', '1', 'system:config:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1035', '参数导出', '106', '5', '#', '', '', '0', '1', '3', '1', '1', 'system:config:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1036', '公告查询', '107', '1', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1037', '公告新增', '107', '2', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1038', '公告修改', '107', '3', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1039', '公告删除', '107', '4', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1040', '操作查询', '500', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1041', '操作删除', '500', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1042', '日志导出', '500', '4', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1043', '登录查询', '501', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1044', '登录删除', '501', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1045', '日志导出', '501', '3', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1046', '在线查询', '109', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1047', '批量强退', '109', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:batchLogout', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1048', '单条强退', '109', '3', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:forceLogout', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('1049', '任务查询', '110', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1050', '任务新增', '110', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1051', '任务修改', '110', '3', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1052', '任务删除', '110', '4', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1053', '状态修改', '110', '5', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:changeStatus', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1054', '任务导出', '110', '7', '#', '', '', '0', '1', '3', '1', '1', 'monitor:job:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1055', '生成查询', '115', '1', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1056', '生成修改', '115', '2', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1057', '生成删除', '115', '3', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1058', '导入代码', '115', '2', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:import', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1059', '预览代码', '115', '4', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:preview', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('1060', '生成代码', '115', '5', '#', '', '', '0', '1', '3', '1', '1', 'tool:gen:code', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '1');
INSERT INTO `sys_menu` VALUES ('5', '用户管理', '1', '1', 'user', 'system/user/index', '', '0', '1', '2', '1', '1', 'system:user:list', 'user', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '用户管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('6', '角色管理', '1', '2', 'role', 'system/role/index', '', '0', '1', '2', '1', '1', 'system:role:list', 'peoples', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '角色管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('7', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', '0', '1', '2', '1', '1', 'system:menu:list', 'tree-table', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '菜单管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('8', '部门管理', '1', '4', 'dept', 'system/dept/index', '', '0', '1', '2', '1', '1', 'system:dept:list', 'tree', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '部门管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('9', '岗位管理', '1', '5', 'post', 'system/post/index', '', '0', '1', '2', '1', '1', 'system:post:list', 'post', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '岗位管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('10', '参数设置', '1', '7', 'config', 'system/config/index', '', '0', '1', '2', '1', '1', 'system:config:list', 'edit', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '参数设置菜单', '0');
INSERT INTO `sys_menu` VALUES ('11', '通知公告', '1', '8', 'notice', 'system/notice/index', '', '0', '1', '2', '1', '1', 'system:notice:list', 'message', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '通知公告菜单', '0');
INSERT INTO `sys_menu` VALUES ('12', '日志管理', '1', '9', 'log', '', '', '0', '1', '1', '1', '1', '', 'log', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '日志管理菜单', '0');
INSERT INTO `sys_menu` VALUES ('13', '在线用户', '2', '1', 'online', 'monitor/online/index', '', '0', '1', '2', '1', '1', 'monitor:online:list', 'online', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '在线用户菜单', '0');
INSERT INTO `sys_menu` VALUES ('14', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', '0', '1', '2', '1', '1', 'monitor:druid:list', 'druid', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '数据监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('15', '服务监控', '2', '4', 'server', 'monitor/server/index', '', '0', '1', '2', '1', '1', 'monitor:server:list', 'server', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '服务监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('16', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', '0', '1', '2', '1', '1', 'monitor:cache:list', 'redis', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '缓存监控菜单', '0');
INSERT INTO `sys_menu` VALUES ('17', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', '0', '1', '2', '1', '1', 'tool:swagger:list', 'swagger', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '系统接口菜单', '0');
INSERT INTO `sys_menu` VALUES ('18', '操作日志', '12', '1', 'operlog', 'monitor/operlog/index', '', '0', '1', '2', '1', '1', 'monitor:operlog:list', 'form', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '操作日志菜单', '0');
INSERT INTO `sys_menu` VALUES ('19', '登录日志', '12', '2', 'logininfor', 'monitor/logininfor/index', '', '0', '1', '2', '1', '1', 'monitor:logininfor:list', 'logininfor', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '登录日志菜单', '0');
INSERT INTO `sys_menu` VALUES ('20', '用户查询', '5', '1', '', '', '', '0', '1', '3', '1', '1', 'system:user:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('21', '用户新增', '5', '2', '', '', '', '0', '1', '3', '1', '1', 'system:user:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('22', '用户修改', '5', '3', '', '', '', '0', '1', '3', '1', '1', 'system:user:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('23', '用户删除', '5', '4', '', '', '', '0', '1', '3', '1', '1', 'system:user:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('24', '用户导出', '5', '5', '', '', '', '0', '1', '3', '1', '1', 'system:user:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('25', '用户导入', '5', '6', '', '', '', '0', '1', '3', '1', '1', 'system:user:import', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('26', '重置密码', '5', '7', '', '', '', '0', '1', '3', '1', '1', 'system:user:resetPwd', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('27', '角色查询', '6', '1', '', '', '', '0', '1', '3', '1', '1', 'system:role:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('28', '角色新增', '6', '2', '', '', '', '0', '1', '3', '1', '1', 'system:role:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('29', '角色修改', '6', '3', '', '', '', '0', '1', '3', '1', '1', 'system:role:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('30', '角色删除', '6', '4', '', '', '', '0', '1', '3', '1', '1', 'system:role:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('31', '角色导出', '6', '5', '', '', '', '0', '1', '3', '1', '1', 'system:role:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('32', '菜单查询', '7', '1', '', '', '', '0', '1', '3', '1', '1', 'system:menu:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('33', '菜单新增', '7', '2', '', '', '', '0', '1', '3', '1', '1', 'system:menu:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('34', '菜单修改', '7', '3', '', '', '', '0', '1', '3', '1', '1', 'system:menu:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('35', '菜单删除', '7', '4', '', '', '', '0', '1', '3', '1', '1', 'system:menu:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('36', '部门查询', '8', '1', '', '', '', '0', '1', '3', '1', '1', 'system:dept:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('37', '部门新增', '8', '2', '', '', '', '0', '1', '3', '1', '1', 'system:dept:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('38', '部门修改', '8', '3', '', '', '', '0', '1', '3', '1', '1', 'system:dept:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('39', '部门删除', '8', '4', '', '', '', '0', '1', '3', '1', '1', 'system:dept:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('40', '岗位查询', '9', '1', '', '', '', '0', '1', '3', '1', '1', 'system:post:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('41', '岗位新增', '9', '2', '', '', '', '0', '1', '3', '1', '1', 'system:post:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('42', '岗位修改', '9', '3', '', '', '', '0', '1', '3', '1', '1', 'system:post:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('43', '岗位删除', '9', '4', '', '', '', '0', '1', '3', '1', '1', 'system:post:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('44', '岗位导出', '9', '5', '', '', '', '0', '1', '3', '1', '1', 'system:post:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('45', '参数查询', '10', '1', '#', '', '', '0', '1', '3', '1', '1', 'system:config:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('46', '参数新增', '10', '2', '#', '', '', '0', '1', '3', '1', '1', 'system:config:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('47', '参数修改', '10', '3', '#', '', '', '0', '1', '3', '1', '1', 'system:config:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('48', '参数删除', '10', '4', '#', '', '', '0', '1', '3', '1', '1', 'system:config:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('49', '参数导出', '10', '5', '#', '', '', '0', '1', '3', '1', '1', 'system:config:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('50', '公告查询', '11', '1', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('51', '公告新增', '11', '2', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:add', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('52', '公告修改', '11', '3', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:edit', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('53', '公告删除', '11', '4', '#', '', '', '0', '1', '3', '1', '1', 'system:notice:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('54', '操作查询', '18', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('55', '操作删除', '18', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('56', '日志导出', '18', '4', '#', '', '', '0', '1', '3', '1', '1', 'monitor:operlog:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('57', '登录查询', '19', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('58', '登录删除', '19', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:remove', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('59', '日志导出', '19', '3', '#', '', '', '0', '1', '3', '1', '1', 'monitor:logininfor:export', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('60', '在线查询', '13', '1', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:query', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('61', '批量强退', '13', '2', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:batchLogout', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
INSERT INTO `sys_menu` VALUES ('62', '单条强退', '13', '3', '#', '', '', '0', '1', '3', '1', '1', 'monitor:online:forceLogout', '#', '0', 'admin', '2022-05-21 08:30:54', null, '', null, '', '0');
-- ----------------------------
@@ -153,93 +132,91 @@ INSERT INTO `sys_notice` VALUES ('2', '维护通知2018-07-01 AgileBoot系统
INSERT INTO `sys_post` VALUES ('1', 'ceo', '董事长', '1', '1', '', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_post` VALUES ('2', 'se', '项目经理', '2', '1', '', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_post` VALUES ('3', 'hr', '人力资源', '3', '1', '', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
INSERT INTO `sys_post` VALUES ('4', 'user', '普通员工', '5', '0', '', null, 'admin', '2022-05-21 08:30:54', '1', 'admin', '2022-09-02 20:50:32', '0');
INSERT INTO `sys_post` VALUES ('4', 'user', '普通员工', '5', '0', '', null, 'admin', '2022-05-21 08:30:54', null, '', null, '0');
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES ('1', '超级管理员', 'admin', '1', '1', '', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '超级管理员', '0');
INSERT INTO `sys_role` VALUES ('2', '普通角色', 'common', '3', '2', '', '1', null, 'admin', '2022-05-21 08:30:54', '1', 'admin', '2022-09-22 19:38:45', '普通角色', '0');
INSERT INTO `sys_role` VALUES ('2', '普通角色', 'common', '3', '2', '', '1', null, 'admin', '2022-05-21 08:30:54', null, '', null, '普通角色', '0');
INSERT INTO `sys_role` VALUES ('3', '闲置角色', 'unused', '4', '2', '', '0', null, 'admin', '2022-05-21 08:30:54', null, '', null, '未使用的角色', '0');
-- ----------------------------
-- Records of sys_role_menu
-- ----------------------------
INSERT INTO `sys_role_menu` VALUES ('104', '1');
INSERT INTO `sys_role_menu` VALUES ('104', '103');
INSERT INTO `sys_role_menu` VALUES ('104', '104');
INSERT INTO `sys_role_menu` VALUES ('104', '1008');
INSERT INTO `sys_role_menu` VALUES ('104', '1010');
INSERT INTO `sys_role_menu` VALUES ('108', '1');
INSERT INTO `sys_role_menu` VALUES ('108', '2');
INSERT INTO `sys_role_menu` VALUES ('108', '3');
INSERT INTO `sys_role_menu` VALUES ('108', '100');
INSERT INTO `sys_role_menu` VALUES ('108', '101');
INSERT INTO `sys_role_menu` VALUES ('108', '102');
INSERT INTO `sys_role_menu` VALUES ('108', '103');
INSERT INTO `sys_role_menu` VALUES ('108', '104');
INSERT INTO `sys_role_menu` VALUES ('108', '106');
INSERT INTO `sys_role_menu` VALUES ('108', '107');
INSERT INTO `sys_role_menu` VALUES ('108', '108');
INSERT INTO `sys_role_menu` VALUES ('108', '109');
INSERT INTO `sys_role_menu` VALUES ('108', '111');
INSERT INTO `sys_role_menu` VALUES ('108', '112');
INSERT INTO `sys_role_menu` VALUES ('108', '113');
INSERT INTO `sys_role_menu` VALUES ('108', '116');
INSERT INTO `sys_role_menu` VALUES ('108', '500');
INSERT INTO `sys_role_menu` VALUES ('108', '501');
INSERT INTO `sys_role_menu` VALUES ('108', '1001');
INSERT INTO `sys_role_menu` VALUES ('108', '1002');
INSERT INTO `sys_role_menu` VALUES ('108', '1003');
INSERT INTO `sys_role_menu` VALUES ('108', '1004');
INSERT INTO `sys_role_menu` VALUES ('108', '1005');
INSERT INTO `sys_role_menu` VALUES ('108', '1006');
INSERT INTO `sys_role_menu` VALUES ('108', '1007');
INSERT INTO `sys_role_menu` VALUES ('108', '1008');
INSERT INTO `sys_role_menu` VALUES ('108', '1009');
INSERT INTO `sys_role_menu` VALUES ('108', '1010');
INSERT INTO `sys_role_menu` VALUES ('108', '1011');
INSERT INTO `sys_role_menu` VALUES ('108', '1012');
INSERT INTO `sys_role_menu` VALUES ('108', '1013');
INSERT INTO `sys_role_menu` VALUES ('108', '1014');
INSERT INTO `sys_role_menu` VALUES ('108', '1015');
INSERT INTO `sys_role_menu` VALUES ('108', '1016');
INSERT INTO `sys_role_menu` VALUES ('108', '1017');
INSERT INTO `sys_role_menu` VALUES ('108', '1018');
INSERT INTO `sys_role_menu` VALUES ('108', '1019');
INSERT INTO `sys_role_menu` VALUES ('108', '1020');
INSERT INTO `sys_role_menu` VALUES ('108', '1021');
INSERT INTO `sys_role_menu` VALUES ('108', '1022');
INSERT INTO `sys_role_menu` VALUES ('108', '1023');
INSERT INTO `sys_role_menu` VALUES ('108', '1024');
INSERT INTO `sys_role_menu` VALUES ('108', '1025');
INSERT INTO `sys_role_menu` VALUES ('108', '1031');
INSERT INTO `sys_role_menu` VALUES ('108', '1032');
INSERT INTO `sys_role_menu` VALUES ('108', '1033');
INSERT INTO `sys_role_menu` VALUES ('108', '1034');
INSERT INTO `sys_role_menu` VALUES ('108', '1035');
INSERT INTO `sys_role_menu` VALUES ('108', '1036');
INSERT INTO `sys_role_menu` VALUES ('108', '1037');
INSERT INTO `sys_role_menu` VALUES ('108', '1038');
INSERT INTO `sys_role_menu` VALUES ('108', '1039');
INSERT INTO `sys_role_menu` VALUES ('108', '1040');
INSERT INTO `sys_role_menu` VALUES ('108', '1041');
INSERT INTO `sys_role_menu` VALUES ('108', '1042');
INSERT INTO `sys_role_menu` VALUES ('108', '1043');
INSERT INTO `sys_role_menu` VALUES ('108', '1044');
INSERT INTO `sys_role_menu` VALUES ('108', '1045');
INSERT INTO `sys_role_menu` VALUES ('108', '1046');
INSERT INTO `sys_role_menu` VALUES ('108', '1047');
INSERT INTO `sys_role_menu` VALUES ('108', '1048');
INSERT INTO `sys_role_menu` VALUES ('108', '2000');
INSERT INTO `sys_role_menu` VALUES ('108', '2001');
INSERT INTO `sys_role_menu` VALUES ('2', '1');
INSERT INTO `sys_role_menu` VALUES ('2', '2');
INSERT INTO `sys_role_menu` VALUES ('2', '3');
INSERT INTO `sys_role_menu` VALUES ('2', '4');
INSERT INTO `sys_role_menu` VALUES ('2', '5');
INSERT INTO `sys_role_menu` VALUES ('2', '6');
INSERT INTO `sys_role_menu` VALUES ('2', '7');
INSERT INTO `sys_role_menu` VALUES ('2', '8');
INSERT INTO `sys_role_menu` VALUES ('2', '9');
INSERT INTO `sys_role_menu` VALUES ('2', '10');
INSERT INTO `sys_role_menu` VALUES ('2', '11');
INSERT INTO `sys_role_menu` VALUES ('2', '12');
INSERT INTO `sys_role_menu` VALUES ('2', '13');
INSERT INTO `sys_role_menu` VALUES ('2', '14');
INSERT INTO `sys_role_menu` VALUES ('2', '15');
INSERT INTO `sys_role_menu` VALUES ('2', '16');
INSERT INTO `sys_role_menu` VALUES ('2', '17');
INSERT INTO `sys_role_menu` VALUES ('2', '18');
INSERT INTO `sys_role_menu` VALUES ('2', '19');
INSERT INTO `sys_role_menu` VALUES ('2', '20');
INSERT INTO `sys_role_menu` VALUES ('2', '21');
INSERT INTO `sys_role_menu` VALUES ('2', '22');
INSERT INTO `sys_role_menu` VALUES ('2', '23');
INSERT INTO `sys_role_menu` VALUES ('2', '24');
INSERT INTO `sys_role_menu` VALUES ('2', '25');
INSERT INTO `sys_role_menu` VALUES ('2', '26');
INSERT INTO `sys_role_menu` VALUES ('2', '27');
INSERT INTO `sys_role_menu` VALUES ('2', '28');
INSERT INTO `sys_role_menu` VALUES ('2', '29');
INSERT INTO `sys_role_menu` VALUES ('2', '30');
INSERT INTO `sys_role_menu` VALUES ('2', '31');
INSERT INTO `sys_role_menu` VALUES ('2', '32');
INSERT INTO `sys_role_menu` VALUES ('2', '33');
INSERT INTO `sys_role_menu` VALUES ('2', '34');
INSERT INTO `sys_role_menu` VALUES ('2', '35');
INSERT INTO `sys_role_menu` VALUES ('2', '36');
INSERT INTO `sys_role_menu` VALUES ('2', '37');
INSERT INTO `sys_role_menu` VALUES ('2', '38');
INSERT INTO `sys_role_menu` VALUES ('2', '39');
INSERT INTO `sys_role_menu` VALUES ('2', '40');
INSERT INTO `sys_role_menu` VALUES ('2', '41');
INSERT INTO `sys_role_menu` VALUES ('2', '42');
INSERT INTO `sys_role_menu` VALUES ('2', '43');
INSERT INTO `sys_role_menu` VALUES ('2', '44');
INSERT INTO `sys_role_menu` VALUES ('2', '45');
INSERT INTO `sys_role_menu` VALUES ('2', '46');
INSERT INTO `sys_role_menu` VALUES ('2', '47');
INSERT INTO `sys_role_menu` VALUES ('2', '48');
INSERT INTO `sys_role_menu` VALUES ('2', '49');
INSERT INTO `sys_role_menu` VALUES ('2', '50');
INSERT INTO `sys_role_menu` VALUES ('2', '51');
INSERT INTO `sys_role_menu` VALUES ('2', '52');
INSERT INTO `sys_role_menu` VALUES ('2', '53');
INSERT INTO `sys_role_menu` VALUES ('2', '54');
INSERT INTO `sys_role_menu` VALUES ('2', '55');
INSERT INTO `sys_role_menu` VALUES ('2', '56');
INSERT INTO `sys_role_menu` VALUES ('2', '57');
INSERT INTO `sys_role_menu` VALUES ('2', '58');
INSERT INTO `sys_role_menu` VALUES ('2', '59');
INSERT INTO `sys_role_menu` VALUES ('2', '60');
INSERT INTO `sys_role_menu` VALUES ('2', '61');
-- roleId = 2的权限 特地少一个 方便测试
INSERT INTO `sys_role_menu` VALUES ('3', '1');
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES ('1', '1', '1', '103', 'admin', 'valarchie1', '0', 'agileboot@1631.com', '15888888889', '0', '/profile//avatar/20220814122428_blob_81ea3759fd45478ab0d875041afa5a28.jpeg', '$2a$10$rb1wRoEIkLbIknREEN1LH.FGs4g0oOS5t6l5LQ793nRaFO.SPHDHy', '1', '127.0.0.1', '2022-10-06 17:00:06', null, 'admin', '2022-05-21 08:30:54', '1', 'admin', '2022-10-06 17:00:06', '管理员', '0');
INSERT INTO `sys_user` VALUES ('2', '2', '2', '105', 'ag', 'valarchie', '0', 'agileboot@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '1', '127.0.0.1', '2022-05-21 08:30:54', null, 'admin', '2022-05-21 08:30:54', null, '', null, '测试员', '0');
INSERT INTO `sys_user` VALUES ('107', '3', '2', '104', 'ag12345', '测试', '0', '222@4234.com', '18859976673', '2', '', '12345678', '1', '', null, '1', 'admin', '2022-10-05 22:01:43', '1', 'admin', '2022-10-05 22:02:03', '12312312', '1');
INSERT INTO `sys_user` VALUES ('108', '1', '108', '101', 'ag888888', '23423423@42432.com', '0', '234452@42344aa.com', '18849976671', '2', '', '$2a$10$T/K2DSLtnr4yH9z98kx9AOUFlDf4QOBAwBjcY2WNFfDsNxR1NIv8u', '1', '127.0.0.1', '2022-10-05 22:54:41', '1', 'admin', '2022-10-05 22:26:31', '1', 'admin', '2022-10-05 22:54:41', '23424234234234', '0');
INSERT INTO `sys_user` VALUES ('1', '1', '1', '4', 'admin', 'valarchie1', '0', 'agileboot@163.com', '15888888889', '0', '/profile//avatar/20220814122428_blob_81ea3759fd45478ab0d875041afa5a28.jpeg', '$2a$10$rb1wRoEIkLbIknREEN1LH.FGs4g0oOS5t6l5LQ793nRaFO.SPHDHy', '1', '127.0.0.1', '2022-10-06 17:00:06', null, 'admin', '2022-05-21 08:30:54', '1', 'admin', '2022-10-06 17:00:06', '管理员', '0');
INSERT INTO `sys_user` VALUES ('2', '2', '2', '5', 'ag1', 'valarchie2', '0', 'agileboot1@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '1', '127.0.0.1', '2022-05-21 08:30:54', null, 'admin', '2022-05-21 08:30:54', null, '', null, '测试员1', '0');
INSERT INTO `sys_user` VALUES ('3', '2', '0', '5', 'ag2', 'valarchie3', '0', 'agileboot2@qq.com', '15666666667', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '1', '127.0.0.1', '2022-05-21 08:30:54', null, 'admin', '2022-05-21 08:30:54', null, '', null, '测试员2', '0');

View File

@@ -189,3 +189,4 @@ create table sys_user
deleted tinyint default 0 not null comment '删除标志0代表存在 1代表删除'
);
CREATE ALIAS FIND_IN_SET FOR "com.agileboot.infrastructure.mybatisplus.MySqlFunction.findInSet";

View File

@@ -0,0 +1,17 @@
package com.agileboot.infrastructure.mybatisplus;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class MySqlFunctionTest {
@Test
void find_in_set() {
String searchStr = ",2,4,5,9";
Assertions.assertTrue(MySqlFunction.findInSet("2", searchStr));
Assertions.assertTrue(MySqlFunction.findInSet("5", searchStr));
Assertions.assertTrue(MySqlFunction.findInSet("9", searchStr));
}
}

View File

@@ -21,18 +21,24 @@
<artifactId>agileboot-common</artifactId>
</dependency>
<!-- 核心模块-->
<!-- 核心模块 -->
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-infrastructure</artifactId>
</dependency>
<!-- 系统模块-->
<!-- 系统模块 -->
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-orm</artifactId>
</dependency>
<!-- 业务模块 -->
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-domain</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@@ -1,8 +1,6 @@
package com.agileboot.integrationtest.db;
import com.agileboot.integrationtest.IntegrationTestApplication;
import com.agileboot.orm.enums.SystemConfigEnum;
import com.agileboot.orm.service.ISysConfigService;
import com.agileboot.orm.service.ISysDeptService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -21,11 +19,49 @@ class SysDeptServiceImplTest {
@Test
@Rollback
void testCheckDeptNameUnique() {
boolean addWithSameName = deptService.checkDeptNameUnique("AgileBoot科技", null, null);
boolean updateWithSameName = deptService.checkDeptNameUnique("AgileBoot科技", 100L, null);
boolean addSameNameInParent = deptService.checkDeptNameUnique("深圳总公司", null, 100L);
void testIsDeptNameUnique() {
boolean addWithSame = deptService.isDeptNameUnique("AgileBoot科技", null, null);
boolean updateWithSame = deptService.isDeptNameUnique("AgileBoot科技", 1L, null);
boolean addSameInParent = deptService.isDeptNameUnique("深圳总公司", null, 1L);
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertFalse(addSameInParent);
}
@Test
@Rollback
void testHasChildDept() {
boolean hasChild = deptService.hasChildrenDept(3L, null);
boolean hasDisableChild = deptService.hasChildrenDept(3L, false);
Assertions.assertTrue(hasChild);
Assertions.assertTrue(hasDisableChild);
}
@Test
@Rollback
void testIsChildOfTheDept() {
boolean isIndirectChild = deptService.isChildOfTheDept(1L, 10L);
boolean isDirectChild = deptService.isChildOfTheDept(3L, 10L);
boolean isNotChild = deptService.isChildOfTheDept(5L, 10L);
Assertions.assertTrue(isIndirectChild);
Assertions.assertTrue(isDirectChild);
Assertions.assertFalse(isNotChild);
}
@Test
@Rollback
void testIsDeptAssignedToUsers() {
boolean notAssigned = deptService.isDeptAssignedToUsers(1L);
boolean isAssigned = deptService.isDeptAssignedToUsers(4L);
Assertions.assertFalse(notAssigned);
Assertions.assertTrue(isAssigned);
}

View File

@@ -0,0 +1,80 @@
package com.agileboot.integrationtest.db;
import cn.hutool.core.collection.CollUtil;
import com.agileboot.integrationtest.IntegrationTestApplication;
import com.agileboot.orm.entity.SysMenuEntity;
import com.agileboot.orm.enums.MenuTypeEnum;
import com.agileboot.orm.service.ISysMenuService;
import java.util.List;
import java.util.Objects;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = IntegrationTestApplication.class)
@RunWith(SpringRunner.class)
class SysMenuServiceImplTest {
@Autowired
ISysMenuService menuService;
@Test
@Rollback
void testGetMenuListByUserId() {
List<SysMenuEntity> menusMissingLastMenu = menuService.getMenuListByUserId(2L);
List<SysMenuEntity> allMenus = menuService.list();
Assertions.assertEquals(allMenus.size(), menusMissingLastMenu.size() + 1);
}
@Test
@Rollback
void testGetMenuIdsByRoleId() {
List<Long> menusMissingLastMenu = menuService.getMenuIdsByRoleId(2L);
List<SysMenuEntity> allMenus = menuService.list();
Assertions.assertEquals(allMenus.size(), menusMissingLastMenu.size() + 1);
}
@Test
@Rollback
void testIsMenuNameUnique() {
boolean addWithSame = menuService.isMenuNameUnique("用户管理", null, 1L);
boolean updateWithSame = menuService.isMenuNameUnique("用户管理", 5L, 1L);
boolean addWithoutSame = menuService.isMenuNameUnique("用户管理", null, 2L);
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testHasChildrenMenus() {
boolean hasChildrenMenu = menuService.hasChildrenMenu(5L);
boolean hasNotChildrenMenu = menuService.hasChildrenMenu(20L);
Assertions.assertTrue(hasChildrenMenu);
Assertions.assertFalse(hasNotChildrenMenu);
}
@Test
@Rollback
void testIsMenuAssignToRole() {
List<SysMenuEntity> allMenus = menuService.list();
boolean isAssignToRole = menuService.isMenuAssignToRoles(CollUtil.getFirst(allMenus).getMenuId());
// role2 默认不给最后一个权限 所以最后一个菜单无权限
boolean isNotAssignToRole = menuService.isMenuAssignToRoles(CollUtil.getLast(allMenus).getMenuId());
Assertions.assertFalse(isNotAssignToRole);
Assertions.assertTrue(isAssignToRole);
}
}

View File

@@ -0,0 +1,58 @@
package com.agileboot.integrationtest.db;
import com.agileboot.integrationtest.IntegrationTestApplication;
import com.agileboot.orm.service.ISysDeptService;
import com.agileboot.orm.service.ISysPostService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = IntegrationTestApplication.class)
@RunWith(SpringRunner.class)
class SysPostServiceImplTest {
@Autowired
ISysPostService postService;
@Test
@Rollback
void testIsPostNameUnique() {
boolean addWithSame = postService.isPostNameUnique(null, "董事长");
boolean updateWithSame = postService.isPostNameUnique(1L, "董事长");
boolean addWithoutSame = postService.isPostNameUnique(null, "董事长1");
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testIsPostCodeUnique() {
boolean addWithSame = postService.isPostCodeUnique(null, "ceo");
boolean updateWithSame = postService.isPostCodeUnique(1L, "ceo");
boolean addWithoutSame = postService.isPostCodeUnique(null, "ceo1");
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testIsAssignedToUsers() {
boolean assignedPost = postService.isAssignedToUsers(1L);
boolean unassignedPost = postService.isAssignedToUsers(3L);
Assertions.assertTrue(assignedPost);
Assertions.assertFalse(unassignedPost);
}
}

View File

@@ -0,0 +1,58 @@
package com.agileboot.integrationtest.db;
import com.agileboot.integrationtest.IntegrationTestApplication;
import com.agileboot.orm.service.ISysRoleService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = IntegrationTestApplication.class)
@RunWith(SpringRunner.class)
class SysRoleServiceImplTest {
@Autowired
ISysRoleService roleService;
@Test
@Rollback
void testIsRoleNameUnique() {
boolean addWithSame = roleService.isRoleNameUnique(null, "超级管理员");
boolean updateWithSame = roleService.isRoleNameUnique(1L, "超级管理员");
boolean addWithoutSame = roleService.isRoleNameUnique(null, "超级管理员1");
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testIsRoleCodeUnique() {
boolean addWithSame = roleService.isRoleKeyUnique(null, "admin");
boolean updateWithSame = roleService.isRoleKeyUnique(1L, "admin");
boolean addWithoutSame = roleService.isRoleKeyUnique(null, "admin1");
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testIsAssignedToUsers() {
boolean assignedRole = roleService.isAssignedToUsers(1L);
boolean unassignedRole = roleService.isAssignedToUsers(3L);
Assertions.assertTrue(assignedRole);
Assertions.assertFalse(unassignedRole);
}
}

View File

@@ -0,0 +1,148 @@
package com.agileboot.integrationtest.db;
import com.agileboot.domain.system.logininfo.query.SearchUserQuery;
import com.agileboot.domain.system.role.query.AllocatedRoleQuery;
import com.agileboot.domain.system.role.query.UnallocatedRoleQuery;
import com.agileboot.integrationtest.IntegrationTestApplication;
import com.agileboot.orm.entity.SysMenuEntity;
import com.agileboot.orm.entity.SysPostEntity;
import com.agileboot.orm.entity.SysRoleEntity;
import com.agileboot.orm.entity.SysUserEntity;
import com.agileboot.orm.result.SearchUserDO;
import com.agileboot.orm.service.ISysMenuService;
import com.agileboot.orm.service.ISysUserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = IntegrationTestApplication.class)
@RunWith(SpringRunner.class)
class SysUserServiceImplTest {
@Autowired
ISysUserService userService;
@Autowired
ISysMenuService menuService;
@Test
@Rollback
void testIsUserNameUnique() {
boolean isUnique = userService.isUserNameUnique("admin");
Assertions.assertTrue(isUnique);
}
@Test
@Rollback
void testIsPhoneUnique() {
boolean addWithSame = userService.isPhoneUnique("15888888889", null);
boolean updateWithSame = userService.isPhoneUnique("15888888889", 1L);
boolean addWithoutSame = userService.isPhoneUnique("15888888899", null);
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testIsEmailUnique() {
boolean addWithSame = userService.isEmailUnique("agileboot@163.com", null);
boolean updateWithSame = userService.isEmailUnique("agileboot@163.com", 1L);
boolean addWithoutSame = userService.isEmailUnique("agileboot@164.com", null);
Assertions.assertFalse(addWithSame);
Assertions.assertTrue(updateWithSame);
Assertions.assertTrue(addWithoutSame);
}
@Test
@Rollback
void testGetRoleOfUser() {
SysRoleEntity roleOfUser = userService.getRoleOfUser(1L);
Assertions.assertEquals(1L, roleOfUser.getRoleId());
Assertions.assertEquals("超级管理员", roleOfUser.getRoleName());
Assertions.assertEquals("admin", roleOfUser.getRoleKey());
}
@Test
@Rollback
void testGetPostOfUser() {
SysPostEntity postOfUser = userService.getPostOfUser(1L);
Assertions.assertEquals(1L, postOfUser.getPostId());
Assertions.assertEquals("董事长", postOfUser.getPostName());
Assertions.assertEquals("ceo", postOfUser.getPostCode());
}
@Test
@Rollback
void testGetMenuPermissionsForUsers() {
Set<String> permissionByUser = userService.getMenuPermissionsForUser(2L);
List<SysMenuEntity> allMenus = menuService.list();
Set<String> allPermissions = allMenus.stream().map(SysMenuEntity::getPerms).collect(Collectors.toSet());
Assertions.assertEquals(allPermissions.size() - 1, permissionByUser.size());
}
@Test
@Rollback
void testGetUserByUserName() {
SysUserEntity admin = userService.getUserByUserName("admin");
Assertions.assertEquals(1L, admin.getUserId());
Assertions.assertEquals(1L, admin.getRoleId());
Assertions.assertEquals(1L, admin.getPostId());
}
@Test
@Rollback
void testGetRoleAssignedUserList() {
AllocatedRoleQuery allocatedRoleQuery = new AllocatedRoleQuery();
allocatedRoleQuery.setRoleId(1L);
allocatedRoleQuery.setUsername("admin");
Page<SysUserEntity> roleAssignedPage = userService.getUserListByRole(allocatedRoleQuery);
Assertions.assertEquals(1, roleAssignedPage.getTotal());
Assertions.assertEquals("admin", roleAssignedPage.getRecords().get(0).getUsername());
}
@Test
@Rollback
void testGetRoleUnassignedUserList() {
UnallocatedRoleQuery unallocatedRoleQuery = new UnallocatedRoleQuery();
unallocatedRoleQuery.setRoleId(3L);
unallocatedRoleQuery.setUsername("ag2");
Page<SysUserEntity> roleAssignedPage = userService.getUserListByRole(unallocatedRoleQuery);
Assertions.assertEquals(1, roleAssignedPage.getTotal());
Assertions.assertEquals("ag2", roleAssignedPage.getRecords().get(0).getUsername());
}
@Test
@Rollback
void testGetUserList() {
SearchUserQuery searchUserQuery = new SearchUserQuery();
searchUserQuery.setUsername("a");
Page<SearchUserDO> userList = userService.getUserList(searchUserQuery);
Assertions.assertEquals(3, userList.getTotal());
Assertions.assertEquals("admin", userList.getRecords().get(0).getUsername());
}
}

View File

@@ -43,8 +43,7 @@ public interface SysMenuMapper extends BaseMapper<SysMenuEntity> {
+ " LEFT JOIN sys_role_menu rm ON m.menu_id = rm.menu_id "
+ "WHERE rm.role_id = #{roleId} "
+ " AND m.deleted = 0 "
+ "GROUP BY m.menu_id "
+ "ORDER BY m.parent_id, m.order_num")
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId);
+ "GROUP BY m.menu_id ")
List<Long> selectMenuIdsByRoleId(@Param("roleId") Long roleId);
}

View File

@@ -34,7 +34,7 @@ public interface SysUserMapper extends BaseMapper<SysUserEntity> {
+ " LEFT JOIN sys_user u ON u.role_id = r.role_id "
+ "WHERE r.deleted = 0 "
+ " AND u.user_id = #{userId}")
List<SysRoleEntity> selectRolesByUserId(Long userId);
List<SysRoleEntity> getRolesByUserId(Long userId);
/**
* 查询用户所属岗位组
@@ -47,8 +47,7 @@ public interface SysUserMapper extends BaseMapper<SysUserEntity> {
+ " LEFT JOIN sys_user u ON p.post_id = u.post_id "
+ "WHERE u.user_id = #{userId} "
+ " AND p.deleted = 0")
List<SysPostEntity> selectPostsByUserId(Long userId);
List<SysPostEntity> getPostsByUserId(Long userId);
/**
* 根据用户ID查询权限
@@ -64,22 +63,13 @@ public interface SysUserMapper extends BaseMapper<SysUserEntity> {
+ "WHERE m.status = 1 AND m.deleted = 0 "
+ " AND r.status = 1 AND r.deleted = 0 "
+ " AND u.user_id = #{userId}")
Set<String> selectMenuPermsByUserId(Long userId);
@Select("SELECT DISTINCT u.user_id, u.dept_id, u.username, u.nick_name, u.email "
+ " , u.phone_number, u.status, u.create_time "
+ "FROM sys_user u "
+ " LEFT JOIN sys_dept d ON u.dept_id = d.dept_id "
+ " LEFT JOIN sys_role r ON r.role_id = u.role_id "
+ " ${ew.customSqlSegment}")
List<SysUserEntity> selectRoleAssignedUserList(Page<SysUserEntity> page,
@Param(Constants.WRAPPER) Wrapper<SysUserEntity> queryWrapper);
Set<String> getMenuPermsByUserId(Long userId);
/**
* 根据条件分页查询未分配用户角色列表
*
* @return 用户信息集合信息
* 根据条件分页查询角色关联的用户列表
* @param page
* @param queryWrapper
* @return
*/
@Select("SELECT DISTINCT u.user_id, u.dept_id, u.username, u.nick_name, u.email "
+ " , u.phone_number, u.status, u.create_time "
@@ -87,7 +77,7 @@ public interface SysUserMapper extends BaseMapper<SysUserEntity> {
+ " LEFT JOIN sys_dept d ON u.dept_id = d.dept_id "
+ " LEFT JOIN sys_role r ON r.role_id = u.role_id"
+ " ${ew.customSqlSegment}")
List<SysUserEntity> selectRoleUnassignedUserList(Page<SysUserEntity> page,
Page<SysUserEntity> getUserListByRole(Page<SysUserEntity> page,
@Param(Constants.WRAPPER) Wrapper<SysUserEntity> queryWrapper);
/**
@@ -99,7 +89,7 @@ public interface SysUserMapper extends BaseMapper<SysUserEntity> {
+ "FROM sys_user u "
+ " LEFT JOIN sys_dept d ON u.dept_id = d.dept_id "
+ "${ew.customSqlSegment}")
List<SearchUserDO> selectUserList(Page<SearchUserDO> page,
Page<SearchUserDO> getUserList(Page<SearchUserDO> page,
@Param(Constants.WRAPPER) Wrapper<SearchUserDO> queryWrapper);
}

View File

@@ -21,17 +21,29 @@ public interface ISysDeptService extends IService<SysDeptEntity> {
* @param parentId
* @return
*/
boolean checkDeptNameUnique(String deptName, Long deptId, Long parentId);
boolean isDeptNameUnique(String deptName, Long deptId, Long parentId);
/**
* 检测部门底下是否还有正在使用中的子部门
* @param deptId
* @return
*/
boolean existChildrenDeptById(Long deptId, Boolean enabled);
boolean hasChildrenDept(Long deptId, Boolean enabled);
boolean isChildOfTheDept(Long ancestorId, Long childId);
/**
* 是否是目标部门的子部门
* @param parentId 目标部门id
* @param childId 子部门id
* @return
*/
boolean isChildOfTheDept(Long parentId, Long childId);
/**
* 检测该部门是否已有用户使用
* @param deptId
* @return
*/
boolean isDeptAssignedToUsers(Long deptId);
boolean hasDirectChildDept(Long deptId);
}

View File

@@ -20,7 +20,7 @@ public interface ISysMenuService extends IService<SysMenuEntity> {
* @param userId 用户ID
* @return 菜单列表
*/
List<SysMenuEntity> selectMenuListByUserId(Long userId);
List<SysMenuEntity> getMenuListByUserId(Long userId);
/**
* 根据角色ID查询菜单树信息
@@ -28,7 +28,7 @@ public interface ISysMenuService extends IService<SysMenuEntity> {
* @param roleId 角色ID
* @return 选中菜单列表
*/
List<Long> selectMenuListByRoleId(Long roleId);
List<Long> getMenuIdsByRoleId(Long roleId);
/**
* 校验菜单名称是否唯一
@@ -37,36 +37,22 @@ public interface ISysMenuService extends IService<SysMenuEntity> {
* @param parentId
* @return
*/
boolean checkMenuNameUnique(String menuName, Long menuId, Long parentId);
boolean isMenuNameUnique(String menuName, Long menuId, Long parentId);
/**
* 是否存在菜单子节点
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
boolean hasChildByMenuId(Long menuId);
boolean hasChildrenMenu(Long menuId);
/**
* 查询菜单是否存在角色
*
* @param menuId 菜单ID
* @return 结果 true 存在 false 不存在
*/
boolean checkMenuExistRole(Long menuId);
boolean isMenuAssignToRoles(Long menuId);
/**
*
* @param userId 用户ID
* @return 根据用户列出不含按钮的所有菜单
*/
List<SysMenuEntity> listMenuListWithoutButtonByUserId(Long userId);
/**
*
* @return 所有不带按钮的菜单
*/
List<SysMenuEntity> listMenuListWithoutButton();
}

View File

@@ -17,13 +17,13 @@ public interface ISysPostService extends IService<SysPostEntity> {
* 校验岗位名称
* @return 结果
*/
boolean checkPostNameUnique(Long postId, String postName);
boolean isPostNameUnique(Long postId, String postName);
/**
* 校验岗位编码
* @return 结果
*/
boolean checkPostCodeUnique(Long postId, String postCode);
boolean isPostCodeUnique(Long postId, String postCode);
/**
@@ -31,6 +31,6 @@ public interface ISysPostService extends IService<SysPostEntity> {
* @param postId 职位id
* @return
*/
boolean isAssignedToUser(Long postId);
boolean isAssignedToUsers(Long postId);
}

View File

@@ -18,13 +18,17 @@ public interface ISysRoleService extends IService<SysRoleEntity> {
* 校验角色名称是否唯一
* @return 结果
*/
boolean checkRoleNameUnique(Long roleId, String roleName);
boolean isRoleNameUnique(Long roleId, String roleName);
/**
* 校验角色权限是否唯一
* @return 结果
*/
boolean checkRoleKeyUnique(Long roleId, String roleKey);
boolean isRoleKeyUnique(Long roleId, String roleKey);
boolean isAssignedToUsers(Long roleId);
}

View File

@@ -19,63 +19,58 @@ import java.util.Set;
*/
public interface ISysUserService extends IService<SysUserEntity> {
boolean checkDeptExistUser(Long deptId);
boolean checkExistUserLinkToRole(Long roleId);
/**
* 校验用户名称是否唯一
*
* @param userName 用户名称
* @return 结果
*/
boolean checkUserNameUnique(String userName);
/**
* 根据用户ID查询用户所属角色组
*
* 检测号码是否唯一
* @param phone
* @param userId
* @return 结果
* @return
*/
boolean isPhoneUnique(String phone, Long userId);
/**
* 检测邮箱是否唯一
* @param email
* @param userId
* @return
*/
boolean isEmailUnique(String email, Long userId);
/**
* 检测用户名是否
* @param userName
* @return
*/
boolean isUserNameUnique(String userName);
/**
* 获取用户的角色
* @param userId
* @return
*/
SysRoleEntity getRoleOfUser(Long userId);
/**
* 根据用户ID查询用户所属岗位
*
* 获取用户的岗位
* @param userId
* @return 结果
* @return
*/
SysPostEntity getPostOfUser(Long userId);
/**
* 校验手机号码是否唯一
* @return 结果
* 获取用户的权限列表
* @param userId
* @return
*/
boolean checkPhoneUnique(String phone, Long userId);
Set<String> getMenuPermissionsForUser(Long userId);
/**
* 校验email是否唯一
* @return 结果
*/
boolean checkEmailUnique(String email, Long userId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
Set<String> selectMenuPermsByUserId(Long userId);
/**
* 通过用户名查询用户
*
* @param userName 用户名
* @return 用户对象信息
*/
SysUserEntity getUserByUserName(String userName);
Page<SysUserEntity> selectAllocatedList(AbstractPageQuery query);
/**
* 根据条件分页查询未分配用户角色列表
@@ -83,7 +78,7 @@ public interface ISysUserService extends IService<SysUserEntity> {
* @param query 查询参数
* @return 用户信息集合信息
*/
Page<SysUserEntity> selectUnallocatedList(AbstractPageQuery query);
Page<SysUserEntity> getUserListByRole(AbstractPageQuery query);
/**
* 根据条件分页查询用户列表
@@ -91,8 +86,7 @@ public interface ISysUserService extends IService<SysUserEntity> {
* @param query 查询参数
* @return 用户信息集合信息
*/
Page<SearchUserDO> selectUserList(AbstractPageQuery query);
Page<SearchUserDO> getUserList(AbstractPageQuery query);
}

View File

@@ -25,9 +25,9 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
if (StrUtil.isBlank(key)) {
return StrUtil.EMPTY;
}
QueryWrapper<SysConfigEntity> sysNoticeWrapper = new QueryWrapper<>();
sysNoticeWrapper.eq("config_key", key);
SysConfigEntity one = this.getOne(sysNoticeWrapper);
QueryWrapper<SysConfigEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("config_key", key);
SysConfigEntity one = this.getOne(queryWrapper);
if (one == null || one.getConfigValue() == null) {
return StrUtil.EMPTY;
}

View File

@@ -1,10 +1,13 @@
package com.agileboot.orm.service.impl;
import com.agileboot.orm.entity.SysDeptEntity;
import com.agileboot.orm.entity.SysUserEntity;
import com.agileboot.orm.mapper.SysDeptMapper;
import com.agileboot.orm.mapper.SysUserMapper;
import com.agileboot.orm.service.ISysDeptService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@@ -18,41 +21,45 @@ import org.springframework.stereotype.Service;
@Service
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDeptEntity> implements ISysDeptService {
@Autowired
private SysUserMapper userMapper;
@Override
public boolean checkDeptNameUnique(String deptName, Long deptId, Long parentId) {
public boolean isDeptNameUnique(String deptName, Long deptId, Long parentId) {
QueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("dept_name", deptName)
.ne(deptId != null, "dept_id", deptId)
.eq(parentId != null, "parent_id", parentId);
SysDeptEntity one = this.getOne(queryWrapper);
return one != null;
return !this.baseMapper.exists(queryWrapper);
}
@Override
public boolean existChildrenDeptById(Long deptId, Boolean enabled) {
public boolean hasChildrenDept(Long deptId, Boolean enabled) {
QueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq( "dept_id", deptId)
.eq(enabled != null, "status", 1)
.apply( "FIND_IN_SET (dept_id , ancestors)");
queryWrapper.eq(enabled != null, "status", 1)
.and(o -> o.eq("parent_id", deptId).or()
.apply("FIND_IN_SET (" + deptId + " , ancestors)")
);
return this.baseMapper.exists(queryWrapper);
}
@Override
public boolean isChildOfTheDept(Long ancestorId, Long childId) {
public boolean isChildOfTheDept(Long parentId, Long childId) {
QueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.apply("dept_id = '" + childId + "' or FIND_IN_SET ( " + ancestorId + " , ancestors)");
queryWrapper.apply("dept_id = '" + childId + "' and FIND_IN_SET ( " + parentId + " , ancestors)");
return this.baseMapper.exists(queryWrapper);
}
@Override
public boolean hasDirectChildDept(Long deptId) {
QueryWrapper<SysDeptEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(deptId != null, "parent_id", deptId);
return baseMapper.exists(queryWrapper);
}
@Override
public boolean isDeptAssignedToUsers(Long deptId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("dept_id", deptId);
return userMapper.exists(queryWrapper);
}
}

View File

@@ -1,5 +1,6 @@
package com.agileboot.orm.service.impl;
import cn.hutool.core.collection.ListUtil;
import com.agileboot.orm.entity.SysMenuEntity;
import com.agileboot.orm.entity.SysRoleMenuEntity;
import com.agileboot.orm.enums.MenuTypeEnum;
@@ -26,8 +27,6 @@ import org.springframework.stereotype.Service;
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenuEntity> implements ISysMenuService {
@Autowired
private SysRoleMapper roleMapper;
@Autowired
private SysRoleMenuMapper roleMenuMapper;
@@ -39,27 +38,27 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenuEntity
* @return 选中菜单列表
*/
@Override
public List<Long> selectMenuListByRoleId(Long roleId) {
return this.baseMapper.selectMenuListByRoleId(roleId);
public List<Long> getMenuIdsByRoleId(Long roleId) {
return this.baseMapper.selectMenuIdsByRoleId(roleId);
}
@Override
public boolean checkMenuNameUnique(String menuName, Long menuId, Long parentId) {
public boolean isMenuNameUnique(String menuName, Long menuId, Long parentId) {
QueryWrapper<SysMenuEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("menu_name", menuName)
.ne(menuId!=null, "menu_id", menuId)
.ne(menuId != null, "menu_id", menuId)
.eq(parentId != null, "parent_id", parentId);
return this.baseMapper.exists(queryWrapper);
return !this.baseMapper.exists(queryWrapper);
}
@Override
public boolean hasChildByMenuId(Long menuId) {
public boolean hasChildrenMenu(Long menuId) {
QueryWrapper<SysMenuEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", menuId);
return baseMapper.exists(queryWrapper);
}
/**
* 查询菜单使用数量
*
@@ -67,45 +66,18 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenuEntity
* @return 结果
*/
@Override
public boolean checkMenuExistRole(Long menuId) {
public boolean isMenuAssignToRoles(Long menuId) {
QueryWrapper<SysRoleMenuEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("menu_id", menuId);
return roleMenuMapper.exists(queryWrapper);
}
@Override
public List<SysMenuEntity> listMenuListWithoutButtonByUserId(Long userId) {
List<SysMenuEntity> sysMenuList = this.baseMapper.selectMenuListByUserId(userId);
if (sysMenuList == null) {
return null;
}
return sysMenuList.stream()
.filter(menu -> !Objects.equals(menu.getMenuType(), MenuTypeEnum.BUTTON.getValue()))
.collect(Collectors.toList());
}
@Override
public List<SysMenuEntity> listMenuListWithoutButton() {
List<SysMenuEntity> sysMenuList = this.list();
if (sysMenuList == null) {
return null;
}
return sysMenuList.stream()
.filter(menu -> !MenuTypeEnum.BUTTON.getValue().equals(menu.getMenuType()))
.collect(Collectors.toList());
}
@Override
public List<SysMenuEntity> selectMenuListByUserId(Long userId) {
public List<SysMenuEntity> getMenuListByUserId(Long userId) {
return baseMapper.selectMenuListByUserId(userId);
}
}

View File

@@ -31,24 +31,24 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity
* @return 结果
*/
@Override
public boolean checkPostNameUnique(Long postId, String postName) {
public boolean isPostNameUnique(Long postId, String postName) {
QueryWrapper<SysPostEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(postId != null, "post_id", postId)
.eq("post_name", postName);
return baseMapper.exists(queryWrapper);
return !baseMapper.exists(queryWrapper);
}
@Override
public boolean checkPostCodeUnique(Long postId, String postCode) {
public boolean isPostCodeUnique(Long postId, String postCode) {
QueryWrapper<SysPostEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(postId != null, "post_id", postId)
.eq("post_code", postCode);
return baseMapper.exists(queryWrapper);
return !baseMapper.exists(queryWrapper);
}
@Override
public boolean isAssignedToUser(Long postId) {
public boolean isAssignedToUsers(Long postId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("post_id", postId);
return userMapper.exists(queryWrapper);

View File

@@ -1,9 +1,12 @@
package com.agileboot.orm.service.impl;
import com.agileboot.orm.entity.SysRoleEntity;
import com.agileboot.orm.entity.SysUserEntity;
import com.agileboot.orm.mapper.SysRoleMapper;
import com.agileboot.orm.mapper.SysUserMapper;
import com.agileboot.orm.service.ISysRoleMenuService;
import com.agileboot.orm.service.ISysRoleService;
import com.agileboot.orm.service.ISysUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,22 +24,29 @@ import org.springframework.stereotype.Service;
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity> implements ISysRoleService {
@Autowired
ISysRoleMenuService roleMenuService;
private SysUserMapper userMapper;
@Override
public boolean checkRoleNameUnique(Long roleId, String roleName) {
public boolean isRoleNameUnique(Long roleId, String roleName) {
QueryWrapper<SysRoleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(roleId != null, "role_id", roleId)
.eq("role_name", roleName);
return this.baseMapper.exists(queryWrapper);
return !this.baseMapper.exists(queryWrapper);
}
@Override
public boolean checkRoleKeyUnique(Long roleId, String roleKey) {
public boolean isRoleKeyUnique(Long roleId, String roleKey) {
QueryWrapper<SysRoleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(roleId != null, "role_id", roleId)
.eq("role_key", roleKey);
return this.baseMapper.exists(queryWrapper);
return !this.baseMapper.exists(queryWrapper);
}
@Override
public boolean isAssignedToUsers(Long roleId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("role_id", roleId);
return userMapper.exists(queryWrapper);
}

View File

@@ -1,6 +1,5 @@
package com.agileboot.orm.service.impl;
import cn.hutool.core.util.StrUtil;
import com.agileboot.orm.entity.SysPostEntity;
import com.agileboot.orm.entity.SysRoleEntity;
import com.agileboot.orm.entity.SysUserEntity;
@@ -11,8 +10,6 @@ import com.agileboot.orm.service.ISysUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Service;
@@ -30,21 +27,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
@Override
public boolean checkDeptExistUser(Long deptId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("dept_id", deptId);
return this.count(queryWrapper) > 0;
}
@Override
public boolean checkExistUserLinkToRole(Long roleId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("role_id", roleId);
return this.count(queryWrapper) > 0;
}
@Override
public boolean checkUserNameUnique(String username) {
public boolean isUserNameUnique(String username) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username", username);
return this.baseMapper.exists(queryWrapper);
@@ -52,46 +35,43 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
@Override
public SysRoleEntity getRoleOfUser(Long userId) {
List<SysRoleEntity> list = baseMapper.selectRolesByUserId(userId);
return list.isEmpty() ? null : list.get(0);
}
@Override
public SysPostEntity getPostOfUser(Long userId) {
List<SysPostEntity> list = baseMapper.selectPostsByUserId(userId);
return list.isEmpty() ? null : list.get(0);
}
@Override
public boolean checkPhoneUnique(String phone, Long userId) {
public boolean isPhoneUnique(String phone, Long userId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(userId != null, "user_id", userId)
.eq("phone_number", phone);
return baseMapper.exists(queryWrapper);
return !baseMapper.exists(queryWrapper);
}
@Override
public boolean checkEmailUnique(String email, Long userId) {
public boolean isEmailUnique(String email, Long userId) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ne(userId != null, "user_id", userId)
.eq("email", email);
return baseMapper.exists(queryWrapper);
return !baseMapper.exists(queryWrapper);
}
@Override
public Set<String> selectMenuPermsByUserId(Long userId) {
Set<String> permissionStrList = baseMapper.selectMenuPermsByUserId(userId);
Set<String> singlePermsSet = new HashSet<>();
for (String perm : permissionStrList) {
if (StrUtil.isNotEmpty(perm)) {
singlePermsSet.addAll(Arrays.asList(perm.trim().split(",")));
}
}
return singlePermsSet;
public SysRoleEntity getRoleOfUser(Long userId) {
List<SysRoleEntity> list = baseMapper.getRolesByUserId(userId);
return list.isEmpty() ? null : list.get(0);
}
@Override
public SysPostEntity getPostOfUser(Long userId) {
List<SysPostEntity> list = baseMapper.getPostsByUserId(userId);
return list.isEmpty() ? null : list.get(0);
}
@Override
public Set<String> getMenuPermissionsForUser(Long userId) {
return baseMapper.getMenuPermsByUserId(userId);
}
@Override
public SysUserEntity getUserByUserName(String userName) {
QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
@@ -99,29 +79,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
return this.getOne(queryWrapper);
}
@SuppressWarnings("unchecked")
@Override
public Page<SysUserEntity> selectAllocatedList(AbstractPageQuery query) {
Page<SysUserEntity> page = query.toPage();
List<SysUserEntity> list = baseMapper.selectRoleAssignedUserList(page, query.toQueryWrapper());
page.setRecords(list);
return page;
public Page<SysUserEntity> getUserListByRole(AbstractPageQuery query) {
return baseMapper.getUserListByRole(query.toPage(), query.toQueryWrapper());
}
@Override
public Page<SysUserEntity> selectUnallocatedList(AbstractPageQuery query) {
Page<SysUserEntity> page = query.toPage();
List<SysUserEntity> list = baseMapper.selectRoleUnassignedUserList(page, query.toQueryWrapper());
page.setRecords(list);
return page;
}
@SuppressWarnings("unchecked")
@Override
public Page<SearchUserDO> selectUserList(AbstractPageQuery query) {
Page page = query.toPage();
List<SearchUserDO> searchUserDOS = baseMapper.selectUserList(page, query.toQueryWrapper());
page.setRecords(searchUserDOS);
return page;
public Page<SearchUserDO> getUserList(AbstractPageQuery query) {
return baseMapper.getUserList(query.toPage(), query.toQueryWrapper());
}
}