mirror of https://gitee.com/maxjhandsome/pig
✨ Introducing new features. closed #I470L8 优化原有用户信息查询逻辑
This commit is contained in:
parent
00b4e9ecc4
commit
4ab93eb991
|
@ -198,6 +198,7 @@ INSERT INTO `sys_menu` VALUES (1100, '用户管理', NULL, '/admin/user/index',
|
|||
INSERT INTO `sys_menu` VALUES (1101, '用户新增', 'sys_user_add', NULL, 1100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 09:52:09', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (1102, '用户修改', 'sys_user_edit', NULL, 1100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 09:52:48', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (1103, '用户删除', 'sys_user_del', NULL, 1100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 09:54:01', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (1104, '导入导出', 'sys_user_import_export', NULL, 1100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 09:54:01', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (1200, '菜单管理', NULL, '/admin/menu/index', 1000, 'icon-caidanguanli', NULL, 2, '0', '0', '0', NULL, '2017-11-08 09:57:27', NULL, '2020-03-12 00:13:52');
|
||||
INSERT INTO `sys_menu` VALUES (1201, '菜单新增', 'sys_menu_add', NULL, 1200, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 10:15:53', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (1202, '菜单修改', 'sys_menu_edit', NULL, 1200, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 10:16:23', NULL, '2021-05-25 06:48:34');
|
||||
|
@ -214,6 +215,7 @@ INSERT INTO `sys_menu` VALUES (1403, '部门删除', 'sys_dept_del', NULL, 1400,
|
|||
INSERT INTO `sys_menu` VALUES (2000, '系统管理', NULL, '/setting', -1, 'icon-xitongguanli', NULL, 1, '0', '0', '0', NULL, '2017-11-07 20:56:00', NULL, '2020-03-11 23:52:53');
|
||||
INSERT INTO `sys_menu` VALUES (2100, '日志管理', NULL, '/admin/log/index', 2000, 'icon-rizhiguanli', NULL, 5, '0', '0', '0', NULL, '2017-11-20 14:06:22', NULL, '2020-03-12 00:15:49');
|
||||
INSERT INTO `sys_menu` VALUES (2101, '日志删除', 'sys_log_del', NULL, 2100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-20 20:37:37', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (2102, '导入导出', 'sys_log_import_export', NULL, 2100, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-08 09:54:01', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (2200, '字典管理', NULL, '/admin/dict/index', 2000, 'icon-navicon-zdgl', NULL, 6, '0', '0', '0', NULL, '2017-11-29 11:30:52', NULL, '2020-03-12 00:15:58');
|
||||
INSERT INTO `sys_menu` VALUES (2201, '字典删除', 'sys_dict_del', NULL, 2200, NULL, NULL, 1, '0', '1', '0', NULL, '2017-11-29 11:30:11', NULL, '2021-05-25 06:48:34');
|
||||
INSERT INTO `sys_menu` VALUES (2202, '字典新增', 'sys_dict_add', NULL, 2200, NULL, NULL, 1, '0', '1', '0', NULL, '2018-05-11 22:34:55', NULL, '2021-05-25 06:48:34');
|
||||
|
@ -316,6 +318,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 1100);
|
|||
INSERT INTO `sys_role_menu` VALUES (1, 1101);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1102);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1103);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1104);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1200);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1201);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 1202);
|
||||
|
@ -332,6 +335,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 1403);
|
|||
INSERT INTO `sys_role_menu` VALUES (1, 2000);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2100);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2101);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2102);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2200);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2201);
|
||||
INSERT INTO `sys_role_menu` VALUES (1, 2202);
|
||||
|
|
|
@ -172,5 +172,4 @@ public class PigTokenEndpoint {
|
|||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
@ -44,6 +46,7 @@ public class SysLog extends BaseEntity {
|
|||
* 编号
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ExcelProperty("日志编号")
|
||||
@ApiModelProperty(value = "日志编号")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
@ -52,6 +55,7 @@ public class SysLog extends BaseEntity {
|
|||
* 日志类型
|
||||
*/
|
||||
@NotBlank(message = "日志类型不能为空")
|
||||
@ExcelProperty("日志类型(0-正常 9-错误)")
|
||||
@ApiModelProperty(value = "日志类型")
|
||||
private String type;
|
||||
|
||||
|
@ -59,54 +63,63 @@ public class SysLog extends BaseEntity {
|
|||
* 日志标题
|
||||
*/
|
||||
@NotBlank(message = "日志标题不能为空")
|
||||
@ExcelProperty("日志标题")
|
||||
@ApiModelProperty(value = "日志标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 操作IP地址
|
||||
*/
|
||||
@ExcelProperty("IP")
|
||||
@ApiModelProperty(value = "操作ip地址")
|
||||
private String remoteAddr;
|
||||
|
||||
/**
|
||||
* 用户浏览器
|
||||
*/
|
||||
@ExcelProperty("浏览器类型")
|
||||
@ApiModelProperty(value = "用户代理")
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* 请求URI
|
||||
*/
|
||||
@ExcelProperty("请求URI")
|
||||
@ApiModelProperty(value = "请求uri")
|
||||
private String requestUri;
|
||||
|
||||
/**
|
||||
* 操作方式
|
||||
*/
|
||||
@ExcelProperty("操作方式")
|
||||
@ApiModelProperty(value = "操作方式")
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 操作提交的数据
|
||||
*/
|
||||
@ExcelProperty("请求参数")
|
||||
@ApiModelProperty(value = "数据")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
@ExcelProperty("方法执行时间")
|
||||
@ApiModelProperty(value = "方法执行时间")
|
||||
private Long time;
|
||||
|
||||
/**
|
||||
* 异常信息
|
||||
*/
|
||||
@ExcelProperty("异常信息")
|
||||
@ApiModelProperty(value = "异常信息")
|
||||
private String exception;
|
||||
|
||||
/**
|
||||
* 服务ID
|
||||
*/
|
||||
@ExcelProperty("应用标识")
|
||||
@ApiModelProperty(value = "应用标识")
|
||||
private String serviceId;
|
||||
|
||||
|
@ -114,6 +127,7 @@ public class SysLog extends BaseEntity {
|
|||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@ExcelIgnore
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package com.pig4cloud.pig.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
||||
import com.pig4cloud.pig.admin.service.SysMenuService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
|
@ -27,7 +29,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -50,11 +51,10 @@ public class MenuController {
|
|||
*/
|
||||
@GetMapping
|
||||
public R getUserMenu(Integer parentId) {
|
||||
|
||||
// 获取符合条件的菜单
|
||||
Set<SysMenu> all = new HashSet<>();
|
||||
SecurityUtils.getRoles().forEach(roleId -> all.addAll(sysMenuService.findMenuByRoleId(roleId)));
|
||||
return R.ok(sysMenuService.filterMenu(all, parentId));
|
||||
Set<SysMenu> sysMenuList = sysMenuService
|
||||
.findMenuByRoleId(CollUtil.join(SecurityUtils.getRoles(), StrUtil.COMMA));
|
||||
return R.ok(sysMenuService.filterMenu(sysMenuList, parentId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,8 +75,8 @@ public class MenuController {
|
|||
*/
|
||||
@GetMapping("/tree/{roleId}")
|
||||
public R getRoleTree(@PathVariable Integer roleId) {
|
||||
return R.ok(
|
||||
sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList()));
|
||||
return R.ok(sysMenuService.findMenuByRoleId(String.valueOf(roleId)).stream().map(SysMenu::getMenuId)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -38,13 +38,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||
* @param roleId 角色ID
|
||||
* @return
|
||||
*/
|
||||
List<SysMenu> listMenusByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询权限
|
||||
* @param roleIds Ids
|
||||
* @return
|
||||
*/
|
||||
List<String> listPermissionsByRoleIds(String roleIds);
|
||||
Set<SysMenu> listMenusByRoleId(String roleIds);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,4 +60,11 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*/
|
||||
UserVO getUserVoById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
* @param userDTO 查询条件
|
||||
* @return
|
||||
*/
|
||||
List<UserVO> selectVoList(@Param("query") UserDTO userDTO);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志表 服务类
|
||||
|
@ -37,6 +39,13 @@ public interface SysLogService extends IService<SysLog> {
|
|||
* @param sysLog
|
||||
* @return
|
||||
*/
|
||||
Page getLogByPage(Page page, SysLogDTO sysLog);
|
||||
Page<SysLog> getLogByPage(Page page, SysLogDTO sysLog);
|
||||
|
||||
/**
|
||||
* 列表查询日志
|
||||
* @param sysLog 查询条件
|
||||
* @return List
|
||||
*/
|
||||
List<SysLog> getLogList(SysLogDTO sysLog);
|
||||
|
||||
}
|
||||
|
|
|
@ -35,10 +35,10 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||
|
||||
/**
|
||||
* 通过角色编号查询URL 权限
|
||||
* @param roleId 角色ID
|
||||
* @param roleIds 角色ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
List<SysMenu> findMenuByRoleId(Integer roleId);
|
||||
Set<SysMenu> findMenuByRoleId(String roleIds);
|
||||
|
||||
/**
|
||||
* 级联删除菜单
|
||||
|
|
|
@ -19,8 +19,6 @@ package com.pig4cloud.pig.admin.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
@ -31,13 +29,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysRoleService extends IService<SysRole> {
|
||||
|
||||
/**
|
||||
* 通过用户ID,查询角色信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SysRole> findRolesByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID,删除角色
|
||||
* @param id
|
||||
|
|
|
@ -29,13 +29,4 @@ import com.pig4cloud.pig.admin.api.entity.SysUserRole;
|
|||
*/
|
||||
public interface SysUserRoleService extends IService<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 根据用户Id删除该用户的角色关系
|
||||
* @param userId 用户ID
|
||||
* @return boolean
|
||||
* @author 寻欢·李
|
||||
* @date 2017年12月7日 16:31:38
|
||||
*/
|
||||
Boolean removeRoleByUserId(Integer userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -143,6 +145,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
treeNode.setId(dept.getDeptId());
|
||||
treeNode.setParentId(dept.getParentId());
|
||||
treeNode.setName(dept.getName());
|
||||
treeNode.setWeight(dept.getSort());
|
||||
// 扩展属性
|
||||
Map<String, Object> extra = new HashMap<>(4);
|
||||
extra.put("createTime", dept.getCreateTime());
|
||||
treeNode.setExtra(extra);
|
||||
return treeNode;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ import com.pig4cloud.pig.admin.mapper.SysLogMapper;
|
|||
import com.pig4cloud.pig.admin.service.SysLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志表 服务实现类
|
||||
|
@ -41,6 +43,25 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||
|
||||
@Override
|
||||
public Page getLogByPage(Page page, SysLogDTO sysLog) {
|
||||
return baseMapper.selectPage(page, buildQueryWrapper(sysLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询日志
|
||||
* @param sysLog 查询条件
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List getLogList(SysLogDTO sysLog) {
|
||||
return baseMapper.selectList(buildQueryWrapper(sysLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询的 wrapper
|
||||
* @param sysLog 查询条件
|
||||
* @return LambdaQueryWrapper
|
||||
*/
|
||||
private LambdaQueryWrapper buildQueryWrapper(SysLogDTO sysLog) {
|
||||
LambdaQueryWrapper<SysLog> wrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(sysLog.getType())) {
|
||||
wrapper.eq(SysLog::getType, sysLog.getType());
|
||||
|
@ -51,7 +72,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
|||
sysLog.getCreateTime()[1]);
|
||||
}
|
||||
|
||||
return baseMapper.selectPage(page, wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysMenu;
|
||||
|
@ -60,9 +61,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")
|
||||
public List<SysMenu> findMenuByRoleId(Integer roleId) {
|
||||
return baseMapper.listMenusByRoleId(roleId);
|
||||
@Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleIds + '_menu'", unless = "#result == null")
|
||||
public Set<SysMenu> findMenuByRoleId(String roleIds) {
|
||||
return baseMapper.listMenusByRoleId(roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,8 +126,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
@Override
|
||||
public List<Tree<Integer>> filterMenu(Set<SysMenu> all, Integer parentId) {
|
||||
List<TreeNode<Integer>> collect = all.stream()
|
||||
.filter(menu -> MenuTypeEnum.LEFT_MENU.getType().equals(menu.getType())).map(getNodeFunction())
|
||||
.collect(Collectors.toList());
|
||||
.filter(menu -> MenuTypeEnum.LEFT_MENU.getType().equals(menu.getType()))
|
||||
.filter(menu -> StrUtil.isNotBlank(menu.getPath())).map(getNodeFunction()).collect(Collectors.toList());
|
||||
Integer parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId;
|
||||
return TreeUtil.build(collect, parent);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|||
if (StrUtil.isBlank(menuIds)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
List<SysRoleMenu> roleMenuList = Arrays.stream(menuIds.split(",")).map(menuId -> {
|
||||
List<SysRoleMenu> roleMenuList = Arrays.stream(menuIds.split(StrUtil.COMMA)).map(menuId -> {
|
||||
SysRoleMenu roleMenu = new SysRoleMenu();
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenuId(Integer.valueOf(menuId));
|
||||
|
|
|
@ -29,8 +29,6 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
|
@ -45,16 +43,6 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
|
||||
private final SysRoleMenuMapper sysRoleMenuMapper;
|
||||
|
||||
/**
|
||||
* 通过用户ID,查询角色信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> findRolesByUserId(Integer userId) {
|
||||
return baseMapper.listRolesByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID,删除角色,并清空角色菜单缓存
|
||||
* @param id
|
||||
|
|
|
@ -33,16 +33,4 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
|
||||
|
||||
/**
|
||||
* 根据用户Id删除该用户的角色关系
|
||||
* @param userId 用户ID
|
||||
* @return boolean
|
||||
* @author 寻欢·李
|
||||
* @date 2017年12月7日 16:31:38
|
||||
*/
|
||||
@Override
|
||||
public Boolean removeRoleByUserId(Integer userId) {
|
||||
return baseMapper.deleteByUserId(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,22 +37,14 @@
|
|||
<!--通过角色查询菜单信息-->
|
||||
<select id="listMenusByRoleId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
sys_menu.*
|
||||
sys_menu.*
|
||||
FROM
|
||||
sys_menu
|
||||
sys_menu
|
||||
LEFT JOIN sys_role_menu ON sys_menu.menu_id = sys_role_menu.menu_id
|
||||
WHERE
|
||||
sys_menu.del_flag = 0
|
||||
AND sys_role_menu.role_id = #{roleId}
|
||||
sys_menu.del_flag = 0
|
||||
AND sys_role_menu.role_id IN (#{roleIds})
|
||||
ORDER BY
|
||||
sys_menu.sort DESC
|
||||
</select>
|
||||
|
||||
<!--通过角色ID 查询权限-->
|
||||
<select id="listPermissionsByRoleIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
m.permission
|
||||
FROM
|
||||
sys_menu m, sys_role_menu rm WHERE m.menu_id = rm.menu_id AND m.del_flag = 0 AND rm.role_id IN (#{roleIds})
|
||||
</select>
|
||||
sys_menu.sort DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -149,4 +149,33 @@
|
|||
</where>
|
||||
ORDER BY `user`.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectVoList" resultMap="baseResultMap">
|
||||
SELECT
|
||||
u.user_id,
|
||||
u.username,
|
||||
u.password,
|
||||
u.salt,
|
||||
u.phone,
|
||||
u.avatar,
|
||||
u.dept_id,
|
||||
u.create_time ucreate_time,
|
||||
u.update_time uupdate_time,
|
||||
u.del_flag,
|
||||
u.lock_flag,
|
||||
d.name AS deptName
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_dept d ON d.dept_id = u.dept_id
|
||||
<where>
|
||||
u.del_flag = '0'
|
||||
<if test="query.username != null and query.username != ''">
|
||||
AND u.username LIKE CONCAT('%',#{query.username},'%')
|
||||
</if>
|
||||
<if test="query.deptId != null and query.deptId != ''">
|
||||
AND u.dept_id = #{query.deptId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY u.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -40,7 +40,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<spring-boot-admin.version>2.5.0</spring-boot-admin.version>
|
||||
<spring-boot-admin.version>2.5.1</spring-boot-admin.version>
|
||||
<hutool.version>5.7.9</hutool.version>
|
||||
<mybatis-plus.version>3.4.3.2</mybatis-plus.version>
|
||||
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
||||
|
|
Loading…
Reference in New Issue