1
This commit is contained in:
@@ -36,8 +36,8 @@ buildNumber.properties
|
|||||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
||||||
.mvn/wrapper/maven-wrapper.jar
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
### Example user template template
|
### Example userDetail template template
|
||||||
### Example user template
|
### Example userDetail template
|
||||||
|
|
||||||
# IntelliJ project files
|
# IntelliJ project files
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package cn.fateverse.admin.dto;
|
package cn.fateverse.admin.dto;
|
||||||
|
|
||||||
import cn.fateverse.common.core.entity.UserBase;
|
import cn.fateverse.common.core.entity.User;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -83,8 +83,8 @@ public class UserDto{
|
|||||||
private List<Long> roleIds;
|
private List<Long> roleIds;
|
||||||
|
|
||||||
|
|
||||||
public UserBase toUser() {
|
public User toUser() {
|
||||||
return UserBase.builder()
|
return User.builder()
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
.deptId(deptId)
|
.deptId(deptId)
|
||||||
.userName(userName)
|
.userName(userName)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package cn.fateverse.admin.dubbo;
|
package cn.fateverse.admin.dubbo;
|
||||||
|
|
||||||
import cn.fateverse.common.core.entity.User;
|
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ public interface DubboUserService {
|
|||||||
* @param username 用户名称
|
* @param username 用户名称
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
User getUserByUsername(String username);
|
UserVo getUserByUsername(String username);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id查询用户信息
|
* 根据用户id查询用户信息
|
||||||
@@ -25,7 +26,7 @@ public interface DubboUserService {
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
User getUserByUserId(Long userId);
|
UserVo getUserByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据roleId查询用户列表
|
* 根据roleId查询用户列表
|
||||||
@@ -57,4 +58,12 @@ public interface DubboUserService {
|
|||||||
* @return 所有用户的id
|
* @return 所有用户的id
|
||||||
*/
|
*/
|
||||||
List<Long> searchAllUserIds();
|
List<Long> searchAllUserIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名获取用户详细信息
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @return {@link UserDetails }
|
||||||
|
*/
|
||||||
|
UserDetail getUserDetailsByUserName(String userName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cn.fateverse.admin.vo;
|
package cn.fateverse.admin.vo;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.Role;
|
import cn.fateverse.common.core.entity.Dept;
|
||||||
import cn.fateverse.admin.entity.Dept;
|
import cn.fateverse.common.core.entity.Role;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cn.fateverse.admin.vo;
|
package cn.fateverse.admin.vo;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.User;
|
|
||||||
import cn.fateverse.common.core.entity.Option;
|
import cn.fateverse.common.core.entity.Option;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -14,11 +14,10 @@ import java.util.List;
|
|||||||
* @date 2022/11/4
|
* @date 2022/11/4
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
|
||||||
@ApiModel("用户详细信息")
|
@ApiModel("用户详细信息")
|
||||||
public class UserDetailVo {
|
public class UserDetailVo {
|
||||||
@ApiModelProperty("用户基本细腻系")
|
@ApiModelProperty("用户基本细腻系")
|
||||||
private User user;
|
private UserDetail user;
|
||||||
|
|
||||||
@ApiModelProperty("用户所在的岗位")
|
@ApiModelProperty("用户所在的岗位")
|
||||||
private List<Long> postIds;
|
private List<Long> postIds;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.fateverse.admin.controller;
|
|||||||
import cn.fateverse.admin.dto.RoleDto;
|
import cn.fateverse.admin.dto.RoleDto;
|
||||||
import cn.fateverse.admin.entity.Role;
|
import cn.fateverse.admin.entity.Role;
|
||||||
import cn.fateverse.admin.entity.User;
|
import cn.fateverse.admin.entity.User;
|
||||||
|
import cn.fateverse.admin.facade.RoleFacade;
|
||||||
import cn.fateverse.admin.query.RoleQuery;
|
import cn.fateverse.admin.query.RoleQuery;
|
||||||
import cn.fateverse.admin.vo.RoleVo;
|
import cn.fateverse.admin.vo.RoleVo;
|
||||||
import cn.fateverse.common.core.entity.IdWrapper;
|
import cn.fateverse.common.core.entity.IdWrapper;
|
||||||
@@ -23,6 +24,7 @@ import cn.fateverse.common.log.annotation.Log;
|
|||||||
import cn.fateverse.common.log.enums.BusinessType;
|
import cn.fateverse.common.log.enums.BusinessType;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -38,30 +40,21 @@ import java.util.Set;
|
|||||||
@Api(tags = "角色管理")
|
@Api(tags = "角色管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/role")
|
@RequestMapping("/role")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class RoleController {
|
public class RoleController {
|
||||||
|
|
||||||
|
|
||||||
private final RoleService roleService;
|
private final RoleFacade roleFacade;
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
private final MenuService menuService;
|
private final MenuService menuService;
|
||||||
|
|
||||||
private final TokenService tokenService;
|
private final TokenService tokenService;
|
||||||
|
|
||||||
public RoleController(RoleService roleService, UserService userService, MenuService menuService, TokenService tokenService) {
|
|
||||||
this.roleService = roleService;
|
|
||||||
this.userService = userService;
|
|
||||||
this.menuService = menuService;
|
|
||||||
this.tokenService = tokenService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("获取角色列表")
|
@ApiOperation("获取角色列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@PreAuthorize("@ss.hasPermission('admin:role:list')")
|
@PreAuthorize("@ss.hasPermission('admin:role:list')")
|
||||||
public Result<TableDataInfo<RoleVo>> list(RoleQuery query) {
|
public Result<TableDataInfo<RoleVo>> list(RoleQuery query) {
|
||||||
TableDataInfo<RoleVo> dataInfo = roleService.searchList(query);
|
TableDataInfo<RoleVo> dataInfo = roleFacade.searchList(query);
|
||||||
return Result.ok(dataInfo);
|
return Result.ok(dataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,30 +63,30 @@ public class RoleController {
|
|||||||
@GetMapping("/{roleId}")
|
@GetMapping("/{roleId}")
|
||||||
@PreAuthorize("@ss.hasPermission('admin:role:info')")
|
@PreAuthorize("@ss.hasPermission('admin:role:info')")
|
||||||
public Result<RoleVo> info(@PathVariable Long roleId) {
|
public Result<RoleVo> info(@PathVariable Long roleId) {
|
||||||
checkRoleId(roleId);
|
RoleVo vo = roleFacade.searchById(roleId);
|
||||||
RoleVo vo = roleService.searchById(roleId);
|
|
||||||
return Result.ok(vo);
|
return Result.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("根据菜单id获取角色列表")
|
@ApiOperation("根据菜单id获取角色列表")
|
||||||
@GetMapping("/menu/list")
|
@GetMapping("/menu/list")
|
||||||
public Result<TableDataInfo<RoleVo>> roleExcludeMenuId(Long menuId, String roleName, String roleKey) {
|
public Result<TableDataInfo<RoleVo>> roleExcludeMenuId(@RequestParam Long menuId,
|
||||||
if (ObjectUtils.isEmpty(menuId)) {
|
@RequestParam String roleName,
|
||||||
return Result.error("菜单id不能为空!");
|
@RequestParam String roleKey) {
|
||||||
}
|
TableDataInfo<RoleVo> dataInfo = roleFacade.searchListExcludeMenuId(menuId, roleName, roleKey);
|
||||||
TableDataInfo<RoleVo> dataInfo = roleService.searchListExcludeMenuId(menuId, roleName, roleKey);
|
|
||||||
return Result.ok(dataInfo);
|
return Result.ok(dataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("根据菜单id获取分配的角色信息")
|
@ApiOperation("根据菜单id获取分配的角色信息")
|
||||||
@GetMapping("/menu")
|
@GetMapping("/menu")
|
||||||
public Result<TableDataInfo<RoleVo>> menuRole(Long menuId, String roleName, String roleKey) {
|
public Result<TableDataInfo<RoleVo>> menuRole(@RequestParam Long menuId,
|
||||||
|
@RequestParam String roleName,
|
||||||
|
@RequestParam String roleKey) {
|
||||||
if (ObjectUtils.isEmpty(menuId)) {
|
if (ObjectUtils.isEmpty(menuId)) {
|
||||||
return Result.error("菜单id不能为空!");
|
return Result.error("菜单id不能为空!");
|
||||||
}
|
}
|
||||||
TableDataInfo<RoleVo> dataInfo = roleService.searchListByMenuId(menuId, roleName, roleKey);
|
TableDataInfo<RoleVo> dataInfo = roleFacade.searchListByMenuId(menuId, roleName, roleKey);
|
||||||
return Result.ok(dataInfo);
|
return Result.ok(dataInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +98,7 @@ public class RoleController {
|
|||||||
public Result<Void> bindRole(@RequestBody IdWrapper wrapper) {
|
public Result<Void> bindRole(@RequestBody IdWrapper wrapper) {
|
||||||
checkRoleIds(wrapper.getIds());
|
checkRoleIds(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
||||||
roleService.bindMenu(wrapper.getId(), wrapper.getIds());
|
roleFacade.bindMenu(wrapper.getId(), wrapper.getIds());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +110,7 @@ public class RoleController {
|
|||||||
public Result<Void> unBindMenu(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindMenu(@RequestBody IdWrapper wrapper) {
|
||||||
checkRoleIds(wrapper.getIds());
|
checkRoleIds(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
||||||
roleService.unBindMenu(wrapper.getId(), wrapper.getIds());
|
roleFacade.unBindMenu(wrapper.getId(), wrapper.getIds());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +120,7 @@ public class RoleController {
|
|||||||
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
||||||
public Result<Void> unBindAllMenu(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindAllMenu(@RequestBody IdWrapper wrapper) {
|
||||||
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
LongUtils.checkId(wrapper.getId(), "菜单id不能为空");
|
||||||
roleService.unBindAllMenu(wrapper.getId());
|
roleFacade.unBindAllMenu(wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +128,7 @@ public class RoleController {
|
|||||||
@ApiOperation("查询角色信息")
|
@ApiOperation("查询角色信息")
|
||||||
@GetMapping("/option")
|
@GetMapping("/option")
|
||||||
public Result<List<Option>> option() {
|
public Result<List<Option>> option() {
|
||||||
List<Option> option = roleService.searchOption();
|
List<Option> option = roleFacade.searchOption();
|
||||||
return Result.ok(option);
|
return Result.ok(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +139,7 @@ public class RoleController {
|
|||||||
@PreAuthorize("@ss.hasPermission('admin:role:add')")
|
@PreAuthorize("@ss.hasPermission('admin:role:add')")
|
||||||
public Result<Void> add(@RequestBody @Validated RoleDto role) {
|
public Result<Void> add(@RequestBody @Validated RoleDto role) {
|
||||||
checkNameAndKey(role);
|
checkNameAndKey(role);
|
||||||
roleService.save(role);
|
roleFacade.save(role);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +150,7 @@ public class RoleController {
|
|||||||
public Result<Void> edit(@NotNull @RequestBody @Validated RoleDto role) {
|
public Result<Void> edit(@NotNull @RequestBody @Validated RoleDto role) {
|
||||||
checkRoleId(role.getRoleId());
|
checkRoleId(role.getRoleId());
|
||||||
checkNameAndKey(role);
|
checkNameAndKey(role);
|
||||||
roleService.edit(role);
|
roleFacade.edit(role);
|
||||||
checkUserRoleUpdate(role);
|
checkUserRoleUpdate(role);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
@@ -173,7 +166,7 @@ public class RoleController {
|
|||||||
if (StrUtil.isEmpty(role.getState())) {
|
if (StrUtil.isEmpty(role.getState())) {
|
||||||
return Result.error("状态不能为空!");
|
return Result.error("状态不能为空!");
|
||||||
}
|
}
|
||||||
roleService.editState(role.getRoleId(), role.getState());
|
roleFacade.editState(role.getRoleId(), role.getState());
|
||||||
checkUserRoleUpdate(role);
|
checkUserRoleUpdate(role);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
@@ -185,7 +178,7 @@ public class RoleController {
|
|||||||
@PreAuthorize("@ss.hasPermission('admin:role:del')")
|
@PreAuthorize("@ss.hasPermission('admin:role:del')")
|
||||||
public Result<Void> delete(@PathVariable Long roleId) {
|
public Result<Void> delete(@PathVariable Long roleId) {
|
||||||
checkRoleId(roleId);
|
checkRoleId(roleId);
|
||||||
roleService.remove(roleId);
|
roleFacade.remove(roleId);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,10 +206,10 @@ public class RoleController {
|
|||||||
* 检查角色名称和角色关键词
|
* 检查角色名称和角色关键词
|
||||||
*/
|
*/
|
||||||
private void checkNameAndKey(RoleDto dto) {
|
private void checkNameAndKey(RoleDto dto) {
|
||||||
if (roleService.checkNameUnique(dto)) {
|
if (roleFacade.checkNameUnique(dto)) {
|
||||||
throw new CustomException("角色名称已存在!");
|
throw new CustomException("角色名称已存在!");
|
||||||
}
|
}
|
||||||
if (roleService.checkRoleKeyUnique(dto)) {
|
if (roleFacade.checkRoleKeyUnique(dto)) {
|
||||||
throw new CustomException("角色权限名称已存在!");
|
throw new CustomException("角色权限名称已存在!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,27 @@
|
|||||||
package cn.fateverse.admin.controller;
|
package cn.fateverse.admin.controller;
|
||||||
|
|
||||||
import cn.fateverse.admin.dto.UserDto;
|
import cn.fateverse.admin.dto.UserDto;
|
||||||
|
import cn.fateverse.admin.facade.RoleFacade;
|
||||||
|
import cn.fateverse.admin.facade.UserFacade;
|
||||||
import cn.fateverse.admin.query.UserQuery;
|
import cn.fateverse.admin.query.UserQuery;
|
||||||
|
import cn.fateverse.admin.service.PostService;
|
||||||
import cn.fateverse.admin.vo.UserChooseVo;
|
import cn.fateverse.admin.vo.UserChooseVo;
|
||||||
import cn.fateverse.admin.vo.UserDetailVo;
|
import cn.fateverse.admin.vo.UserDetailVo;
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
import cn.fateverse.common.core.entity.IdWrapper;
|
import cn.fateverse.common.core.entity.IdWrapper;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.fateverse.admin.service.PostService;
|
|
||||||
import cn.fateverse.admin.service.RoleService;
|
|
||||||
import cn.fateverse.admin.service.UserService;
|
|
||||||
import cn.fateverse.common.core.entity.Option;
|
import cn.fateverse.common.core.entity.Option;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
import cn.fateverse.common.core.result.Result;
|
import cn.fateverse.common.core.result.Result;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.LongUtils;
|
import cn.fateverse.common.core.utils.LongUtils;
|
||||||
import cn.fateverse.common.security.annotation.Anonymity;
|
|
||||||
import cn.fateverse.common.log.annotation.Log;
|
import cn.fateverse.common.log.annotation.Log;
|
||||||
import cn.fateverse.common.log.enums.BusinessType;
|
import cn.fateverse.common.log.enums.BusinessType;
|
||||||
import cn.fateverse.common.mybatis.utils.PageUtils;
|
import cn.fateverse.common.mybatis.utils.PageUtils;
|
||||||
|
import cn.fateverse.common.security.annotation.Anonymity;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -37,31 +38,20 @@ import java.util.regex.Pattern;
|
|||||||
@Api(tags = "用户管理")
|
@Api(tags = "用户管理")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserFacade userFacade;
|
||||||
|
private final RoleFacade roleFacade;
|
||||||
private final RoleService roleService;
|
|
||||||
|
|
||||||
private final PostService postService;
|
private final PostService postService;
|
||||||
|
|
||||||
public UserController(UserService userService,
|
|
||||||
RoleService roleService,
|
|
||||||
PostService postService) {
|
|
||||||
this.userService = userService;
|
|
||||||
this.roleService = roleService;
|
|
||||||
this.postService = postService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("获取用户列表")
|
@ApiOperation("获取用户列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@PreAuthorize("@ss.hasPermission('admin:user:list')")
|
@PreAuthorize("@ss.hasPermission('admin:user:list')")
|
||||||
public Result<TableDataInfo<UserVo>> list(UserQuery userQuery) {
|
public Result<TableDataInfo<UserVo>> list(UserQuery userQuery) {
|
||||||
PageUtils.startPage();
|
TableDataInfo<UserVo> dataTable = userFacade.searchList(userQuery);
|
||||||
List<UserVo> userVos = userService.searchList(userQuery);
|
|
||||||
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userVos);
|
|
||||||
return Result.ok(dataTable);
|
return Result.ok(dataTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +62,7 @@ public class UserController {
|
|||||||
if (null == type || null == chooseId || type > 1 || type < 0) {
|
if (null == type || null == chooseId || type > 1 || type < 0) {
|
||||||
return Result.error("参数异常!");
|
return Result.error("参数异常!");
|
||||||
}
|
}
|
||||||
List<UserChooseVo> userChooseList = userService.searchUserChooseRoleOrDept(type, chooseId);
|
List<UserChooseVo> userChooseList = userFacade.searchUserChooseRoleOrDept(type, chooseId);
|
||||||
return Result.ok(userChooseList);
|
return Result.ok(userChooseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,9 +70,8 @@ public class UserController {
|
|||||||
@GetMapping("/info/{userId}")
|
@GetMapping("/info/{userId}")
|
||||||
@PreAuthorize("@ss.hasPermission('admin:user:info')")
|
@PreAuthorize("@ss.hasPermission('admin:user:info')")
|
||||||
public Result<UserDetailVo> info(@PathVariable Long userId) {
|
public Result<UserDetailVo> info(@PathVariable Long userId) {
|
||||||
checkUserId(userId);
|
UserDetailVo userDetail = userFacade.searchDetailByUserId(userId);
|
||||||
UserDetailVo userDetail = userService.searchByUserId(userId);
|
List<Option> roleOption = roleFacade.searchOption();
|
||||||
List<Option> roleOption = roleService.searchOption();
|
|
||||||
List<Option> postOption = postService.searchOption();
|
List<Option> postOption = postService.searchOption();
|
||||||
userDetail.setRoleList(roleOption);
|
userDetail.setRoleList(roleOption);
|
||||||
userDetail.setPostList(postOption);
|
userDetail.setPostList(postOption);
|
||||||
@@ -94,7 +83,7 @@ public class UserController {
|
|||||||
public Result<TableDataInfo<UserVo>> role(@PathVariable Long roleId, String userName, String phoneNumber) {
|
public Result<TableDataInfo<UserVo>> role(@PathVariable Long roleId, String userName, String phoneNumber) {
|
||||||
LongUtils.checkId(roleId, "角色id不能为空!");
|
LongUtils.checkId(roleId, "角色id不能为空!");
|
||||||
PageUtils.startPage();
|
PageUtils.startPage();
|
||||||
List<UserVo> userList = userService.searchListByRoleId(roleId, userName, phoneNumber);
|
List<UserVo> userList = userFacade.searchListByRoleId(roleId, userName, phoneNumber);
|
||||||
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
||||||
return Result.ok(dataTable);
|
return Result.ok(dataTable);
|
||||||
}
|
}
|
||||||
@@ -103,7 +92,7 @@ public class UserController {
|
|||||||
@GetMapping("/role/exclude/{roleId}")
|
@GetMapping("/role/exclude/{roleId}")
|
||||||
public Result<TableDataInfo<UserVo>> excludeRole(@PathVariable Long roleId, String userName, String phoneNumber) {
|
public Result<TableDataInfo<UserVo>> excludeRole(@PathVariable Long roleId, String userName, String phoneNumber) {
|
||||||
LongUtils.checkId(roleId, "角色id不能为空!");
|
LongUtils.checkId(roleId, "角色id不能为空!");
|
||||||
TableDataInfo<UserVo> table = userService.searchUserListByExcludeRoleId(roleId, userName, phoneNumber);
|
TableDataInfo<UserVo> table = userFacade.searchUserListByExcludeRoleId(roleId, userName, phoneNumber);
|
||||||
return Result.ok(table);
|
return Result.ok(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +103,7 @@ public class UserController {
|
|||||||
public Result<Void> bindRole(@RequestBody IdWrapper wrapper) {
|
public Result<Void> bindRole(@RequestBody IdWrapper wrapper) {
|
||||||
checkUserId(wrapper.getIds());
|
checkUserId(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
||||||
userService.bindRole(wrapper.getIds(), wrapper.getId());
|
userFacade.bindRole(wrapper.getIds(), wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +114,7 @@ public class UserController {
|
|||||||
public Result<Void> unBindRole(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindRole(@RequestBody IdWrapper wrapper) {
|
||||||
checkUserId(wrapper.getIds());
|
checkUserId(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
||||||
userService.unBindRole(wrapper.getIds(), wrapper.getId());
|
userFacade.unBindRole(wrapper.getIds(), wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +124,7 @@ public class UserController {
|
|||||||
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
||||||
public Result<Void> unBindAllRole(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindAllRole(@RequestBody IdWrapper wrapper) {
|
||||||
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
||||||
userService.unBindAllRole(wrapper.getId());
|
userFacade.unBindAllRole(wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +133,7 @@ public class UserController {
|
|||||||
public Result<TableDataInfo<UserVo>> dept(@PathVariable Long deptId, String userName, String phoneNumber) {
|
public Result<TableDataInfo<UserVo>> dept(@PathVariable Long deptId, String userName, String phoneNumber) {
|
||||||
LongUtils.checkId(deptId, "角色id不能为空!");
|
LongUtils.checkId(deptId, "角色id不能为空!");
|
||||||
PageUtils.startPage();
|
PageUtils.startPage();
|
||||||
List<UserVo> userList = userService.searchListByDeptId(deptId, userName, phoneNumber);
|
List<UserVo> userList = userFacade.searchListByDeptId(deptId, userName, phoneNumber);
|
||||||
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
||||||
return Result.ok(dataTable);
|
return Result.ok(dataTable);
|
||||||
}
|
}
|
||||||
@@ -153,7 +142,7 @@ public class UserController {
|
|||||||
// @GetMapping("/dept/exclude/{deptId}")
|
// @GetMapping("/dept/exclude/{deptId}")
|
||||||
public Result<TableDataInfo<UserVo>> excludeDept(@PathVariable Long deptId, String userName, String phoneNumber) {
|
public Result<TableDataInfo<UserVo>> excludeDept(@PathVariable Long deptId, String userName, String phoneNumber) {
|
||||||
LongUtils.checkId(deptId, "角色id不能为空!");
|
LongUtils.checkId(deptId, "角色id不能为空!");
|
||||||
TableDataInfo<UserVo> table = userService.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
|
TableDataInfo<UserVo> table = userFacade.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
|
||||||
return Result.ok(table);
|
return Result.ok(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +153,7 @@ public class UserController {
|
|||||||
public Result<Void> unBindDept(@PathVariable List<Long> userIds, @PathVariable Long deptId) {
|
public Result<Void> unBindDept(@PathVariable List<Long> userIds, @PathVariable Long deptId) {
|
||||||
checkUserId(userIds);
|
checkUserId(userIds);
|
||||||
LongUtils.checkId(deptId, "角色id不能为空");
|
LongUtils.checkId(deptId, "角色id不能为空");
|
||||||
userService.unBindDept(userIds, deptId);
|
userFacade.unBindDept(userIds, deptId);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +163,7 @@ public class UserController {
|
|||||||
// @Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
// @Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
||||||
public Result<Void> unBindAllDept(@PathVariable Long deptId) {
|
public Result<Void> unBindAllDept(@PathVariable Long deptId) {
|
||||||
LongUtils.checkId(deptId, "角色id不能为空");
|
LongUtils.checkId(deptId, "角色id不能为空");
|
||||||
userService.unBindAllDept(deptId);
|
userFacade.unBindAllDept(deptId);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +174,7 @@ public class UserController {
|
|||||||
return Result.error("岗位id不能为空!");
|
return Result.error("岗位id不能为空!");
|
||||||
}
|
}
|
||||||
PageUtils.startPage();
|
PageUtils.startPage();
|
||||||
List<UserVo> userList = userService.searchListByPostId(postId, userName, phoneNumber);
|
List<UserVo> userList = userFacade.searchListByPostId(postId, userName, phoneNumber);
|
||||||
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
TableDataInfo<UserVo> dataTable = PageUtils.getDataTable(userList);
|
||||||
return Result.ok(dataTable);
|
return Result.ok(dataTable);
|
||||||
}
|
}
|
||||||
@@ -195,7 +184,7 @@ public class UserController {
|
|||||||
@GetMapping("/post/exclude/{postId}")
|
@GetMapping("/post/exclude/{postId}")
|
||||||
public Result<TableDataInfo<UserVo>> excludePost(@PathVariable Long postId, String userName, String phoneNumber) {
|
public Result<TableDataInfo<UserVo>> excludePost(@PathVariable Long postId, String userName, String phoneNumber) {
|
||||||
LongUtils.checkId(postId, "角色id不能为空!");
|
LongUtils.checkId(postId, "角色id不能为空!");
|
||||||
TableDataInfo<UserVo> table = userService.searchUserListByExcludePostId(postId, userName, phoneNumber);
|
TableDataInfo<UserVo> table = userFacade.searchUserListByExcludePostId(postId, userName, phoneNumber);
|
||||||
return Result.ok(table);
|
return Result.ok(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +196,7 @@ public class UserController {
|
|||||||
public Result<Void> bindPost(@RequestBody IdWrapper wrapper) {
|
public Result<Void> bindPost(@RequestBody IdWrapper wrapper) {
|
||||||
checkUserId(wrapper.getIds());
|
checkUserId(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
LongUtils.checkId(wrapper.getId(), "角色id不能为空");
|
||||||
userService.bindPost(wrapper.getIds(), wrapper.getId());
|
userFacade.bindPost(wrapper.getIds(), wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +207,7 @@ public class UserController {
|
|||||||
public Result<Void> unBindPost(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindPost(@RequestBody IdWrapper wrapper) {
|
||||||
checkUserId(wrapper.getIds());
|
checkUserId(wrapper.getIds());
|
||||||
LongUtils.checkId(wrapper.getId(), "岗位id不能为空");
|
LongUtils.checkId(wrapper.getId(), "岗位id不能为空");
|
||||||
userService.unBindPost(wrapper.getIds(), wrapper.getId());
|
userFacade.unBindPost(wrapper.getIds(), wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +217,7 @@ public class UserController {
|
|||||||
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
@Log(title = "解除当前角色对应的所有用户的绑定关系", businessType = BusinessType.UPDATE)
|
||||||
public Result<Void> unBindAllPost(@RequestBody IdWrapper wrapper) {
|
public Result<Void> unBindAllPost(@RequestBody IdWrapper wrapper) {
|
||||||
LongUtils.checkId(wrapper.getId(), "岗位id不能为空");
|
LongUtils.checkId(wrapper.getId(), "岗位id不能为空");
|
||||||
userService.unBindAllPost(wrapper.getId());
|
userFacade.unBindAllPost(wrapper.getId());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +230,7 @@ public class UserController {
|
|||||||
return Result.error("初始密码不能为空");
|
return Result.error("初始密码不能为空");
|
||||||
}
|
}
|
||||||
checkPhone(user.getPhoneNumber());
|
checkPhone(user.getPhoneNumber());
|
||||||
userService.save(user);
|
userFacade.save(user);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +242,7 @@ public class UserController {
|
|||||||
public Result<Void> edit(@NotNull @RequestBody @Validated UserDto user) {
|
public Result<Void> edit(@NotNull @RequestBody @Validated UserDto user) {
|
||||||
checkUserId(user.getUserId());
|
checkUserId(user.getUserId());
|
||||||
checkPhone(user.getPhoneNumber());
|
checkPhone(user.getPhoneNumber());
|
||||||
userService.edit(user);
|
userFacade.edit(user);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +252,7 @@ public class UserController {
|
|||||||
@Log(title = "删除用户", businessType = BusinessType.DELETE)
|
@Log(title = "删除用户", businessType = BusinessType.DELETE)
|
||||||
public Result<Void> del(@PathVariable Long userId) {
|
public Result<Void> del(@PathVariable Long userId) {
|
||||||
checkUserId(userId);
|
checkUserId(userId);
|
||||||
userService.remove(userId);
|
userFacade.remove(userId);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.fateverse.admin.convert;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.fateverse.admin.dto.RoleDto;
|
||||||
|
import cn.fateverse.admin.vo.RoleVo;
|
||||||
|
import cn.fateverse.common.core.convert.BaseConvertDefine;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RoleConvert extends BaseConvertDefine<RoleDto, Role, RoleVo> {
|
||||||
|
RoleConvert INSTANCE = Mappers.getMapper(RoleConvert.class);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package cn.fateverse.admin.convert;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.dto.UserDto;
|
||||||
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
|
import cn.fateverse.common.core.convert.BaseConvertDefine;
|
||||||
|
import cn.fateverse.common.core.entity.User;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserConvert extends BaseConvertDefine<UserDto, User, UserVo> {
|
||||||
|
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体到细节
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
* @return {@link UserDetail }
|
||||||
|
*/
|
||||||
|
UserDetail entityToDetail(User user);
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package cn.fateverse.admin.dubbo;
|
package cn.fateverse.admin.dubbo;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.User;
|
import cn.fateverse.admin.facade.UserFacade;
|
||||||
import cn.fateverse.admin.service.UserService;
|
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
|
||||||
@@ -15,24 +16,21 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@DubboService
|
@DubboService
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class DubboUserServiceImpl implements DubboUserService {
|
public class DubboUserServiceImpl implements DubboUserService {
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserFacade userFacade;
|
||||||
|
|
||||||
public DubboUserServiceImpl(UserService userService) {
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUserByUsername(String username) {
|
public UserVo getUserByUsername(String username) {
|
||||||
log.info("用户登录:{}", username);
|
log.info("用户登录:{}", username);
|
||||||
return userService.searchByUserName(username);
|
return userFacade.searchByUserName(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUserByUserId(Long userId) {
|
public UserVo getUserByUserId(Long userId) {
|
||||||
return userService.searchUserInfoByUserId(userId);
|
return userFacade.searchByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,7 +38,7 @@ public class DubboUserServiceImpl implements DubboUserService {
|
|||||||
if (roleIds.isEmpty()) {
|
if (roleIds.isEmpty()) {
|
||||||
throw new CustomException("角色id不能为空");
|
throw new CustomException("角色id不能为空");
|
||||||
}
|
}
|
||||||
return userService.searchListByRoleIds(roleIds);
|
return userFacade.searchListByRoleIds(roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,7 +46,7 @@ public class DubboUserServiceImpl implements DubboUserService {
|
|||||||
if (userIds.isEmpty()) {
|
if (userIds.isEmpty()) {
|
||||||
throw new CustomException("用户id不能为空");
|
throw new CustomException("用户id不能为空");
|
||||||
}
|
}
|
||||||
return userService.searchByUserIds(userIds);
|
return userFacade.searchByUserIds(userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,11 +54,16 @@ public class DubboUserServiceImpl implements DubboUserService {
|
|||||||
if (deptIds.isEmpty()) {
|
if (deptIds.isEmpty()) {
|
||||||
throw new CustomException("部门id不能为空");
|
throw new CustomException("部门id不能为空");
|
||||||
}
|
}
|
||||||
return userService.searchByDeptIds(deptIds);
|
return userFacade.searchByDeptIds(deptIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> searchAllUserIds() {
|
public List<Long> searchAllUserIds() {
|
||||||
return userService.searchAllUserIds();
|
return userFacade.searchAllUserIds();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetail getUserDetailsByUserName(String userName) {
|
||||||
|
return userFacade.getUserDetailsByUserName(userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package cn.fateverse.admin.facade;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.convert.RoleConvert;
|
||||||
|
import cn.fateverse.admin.query.RoleQuery;
|
||||||
|
import cn.fateverse.admin.service.RoleService;
|
||||||
|
import cn.fateverse.admin.service.UserRoleService;
|
||||||
|
import cn.fateverse.admin.vo.RoleVo;
|
||||||
|
import cn.fateverse.common.core.entity.Option;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
|
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RoleFacade {
|
||||||
|
|
||||||
|
private final RoleService roleService;
|
||||||
|
private final UserRoleService userRoleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索选项
|
||||||
|
*
|
||||||
|
* @return {@link List }<{@link Option }>
|
||||||
|
*/
|
||||||
|
public List<Option> searchOption() {
|
||||||
|
List<Role> list = roleService.list();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索列表
|
||||||
|
*
|
||||||
|
* @param query 查询
|
||||||
|
* @return {@link TableDataInfo }<{@link RoleVo }>
|
||||||
|
*/
|
||||||
|
public TableDataInfo<RoleVo> searchList(RoleQuery query) {
|
||||||
|
IPage<Role> page = roleService.searchList(query);
|
||||||
|
return PageConditionUtil.convertDataTable(page, RoleConvert.INSTANCE::entityToVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按id查询
|
||||||
|
*
|
||||||
|
* @param roleId 角色id
|
||||||
|
* @return {@link RoleVo }
|
||||||
|
*/
|
||||||
|
public RoleVo searchById(Long roleId) {
|
||||||
|
Role role = roleService.getById(roleId);
|
||||||
|
return RoleConvert.INSTANCE.entityToVo(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索列表排除菜单id
|
||||||
|
*
|
||||||
|
* @param menuId 菜单id
|
||||||
|
* @param roleName 角色名
|
||||||
|
* @param roleKey 关键角色
|
||||||
|
* @return {@link TableDataInfo }<{@link RoleVo }>
|
||||||
|
*/
|
||||||
|
public TableDataInfo<RoleVo> searchListExcludeMenuId(Long menuId, String roleName, String roleKey) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
package cn.fateverse.admin.facade;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.convert.UserConvert;
|
||||||
|
import cn.fateverse.admin.query.UserQuery;
|
||||||
|
import cn.fateverse.admin.service.*;
|
||||||
|
import cn.fateverse.admin.vo.UserChooseVo;
|
||||||
|
import cn.fateverse.admin.vo.UserDetailVo;
|
||||||
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
|
import cn.fateverse.common.core.entity.Dept;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import cn.fateverse.common.core.entity.User;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
|
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserFacade {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
private final UserRoleService userRoleService;
|
||||||
|
private final UserPostService userPostService;
|
||||||
|
private final DeptService deptService;
|
||||||
|
private final RoleService roleService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户名搜索
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @return {@link UserVo }
|
||||||
|
*/
|
||||||
|
public UserVo searchByUserName(String username) {
|
||||||
|
User user = userService.searchByUserName(username);
|
||||||
|
return UserConvert.INSTANCE.entityToVo(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户id搜索
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return {@link UserVo }
|
||||||
|
*/
|
||||||
|
public UserVo searchByUserId(Long userId) {
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
return UserConvert.INSTANCE.entityToVo(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDetail getUserDetailsByUserName(String username) {
|
||||||
|
User user = userService.searchByUserName(username);
|
||||||
|
return buildUserDetail(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建用户细节
|
||||||
|
*
|
||||||
|
* @param user 用户
|
||||||
|
* @return {@link UserDetail }
|
||||||
|
*/
|
||||||
|
private UserDetail buildUserDetail(User user) {
|
||||||
|
if (ObjectUtil.isNull(user)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
UserDetail userDetail = UserConvert.INSTANCE.entityToDetail(user);
|
||||||
|
|
||||||
|
Dept dept = deptService.getById(user.getDeptId());
|
||||||
|
if (ObjectUtil.isNotNull(dept)) {
|
||||||
|
userDetail.setDept(dept);
|
||||||
|
}
|
||||||
|
List<Role> roleList = userRoleService.selectRoleByUserId(user.getUserId());
|
||||||
|
if (CollUtil.isNotEmpty(roleList)) {
|
||||||
|
userDetail.setRoles(roleList);
|
||||||
|
}
|
||||||
|
return userDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索列表
|
||||||
|
*
|
||||||
|
* @param userQuery 用户查询
|
||||||
|
* @return {@link List }<{@link UserVo }>
|
||||||
|
*/
|
||||||
|
public TableDataInfo<UserVo> searchList(UserQuery userQuery) {
|
||||||
|
IPage<UserVo> page = userService.searchList(userQuery);
|
||||||
|
return PageConditionUtil.convertDataTable(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索用户选择角色或部门
|
||||||
|
*
|
||||||
|
* @param type 类型
|
||||||
|
* @param chooseId 选择id
|
||||||
|
* @return {@link List }<{@link UserChooseVo }>
|
||||||
|
*/
|
||||||
|
public List<UserChooseVo> searchUserChooseRoleOrDept(Integer type, Long chooseId) {
|
||||||
|
switch (type) {
|
||||||
|
// 0代表角色
|
||||||
|
case 0:
|
||||||
|
return chooseRole(chooseId);
|
||||||
|
// 1代表部门
|
||||||
|
case 1:
|
||||||
|
return chooseDept(chooseId);
|
||||||
|
default:
|
||||||
|
throw new CustomException("参数异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择角色
|
||||||
|
*
|
||||||
|
* @param roleId 角色id
|
||||||
|
* @return 选择成功的用户信息
|
||||||
|
*/
|
||||||
|
private List<UserChooseVo> chooseRole(Long roleId) {
|
||||||
|
if (roleId.equals(0L)) {
|
||||||
|
List<Role> roleList = roleService.list();
|
||||||
|
return roleList.stream().map(UserChooseVo::toUserChooseByRole).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<UserVo> userList = userService.selectUserListByRoleId(roleId, null, null);
|
||||||
|
return userList.stream().map(user ->
|
||||||
|
UserChooseVo.toUserChooseByUser(user, roleId)
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择部门
|
||||||
|
*
|
||||||
|
* @param deptId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<UserChooseVo> chooseDept(Long deptId) {
|
||||||
|
List<Dept> deptList = deptService.selectListByDeptParentId(deptId);
|
||||||
|
List<UserChooseVo> result = deptList.stream().map(dept -> UserChooseVo.toUserChooseByDept(dept, deptId)).collect(Collectors.toList());
|
||||||
|
List<UserVo> userList = userService.selectByDeptIds(Collections.singletonList(deptId));
|
||||||
|
userList.forEach(user -> result.add(UserChooseVo.toUserChooseByUser(user, deptId)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户id搜索详细信息
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return {@link UserDetailVo }
|
||||||
|
*/
|
||||||
|
public UserDetailVo searchDetailByUserId(Long userId) {
|
||||||
|
User user = userService.getById(userId);
|
||||||
|
UserDetail userDetail = buildUserDetail(user);
|
||||||
|
UserDetailVo detailVo = new UserDetailVo();
|
||||||
|
detailVo.setUser(userDetail);
|
||||||
|
return detailVo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package cn.fateverse.admin.mapper;
|
package cn.fateverse.admin.mapper;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.Role;
|
|
||||||
import cn.fateverse.admin.query.RoleQuery;
|
import cn.fateverse.admin.query.RoleQuery;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,7 +11,7 @@ import java.util.List;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/11/4
|
* @date 2022/11/4
|
||||||
*/
|
*/
|
||||||
public interface RoleMapper {
|
public interface RoleMapper extends BaseMapper<Role> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package cn.fateverse.admin.mapper;
|
|||||||
|
|
||||||
import cn.fateverse.admin.query.UserQuery;
|
import cn.fateverse.admin.query.UserQuery;
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
import cn.fateverse.common.core.entity.UserBase;
|
import cn.fateverse.common.core.entity.User;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -12,7 +14,7 @@ import java.util.List;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/10/30
|
* @date 2022/10/30
|
||||||
*/
|
*/
|
||||||
public interface UserMapper extends BaseMapper<UserBase> {
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户
|
* 通过用户名查询用户
|
||||||
@@ -32,10 +34,11 @@ public interface UserMapper extends BaseMapper<UserBase> {
|
|||||||
/**
|
/**
|
||||||
* 查询用户列表
|
* 查询用户列表
|
||||||
*
|
*
|
||||||
|
* @param page 页面
|
||||||
* @param query 用户查询信息
|
* @param query 用户查询信息
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
List<UserVo> selectList(UserQuery query);
|
IPage<UserVo> selectPage(@Param("page") IPage<User> page, @Param("query") UserQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排除角色id
|
* 排除角色id
|
||||||
@@ -88,7 +91,7 @@ public interface UserMapper extends BaseMapper<UserBase> {
|
|||||||
* @param deptIds 部门id列表
|
* @param deptIds 部门id列表
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
List<UserVo> selectUserByDeptIds(List<Long> deptIds);
|
List<UserVo> selectByDeptIds(List<Long> deptIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据岗位id查询用户信息
|
* 根据岗位id查询用户信息
|
||||||
@@ -104,7 +107,7 @@ public interface UserMapper extends BaseMapper<UserBase> {
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
User selectUserByUserId(Long userId);
|
UserDetail selectUserByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户是否唯一
|
* 校验用户是否唯一
|
||||||
@@ -136,7 +139,7 @@ public interface UserMapper extends BaseMapper<UserBase> {
|
|||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insert(UserBase user);
|
int insert(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户
|
* 更新用户
|
||||||
@@ -144,7 +147,7 @@ public interface UserMapper extends BaseMapper<UserBase> {
|
|||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int update(UserBase user);
|
int update(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.fateverse.admin.mapper;
|
package cn.fateverse.admin.mapper;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.UserPost;
|
import cn.fateverse.admin.entity.UserPost;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -9,7 +10,7 @@ import java.util.List;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/11/26
|
* @date 2022/11/26
|
||||||
*/
|
*/
|
||||||
public interface UserPostMapper {
|
public interface UserPostMapper extends BaseMapper<UserPost> {
|
||||||
/**
|
/**
|
||||||
* 批量新增用户角色映射关系
|
* 批量新增用户角色映射关系
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package cn.fateverse.admin.mapper;
|
|||||||
|
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.UserRole;
|
import cn.fateverse.admin.entity.UserRole;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,7 +12,7 @@ import java.util.List;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/11/6
|
* @date 2022/11/6
|
||||||
*/
|
*/
|
||||||
public interface UserRoleMapper {
|
public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增用户角色映射关系
|
* 批量新增用户角色映射关系
|
||||||
@@ -54,4 +56,11 @@ public interface UserRoleMapper {
|
|||||||
*/
|
*/
|
||||||
int bind(@Param("userIds") List<Long> userIds, @Param("roleId") Long roleId);
|
int bind(@Param("userIds") List<Long> userIds, @Param("roleId") Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id选择角色
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return {@link List }<{@link Role }>
|
||||||
|
*/
|
||||||
|
List<Role> selectRoleByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,4 +59,12 @@ public interface DeptService extends IService<Dept> {
|
|||||||
*/
|
*/
|
||||||
List<Dept> selectChildrenById(Long deptId);
|
List<Dept> selectChildrenById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按部门父级id选择列表
|
||||||
|
*
|
||||||
|
* @param deptId 部门id
|
||||||
|
* @return {@link List }<{@link Dept }>
|
||||||
|
*/
|
||||||
|
List<Dept> selectListByDeptParentId(Long deptId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import cn.fateverse.admin.dto.RoleDto;
|
|||||||
import cn.fateverse.admin.query.RoleQuery;
|
import cn.fateverse.admin.query.RoleQuery;
|
||||||
import cn.fateverse.admin.vo.RoleVo;
|
import cn.fateverse.admin.vo.RoleVo;
|
||||||
import cn.fateverse.common.core.entity.Option;
|
import cn.fateverse.common.core.entity.Option;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -12,7 +15,7 @@ import java.util.List;
|
|||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/11/4
|
* @date 2022/11/4
|
||||||
*/
|
*/
|
||||||
public interface RoleService {
|
public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询角色列表
|
* 查询角色列表
|
||||||
@@ -20,7 +23,7 @@ public interface RoleService {
|
|||||||
* @param query
|
* @param query
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
TableDataInfo<RoleVo> searchList(RoleQuery query);
|
IPage<Role> searchList(RoleQuery query);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package cn.fateverse.admin.service;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.entity.UserPost;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface UserPostService extends IService<UserPost> {
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package cn.fateverse.admin.service;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.entity.UserRole;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface UserRoleService extends IService<UserRole> {
|
||||||
|
|
||||||
|
List<Role> selectRoleByUserId(Long userId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ import cn.fateverse.admin.vo.UserChooseVo;
|
|||||||
import cn.fateverse.admin.vo.UserDetailVo;
|
import cn.fateverse.admin.vo.UserDetailVo;
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
import cn.fateverse.common.core.entity.User;
|
import cn.fateverse.common.core.entity.User;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -32,7 +34,7 @@ public interface UserService extends IService<User> {
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 用户对象
|
* @return 用户对象
|
||||||
*/
|
*/
|
||||||
User searchUserInfoByUserId(Long userId);
|
UserDetail searchUserInfoByUserId(Long userId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +43,7 @@ public interface UserService extends IService<User> {
|
|||||||
* @param user
|
* @param user
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<UserVo> searchList(UserQuery user);
|
IPage<UserVo> searchList(UserQuery user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色或者是部门获取到用户信息
|
* 根据角色或者是部门获取到用户信息
|
||||||
@@ -92,14 +94,14 @@ public interface UserService extends IService<User> {
|
|||||||
*
|
*
|
||||||
* @param user@return
|
* @param user@return
|
||||||
*/
|
*/
|
||||||
boolean checkUserNameUnique(UserDto user);
|
boolean checkUserNameUnique(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验手机号是否唯一
|
* 校验手机号是否唯一
|
||||||
*
|
*
|
||||||
* @param user@return
|
* @param user@return
|
||||||
*/
|
*/
|
||||||
boolean checkPhoneNumberUnique(UserDto user);
|
boolean checkPhoneNumberUnique(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验邮箱是否唯一
|
* 校验邮箱是否唯一
|
||||||
@@ -272,4 +274,22 @@ public interface UserService extends IService<User> {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
boolean checkExistUser(Long deptId);
|
boolean checkExistUser(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色id选择用户列表
|
||||||
|
*
|
||||||
|
* @param roleId
|
||||||
|
* @param userName 用户名
|
||||||
|
* @param phoneNumber 电话号码
|
||||||
|
* @return {@link List }<{@link UserVo }>
|
||||||
|
*/
|
||||||
|
List<UserVo> selectUserListByRoleId(Long roleId, String userName, String phoneNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按部门id选择
|
||||||
|
*
|
||||||
|
* @param deptIds 部门id
|
||||||
|
* @return {@link List }<{@link UserVo }>
|
||||||
|
*/
|
||||||
|
List<UserVo> selectByDeptIds(List<Long> deptIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
package cn.fateverse.admin.service.impl;
|
package cn.fateverse.admin.service.impl;
|
||||||
|
|
||||||
import cn.fateverse.admin.dto.ConfigDto;
|
import cn.fateverse.admin.dto.ConfigDto;
|
||||||
import cn.fateverse.admin.query.ConfigQuery;
|
|
||||||
import cn.fateverse.admin.vo.ConfigVo;
|
|
||||||
import cn.fateverse.admin.entity.Config;
|
import cn.fateverse.admin.entity.Config;
|
||||||
import cn.fateverse.admin.mapper.ConfigMapper;
|
import cn.fateverse.admin.mapper.ConfigMapper;
|
||||||
|
import cn.fateverse.admin.query.ConfigQuery;
|
||||||
import cn.fateverse.admin.service.ConfigService;
|
import cn.fateverse.admin.service.ConfigService;
|
||||||
|
import cn.fateverse.admin.vo.ConfigVo;
|
||||||
import cn.fateverse.common.core.entity.PageInfo;
|
import cn.fateverse.common.core.entity.PageInfo;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.ObjectUtils;
|
import cn.fateverse.common.core.utils.ObjectUtils;
|
||||||
import cn.fateverse.common.core.utils.TableSupport;
|
import cn.fateverse.common.core.utils.TableSupport;
|
||||||
import cn.fateverse.common.mybatis.utils.PageUtils;
|
import cn.fateverse.common.mybatis.utils.PageUtils;
|
||||||
|
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
|
||||||
import cn.fateverse.common.security.utils.SecurityUtils;
|
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -48,7 +48,7 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
PageUtils.startPage();
|
PageUtils.startPage();
|
||||||
List<Config> list = configMapper.selectList(query);
|
List<Config> list = configMapper.selectList(query);
|
||||||
log.info("query time :{}", (System.currentTimeMillis() - startTime));
|
log.info("query time :{}", (System.currentTimeMillis() - startTime));
|
||||||
return PageUtils.convertDataTable(list, ConfigVo::toConfigVo);
|
return PageConditionUtil.convertDataTable(list, ConfigVo::toConfigVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cn.fateverse.admin.service.impl;
|
|||||||
|
|
||||||
import cn.fateverse.admin.mapper.DeptMapper;
|
import cn.fateverse.admin.mapper.DeptMapper;
|
||||||
import cn.fateverse.admin.service.DeptService;
|
import cn.fateverse.admin.service.DeptService;
|
||||||
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
import cn.fateverse.common.core.entity.Dept;
|
import cn.fateverse.common.core.entity.Dept;
|
||||||
import cn.fateverse.common.core.utils.AssertUtil;
|
import cn.fateverse.common.core.utils.AssertUtil;
|
||||||
import cn.fateverse.common.core.utils.LongUtils;
|
import cn.fateverse.common.core.utils.LongUtils;
|
||||||
@@ -73,4 +74,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept>
|
|||||||
.eq(Dept::getParentId, deptId)
|
.eq(Dept::getParentId, deptId)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Dept> selectListByDeptParentId(Long deptId) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.eq(Dept::getParentId, deptId)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
@Override
|
@Override
|
||||||
public List<RouterVo> searchRouterByUserId(Long userId) {
|
public List<RouterVo> searchRouterByUserId(Long userId) {
|
||||||
List<Menu> menuList = null;
|
List<Menu> menuList = null;
|
||||||
if (User.isAdmin(userId)) {
|
if (SecurityUtils.isAdmin(userId)) {
|
||||||
menuList = menuMapper.selectRouterMenuList();
|
menuList = menuMapper.selectRouterMenuList();
|
||||||
} else {
|
} else {
|
||||||
menuList = menuMapper.selectRouterMenuListByUserId(userId);
|
menuList = menuMapper.selectRouterMenuListByUserId(userId);
|
||||||
@@ -79,7 +79,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
public List<MenuSimpVo> searchTree(String menuName, String state) {
|
public List<MenuSimpVo> searchTree(String menuName, String state) {
|
||||||
List<Menu> menuList = null;
|
List<Menu> menuList = null;
|
||||||
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
||||||
if (User.isAdmin(userId)) {
|
if (SecurityUtils.isAdmin(userId)) {
|
||||||
menuList = menuMapper.selectList(menuName, state, null, false);
|
menuList = menuMapper.selectList(menuName, state, null, false);
|
||||||
} else {
|
} else {
|
||||||
menuList = menuMapper.selectListByUserId(userId, menuName, state, null, false);
|
menuList = menuMapper.selectListByUserId(userId, menuName, state, null, false);
|
||||||
@@ -103,7 +103,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
public List<OptionTree> searchTreeOption(Long excludeId) {
|
public List<OptionTree> searchTreeOption(Long excludeId) {
|
||||||
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
||||||
List<Menu> menuList = null;
|
List<Menu> menuList = null;
|
||||||
if (User.isAdmin(userId)) {
|
if (SecurityUtils.isAdmin(userId)) {
|
||||||
menuList = menuMapper.selectList(null, null, excludeId, true);
|
menuList = menuMapper.selectList(null, null, excludeId, true);
|
||||||
} else {
|
} else {
|
||||||
menuList = menuMapper.selectListByUserId(userId, null, null, excludeId, true);
|
menuList = menuMapper.selectListByUserId(userId, null, null, excludeId, true);
|
||||||
@@ -123,7 +123,7 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
}
|
}
|
||||||
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
Long userId = Objects.requireNonNull(SecurityUtils.getUserId());
|
||||||
List<Menu> menuList = null;
|
List<Menu> menuList = null;
|
||||||
if (User.isAdmin(userId)) {
|
if (SecurityUtils.isAdmin(userId)) {
|
||||||
menuList = menuMapper.selectList(null, null, null, true);
|
menuList = menuMapper.selectList(null, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
menuList = menuMapper.selectListByUserId(userId, null, null, null, true);
|
menuList = menuMapper.selectListByUserId(userId, null, null, null, true);
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
package cn.fateverse.admin.service.impl;
|
package cn.fateverse.admin.service.impl;
|
||||||
|
|
||||||
import cn.fateverse.admin.dto.RoleDto;
|
import cn.fateverse.admin.dto.RoleDto;
|
||||||
import cn.fateverse.admin.entity.Role;
|
|
||||||
import cn.fateverse.admin.query.RoleQuery;
|
|
||||||
import cn.fateverse.admin.vo.RoleVo;
|
|
||||||
import cn.fateverse.admin.entity.RoleMenu;
|
import cn.fateverse.admin.entity.RoleMenu;
|
||||||
import cn.fateverse.admin.mapper.MenuMapper;
|
|
||||||
import cn.fateverse.admin.mapper.RoleMapper;
|
import cn.fateverse.admin.mapper.RoleMapper;
|
||||||
import cn.fateverse.admin.mapper.RoleMenuMapper;
|
import cn.fateverse.admin.mapper.RoleMenuMapper;
|
||||||
|
import cn.fateverse.admin.query.RoleQuery;
|
||||||
import cn.fateverse.admin.service.RoleService;
|
import cn.fateverse.admin.service.RoleService;
|
||||||
|
import cn.fateverse.admin.vo.RoleVo;
|
||||||
import cn.fateverse.common.core.entity.Option;
|
import cn.fateverse.common.core.entity.Option;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.LongUtils;
|
import cn.fateverse.common.core.utils.LongUtils;
|
||||||
import cn.fateverse.common.core.utils.ObjectUtils;
|
import cn.fateverse.common.core.utils.ObjectUtils;
|
||||||
import cn.fateverse.common.core.utils.StateUtils;
|
import cn.fateverse.common.core.utils.StateUtils;
|
||||||
|
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
|
||||||
import cn.fateverse.common.security.utils.SecurityUtils;
|
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||||
import cn.fateverse.common.mybatis.utils.PageUtils;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -32,7 +34,8 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class RoleServiceImpl implements RoleService {
|
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role>
|
||||||
|
implements RoleService {
|
||||||
|
|
||||||
private final RoleMapper roleMapper;
|
private final RoleMapper roleMapper;
|
||||||
|
|
||||||
@@ -47,25 +50,31 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<RoleVo> searchList(RoleQuery query) {
|
public IPage<Role> searchList(RoleQuery query) {
|
||||||
PageUtils.startPage();
|
IPage<Role> page = PageConditionUtil.getPage();
|
||||||
List<Role> list = roleMapper.selectList(query);
|
return this.lambdaQuery()
|
||||||
return PageUtils.convertDataTable(list, RoleVo::toRoleVo);
|
.like(StrUtil.isNotBlank(query.getRoleName()), Role::getRoleName, query.getRoleName())
|
||||||
|
.like(StrUtil.isNotBlank(query.getRoleKey()), Role::getRoleKey, query.getRoleKey())
|
||||||
|
.eq(ObjectUtil.isNotNull(query.getState()), Role::getState, query.getState())
|
||||||
|
.between(ObjectUtil.isNotNull(query.getStartTime()) && ObjectUtil.isNotNull(query.getEndTime()),
|
||||||
|
Role::getCreateTime, query.getStartTime(), query.getEndTime())
|
||||||
|
.page(page);
|
||||||
|
return PageConditionUtil.convertDataTable(list, RoleVo::toRoleVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<RoleVo> searchListByMenuId(Long menuId, String roleName, String roleKey) {
|
public TableDataInfo<RoleVo> searchListByMenuId(Long menuId, String roleName, String roleKey) {
|
||||||
PageUtils.startPage();
|
PageConditionUtil.startPage();
|
||||||
List<Role> list = roleMapper.selectListByMenuId(menuId, roleName, roleKey);
|
List<Role> list = roleMapper.selectListByMenuId(menuId, roleName, roleKey);
|
||||||
return PageUtils.convertDataTable(list, RoleVo::toRoleVo);
|
return PageConditionUtil.convertDataTable(list, RoleVo::toRoleVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<RoleVo> searchListExcludeMenuId(Long menuId, String roleName, String roleKey) {
|
public TableDataInfo<RoleVo> searchListExcludeMenuId(Long menuId, String roleName, String roleKey) {
|
||||||
PageUtils.startPage();
|
PageConditionUtil.startPage();
|
||||||
List<Role> list = roleMapper.searchListExcludeMenuId(menuId,roleName,roleKey);
|
List<Role> list = roleMapper.searchListExcludeMenuId(menuId, roleName, roleKey);
|
||||||
return PageUtils.convertDataTable(list, RoleVo::toRoleVo);
|
return PageConditionUtil.convertDataTable(list, RoleVo::toRoleVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -156,7 +165,7 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
public int bindMenu(Long menuId, List<Long> roleIds) {
|
public int bindMenu(Long menuId, List<Long> roleIds) {
|
||||||
List<RoleMenu> roleMenuList = roleIds.stream().filter(LongUtils::isNotNull).map(roleId -> RoleMenu.builder().roleId(roleId)
|
List<RoleMenu> roleMenuList = roleIds.stream().filter(LongUtils::isNotNull).map(roleId -> RoleMenu.builder().roleId(roleId)
|
||||||
.menuId(menuId).build()).collect(Collectors.toList());
|
.menuId(menuId).build()).collect(Collectors.toList());
|
||||||
if (roleMenuList.isEmpty()){
|
if (roleMenuList.isEmpty()) {
|
||||||
throw new CustomException("角色id不能为空");
|
throw new CustomException("角色id不能为空");
|
||||||
}
|
}
|
||||||
return roleMenuMapper.batch(roleMenuList);
|
return roleMenuMapper.batch(roleMenuList);
|
||||||
@@ -175,7 +184,7 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkRoleAllowed(Role role) {
|
public void checkRoleAllowed(Role role) {
|
||||||
if (!ObjectUtils.isEmpty(role.getRoleId()) && role.isAdmin()) {
|
if (!ObjectUtils.isEmpty(role.getRoleId()) && SecurityUtils.isAdmin(role.getRoleId())) {
|
||||||
throw new CustomException("不允许操作超级管理员角色");
|
throw new CustomException("不允许操作超级管理员角色");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.fateverse.admin.service.impl;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.entity.UserPost;
|
||||||
|
import cn.fateverse.admin.mapper.UserPostMapper;
|
||||||
|
import cn.fateverse.admin.service.UserPostService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class UserPostServiceImpl extends ServiceImpl<UserPostMapper, UserPost>
|
||||||
|
implements UserPostService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package cn.fateverse.admin.service.impl;
|
||||||
|
|
||||||
|
import cn.fateverse.admin.entity.UserRole;
|
||||||
|
import cn.fateverse.admin.mapper.UserRoleMapper;
|
||||||
|
import cn.fateverse.admin.service.UserRoleService;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole>
|
||||||
|
implements UserRoleService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> selectRoleByUserId(Long userId) {
|
||||||
|
return baseMapper.selectRoleByUserId(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,15 +11,17 @@ import cn.fateverse.admin.vo.UserChooseVo;
|
|||||||
import cn.fateverse.admin.vo.UserDetailVo;
|
import cn.fateverse.admin.vo.UserDetailVo;
|
||||||
import cn.fateverse.admin.vo.UserVo;
|
import cn.fateverse.admin.vo.UserVo;
|
||||||
import cn.fateverse.common.core.entity.Dept;
|
import cn.fateverse.common.core.entity.Dept;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
import cn.fateverse.common.core.entity.User;
|
import cn.fateverse.common.core.entity.User;
|
||||||
import cn.fateverse.common.core.entity.UserBase;
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.LongUtils;
|
import cn.fateverse.common.core.utils.LongUtils;
|
||||||
import cn.fateverse.common.core.utils.ObjectUtils;
|
import cn.fateverse.common.core.utils.ObjectUtils;
|
||||||
import cn.fateverse.common.mybatisplus.utils.PageUtils;
|
import cn.fateverse.common.mybatisplus.utils.PageConditionUtil;
|
||||||
import cn.fateverse.common.security.utils.SecurityUtils;
|
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -37,7 +39,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||||
implements UserService {
|
implements UserService {
|
||||||
|
|
||||||
private final UserMapper userMapper;
|
private final UserMapper userMapper;
|
||||||
@@ -63,17 +65,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User searchByUserName(String username) {
|
public User searchByUserName(String username) {
|
||||||
return userMapper.selectByUserName(username);
|
return this.lambdaQuery()
|
||||||
|
.eq(User::getUserName, username)
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User searchUserInfoByUserId(Long userId) {
|
public UserDetail searchUserInfoByUserId(Long userId) {
|
||||||
return userMapper.selectUserByUserId(userId);
|
return userMapper.selectUserByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserVo> searchList(UserQuery user) {
|
public IPage<UserVo> searchList(UserQuery user) {
|
||||||
return userMapper.selectList(user);
|
IPage<User> page = PageConditionUtil.getPage();
|
||||||
|
return userMapper.selectPage(page, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -107,39 +113,45 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserVo> searchByDeptIds(List<Long> deptIds) {
|
public List<UserVo> searchByDeptIds(List<Long> deptIds) {
|
||||||
return userMapper.selectUserByDeptIds(deptIds);
|
return userMapper.selectByDeptIds(deptIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetailVo searchByUserId(Long userId) {
|
public UserDetailVo searchByUserId(Long userId) {
|
||||||
User user = userMapper.selectUserByUserId(userId);
|
UserDetail userDetail = userMapper.selectUserByUserId(userId);
|
||||||
List<Long> roleIds = user.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList());
|
List<Long> roleIds = userDetail.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList());
|
||||||
user.setDept(null);
|
userDetail.setDept(null);
|
||||||
user.setRoles(null);
|
userDetail.setRoles(null);
|
||||||
user.setPassword(null);
|
userDetail.setPassword(null);
|
||||||
List<Long> postIds = userPostMapper.selectPostIdListByUserId(userId);
|
List<Long> postIds = userPostMapper.selectPostIdListByUserId(userId);
|
||||||
return UserDetailVo.builder()
|
return UserDetailVo.builder()
|
||||||
.user(user)
|
.user(userDetail)
|
||||||
.postIds(postIds)
|
.postIds(postIds)
|
||||||
.roleIds(roleIds)
|
.roleIds(roleIds)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUserNameUnique(UserDto user) {
|
public boolean checkUserNameUnique(User user) {
|
||||||
Long userId = getUserId(user);
|
Long userId = getUserId(user);
|
||||||
User info = userMapper.selectUserInfoByUserName(user.getUserName());
|
User info = this.lambdaQuery()
|
||||||
|
.eq(User::getUserName, user.getUserName())
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
return checkUser(info, userId);
|
return checkUser(info, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPhoneNumberUnique(UserDto user) {
|
public boolean checkPhoneNumberUnique(User user) {
|
||||||
if (StrUtil.isEmpty(user.getPhoneNumber())) {
|
if (StrUtil.isEmpty(user.getPhoneNumber())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Long userId = getUserId(user);
|
Long userId = getUserId(user);
|
||||||
User info = userMapper.selectUserInfoByUserName(user.getPhoneNumber());
|
User info = this.lambdaQuery()
|
||||||
|
.eq(User::getPhoneNumber, user.getPhoneNumber())
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
return checkUser(info, userId);
|
return checkUser(info, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +161,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Long userId = getUserId(user);
|
Long userId = getUserId(user);
|
||||||
User info = userMapper.selectByEmail(user.getEmail());
|
UserDetail info = userMapper.selectByEmail(user.getEmail());
|
||||||
return checkUser(info, userId);
|
return checkUser(info, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,10 +172,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<UserVo> searchUserListByExcludeRoleId(Long roleId, String userName, String phoneNumber) {
|
public TableDataInfo<UserVo> searchUserListByExcludeRoleId(Long roleId, String userName, String phoneNumber) {
|
||||||
PageUtils.startPage();
|
PageConditionUtil.startPage();
|
||||||
List<UserVo> list = userMapper.selectUserListByExcludeRoleId(roleId, userName, phoneNumber);
|
List<UserVo> list = userMapper.selectUserListByExcludeRoleId(roleId, userName, phoneNumber);
|
||||||
Long total = PageUtils.getTotal(list);
|
Long total = PageConditionUtil.getTotal(list);
|
||||||
return PageUtils.convertDataTable(list, total);
|
return PageConditionUtil.convertDataTable(list, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -197,10 +209,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<UserVo> searchUserListByExcludePostId(Long postId, String userName, String phoneNumber) {
|
public TableDataInfo<UserVo> searchUserListByExcludePostId(Long postId, String userName, String phoneNumber) {
|
||||||
PageUtils.startPage();
|
PageConditionUtil.startPage();
|
||||||
List<UserVo> list = userMapper.selectUserListByExcludePostId(postId, userName, phoneNumber);
|
List<UserVo> list = userMapper.selectUserListByExcludePostId(postId, userName, phoneNumber);
|
||||||
Long total = PageUtils.getTotal(list);
|
Long total = PageConditionUtil.getTotal(list);
|
||||||
return PageUtils.convertDataTable(list, total);
|
return PageConditionUtil.convertDataTable(list, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -236,7 +248,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
private List<UserChooseVo> chooseDept(Long deptId) {
|
private List<UserChooseVo> chooseDept(Long deptId) {
|
||||||
List<Dept> deptList = deptMapper.selectListByDeptParentId(deptId);
|
List<Dept> deptList = deptMapper.selectListByDeptParentId(deptId);
|
||||||
List<UserChooseVo> result = deptList.stream().map(dept -> UserChooseVo.toUserChooseByDept(dept, deptId)).collect(Collectors.toList());
|
List<UserChooseVo> result = deptList.stream().map(dept -> UserChooseVo.toUserChooseByDept(dept, deptId)).collect(Collectors.toList());
|
||||||
List<UserVo> userList = userMapper.selectUserByDeptIds(Collections.singletonList(deptId));
|
List<UserVo> userList = userMapper.selectByDeptIds(Collections.singletonList(deptId));
|
||||||
userList.forEach(user -> result.add(UserChooseVo.toUserChooseByUser(user, deptId)));
|
userList.forEach(user -> result.add(UserChooseVo.toUserChooseByUser(user, deptId)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -266,15 +278,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<UserVo> searchUserListByExcludeDeptId(Long deptId, String userName, String phoneNumber) {
|
public TableDataInfo<UserVo> searchUserListByExcludeDeptId(Long deptId, String userName, String phoneNumber) {
|
||||||
PageUtils.startPage();
|
PageConditionUtil.startPage();
|
||||||
Dept dept = deptMapper.selectById(deptId);
|
Dept dept = deptMapper.selectById(deptId);
|
||||||
if (null == dept) {
|
if (null == dept) {
|
||||||
throw new CustomException("当前部门不存在");
|
throw new CustomException("当前部门不存在");
|
||||||
}
|
}
|
||||||
// dept.getAncestors()
|
// dept.getAncestors()
|
||||||
List<UserVo> list = userMapper.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
|
List<UserVo> list = userMapper.searchUserListByExcludeDeptId(deptId, userName, phoneNumber);
|
||||||
Long total = PageUtils.getTotal(list);
|
Long total = PageConditionUtil.getTotal(list);
|
||||||
return PageUtils.convertDataTable(list, total);
|
return PageConditionUtil.convertDataTable(list, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -292,7 +304,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int save(UserDto dto) {
|
public int save(UserDto dto) {
|
||||||
checkUser(dto);
|
checkUser(dto);
|
||||||
UserBase user = insertInitUser(dto);
|
User user = insertInitUser(dto);
|
||||||
int result = userMapper.insert(user);
|
int result = userMapper.insert(user);
|
||||||
dto.setUserId(user.getUserId());
|
dto.setUserId(user.getUserId());
|
||||||
batchUserRole(dto, Boolean.FALSE);
|
batchUserRole(dto, Boolean.FALSE);
|
||||||
@@ -310,7 +322,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
batchUserRole(dto, Boolean.TRUE);
|
batchUserRole(dto, Boolean.TRUE);
|
||||||
batchUserPost(dto, Boolean.TRUE);
|
batchUserPost(dto, Boolean.TRUE);
|
||||||
dto.setPassword(null);
|
dto.setPassword(null);
|
||||||
UserBase user = dto.toUser();
|
User user = dto.toUser();
|
||||||
return userMapper.update(user);
|
return userMapper.update(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,10 +346,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
@Override
|
@Override
|
||||||
public boolean checkExistUser(Long deptId) {
|
public boolean checkExistUser(Long deptId) {
|
||||||
return this.lambdaQuery()
|
return this.lambdaQuery()
|
||||||
.eq(UserBase::getDeptId, deptId)
|
.eq(User::getDeptId, deptId)
|
||||||
.exists();
|
.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserVo> selectUserListByRoleId(Long roleId, String userName, String phoneNumber) {
|
||||||
|
return baseMapper.selectUserListByRoleId(roleId, userName, phoneNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserVo> selectByDeptIds(List<Long> deptIds) {
|
||||||
|
return baseMapper.selectByDeptIds(deptIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量处理用户与角色之间的对应关系
|
* 批量处理用户与角色之间的对应关系
|
||||||
*/
|
*/
|
||||||
@@ -381,8 +404,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
private UserBase insertInitUser(UserDto dto) {
|
private User insertInitUser(UserDto dto) {
|
||||||
UserBase user = dto.toUser();
|
User user = dto.toUser();
|
||||||
user.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
|
user.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
@@ -393,7 +416,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserBase>
|
|||||||
* @param user
|
* @param user
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Long getUserId(UserDto user) {
|
private Long getUserId(User user) {
|
||||||
return LongUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
return LongUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.fateverse.admin.mapper.UserMapper">
|
<mapper namespace="cn.fateverse.admin.mapper.UserMapper">
|
||||||
|
|
||||||
<resultMap type="cn.fateverse.common.core.entity.User" id="UserResult">
|
<resultMap type="cn.fateverse.common.core.entity.UserDetail" id="UserResult">
|
||||||
<id property="userId" column="user_id"/>
|
<id property="userId" column="user_id"/>
|
||||||
<result property="deptId" column="dept_id"/>
|
<result property="deptId" column="dept_id"/>
|
||||||
<result property="userName" column="user_name"/>
|
<result property="userName" column="user_name"/>
|
||||||
@@ -135,21 +135,21 @@
|
|||||||
where u.user_name = #{userName} limit 0,1
|
where u.user_name = #{userName} limit 0,1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectList" resultType="cn.fateverse.admin.vo.UserVo">
|
<select id="selectPage" resultType="cn.fateverse.admin.vo.UserVo">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
<where>
|
<where>
|
||||||
u.del_flag = '0'
|
u.del_flag = '0'
|
||||||
<if test="userName != null and userName != ''">and u.user_name like concat('%', #{userName}, '%')</if>
|
<if test="query.userName != null and query.userName != ''">and u.user_name like concat('%', #{query.userName}, '%')</if>
|
||||||
<if test="phoneNumber != null and phoneNumber != ''">and u.phone_number like
|
<if test="query.phoneNumber != null and query.phoneNumber != ''">and u.phone_number like
|
||||||
concat('%',#{phoneNumber},'%')
|
concat('%',#{query.phoneNumber},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="state != null and state != ''">and u.state = #{state}</if>
|
<if test="query.state != null">and u.state = #{query.state}</if>
|
||||||
<if test="startTime != null and endTime != null">
|
<if test="query.startTime != null and query.endTime != null">
|
||||||
and u.create_time between #{startTime} and #{endTime}
|
and u.create_time between #{query.startTime} and #{query.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="deptId != null">
|
<if test="query.deptId != null">
|
||||||
and (u.dept_id = #{deptId} or u.dept_id in ( select t.dept_id from sys_dept t where
|
and (u.dept_id = #{query.deptId} or u.dept_id in ( select t.dept_id from sys_dept t where
|
||||||
find_in_set(#{deptId}, ancestors) ))
|
find_in_set(#{query.deptId}, ancestors) ))
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@@ -218,17 +218,17 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserInfoByUserName" resultType="cn.fateverse.common.core.entity.User">
|
<select id="selectUserInfoByUserName" resultType="cn.fateverse.common.core.entity.UserDetail">
|
||||||
<include refid="selectUser"/>
|
<include refid="selectUser"/>
|
||||||
where user_name = #{userName}
|
where user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByPhoneNum" resultType="cn.fateverse.common.core.entity.User">
|
<select id="selectByPhoneNum" resultType="cn.fateverse.common.core.entity.UserDetail">
|
||||||
<include refid="selectUser"/>
|
<include refid="selectUser"/>
|
||||||
where phone_number = #{phoneNumber}
|
where phone_number = #{phoneNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByEmail" resultType="cn.fateverse.common.core.entity.User">
|
<select id="selectByEmail" resultType="cn.fateverse.common.core.entity.UserDetail">
|
||||||
<include refid="selectUser"/>
|
<include refid="selectUser"/>
|
||||||
where email = #{email} limit 0,1
|
where email = #{email} limit 0,1
|
||||||
</select>
|
</select>
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByDeptIds" resultType="cn.fateverse.admin.vo.UserVo">
|
<select id="selectByDeptIds" resultType="cn.fateverse.admin.vo.UserVo">
|
||||||
select distinct u.user_id,u.user_name,u.nick_name,u.phone_number,u.state,u.create_time,
|
select distinct u.user_id,u.user_name,u.nick_name,u.phone_number,u.state,u.create_time,
|
||||||
d.dept_name,u.user_type,u.sex,u.avatar,d.dept_id as leaderDeptId
|
d.dept_name,u.user_type,u.sex,u.avatar,d.dept_id as leaderDeptId
|
||||||
from sys_user u
|
from sys_user u
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insert" parameterType="cn.fateverse.common.core.entity.UserBase" useGeneratedKeys="true" keyProperty="userId"
|
<insert id="insert" parameterType="cn.fateverse.common.core.entity.User" useGeneratedKeys="true" keyProperty="userId"
|
||||||
keyColumn="user_id">
|
keyColumn="user_id">
|
||||||
insert into sys_user
|
insert into sys_user
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|||||||
@@ -32,4 +32,22 @@
|
|||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
<select id="selectRoleByUserId" resultType="cn.fateverse.common.core.entity.Role">
|
||||||
|
select r.role_id,
|
||||||
|
r.role_name,
|
||||||
|
r.role_key,
|
||||||
|
r.role_sort,
|
||||||
|
r.data_scope,
|
||||||
|
r.`state`,
|
||||||
|
r.del_flag,
|
||||||
|
r.create_by,
|
||||||
|
r.create_time,
|
||||||
|
r.update_by,
|
||||||
|
r.update_time,
|
||||||
|
r.remark,
|
||||||
|
r.role_type
|
||||||
|
from sys_role r
|
||||||
|
left join sys_user_role ur on r.role_id = ur.role_id
|
||||||
|
where ur.user_id = #{userId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -125,9 +125,9 @@ logging.resolver=${SW_LOGGING_RESOLVER:PATTERN}
|
|||||||
# * %level means log level.
|
# * %level means log level.
|
||||||
# * %timestamp means now of time with format yyyy-MM-dd HH:mm:ss:SSS.
|
# * %timestamp means now of time with format yyyy-MM-dd HH:mm:ss:SSS.
|
||||||
# * %thread means name of current thread.
|
# * %thread means name of current thread.
|
||||||
# * %msg means some message which user logged.
|
# * %msg means some message which userDetail logged.
|
||||||
# * %class means SimpleName of TargetClass.
|
# * %class means SimpleName of TargetClass.
|
||||||
# * %throwable means a throwable which user called.
|
# * %throwable means a throwable which userDetail called.
|
||||||
# * %agent_name means agent.service_name. Only apply to the PatternLogger.
|
# * %agent_name means agent.service_name. Only apply to the PatternLogger.
|
||||||
logging.pattern=${SW_LOGGING_PATTERN:%level %timestamp %thread %class : %msg %throwable}
|
logging.pattern=${SW_LOGGING_PATTERN:%level %timestamp %thread %class : %msg %throwable}
|
||||||
# Logging max_file_size, default: 300 * 1024 * 1024 = 314572800
|
# Logging max_file_size, default: 300 * 1024 * 1024 = 314572800
|
||||||
@@ -155,7 +155,7 @@ jvm.buffer_size=${SW_JVM_BUFFER_SIZE:600}
|
|||||||
buffer.channel_size=${SW_BUFFER_CHANNEL_SIZE:5}
|
buffer.channel_size=${SW_BUFFER_CHANNEL_SIZE:5}
|
||||||
# The buffer size.
|
# The buffer size.
|
||||||
buffer.buffer_size=${SW_BUFFER_BUFFER_SIZE:300}
|
buffer.buffer_size=${SW_BUFFER_BUFFER_SIZE:300}
|
||||||
# If true, skywalking agent will enable profile when user create a new profile task. Otherwise disable profile.
|
# If true, skywalking agent will enable profile when userDetail create a new profile task. Otherwise disable profile.
|
||||||
profile.active=${SW_AGENT_PROFILE_ACTIVE:true}
|
profile.active=${SW_AGENT_PROFILE_ACTIVE:true}
|
||||||
# Parallel monitor segment count
|
# Parallel monitor segment count
|
||||||
profile.max_parallel=${SW_AGENT_PROFILE_MAX_PARALLEL:5}
|
profile.max_parallel=${SW_AGENT_PROFILE_MAX_PARALLEL:5}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@
|
|||||||
<groupId>cn.fateverse</groupId>
|
<groupId>cn.fateverse</groupId>
|
||||||
<artifactId>common-file</artifactId>
|
<artifactId>common-file</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.fateverse</groupId>
|
||||||
|
<artifactId>admin-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,34 @@
|
|||||||
package cn.fateverse.auth.service;
|
package cn.fateverse.auth.service;
|
||||||
|
|
||||||
import cn.fateverse.admin.dubbo.DubboUserService;
|
import cn.fateverse.admin.dubbo.DubboUserService;
|
||||||
|
import cn.fateverse.common.core.entity.LoginUser;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
import cn.fateverse.common.core.enums.UserState;
|
import cn.fateverse.common.core.enums.UserState;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
import cn.fateverse.common.core.utils.ObjectUtils;
|
import cn.fateverse.common.core.utils.ObjectUtils;
|
||||||
import cn.fateverse.common.core.entity.LoginUser;
|
|
||||||
import cn.fateverse.admin.entity.User;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/10/27
|
* @date 2022/10/27
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Service
|
||||||
public class UserDetailsServiceImpl implements UserDetailsService {
|
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private DubboUserService userService;
|
private DubboUserService userService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
//todo 编辑用户登录相关逻辑
|
//todo 编辑用户登录相关逻辑
|
||||||
log.info("有用户登录:{}",username);
|
log.info("有用户登录:{}", username);
|
||||||
User user = userService.getUserByUsername(username);
|
UserDetail user = userService.getUserDetailsByUserName(username);
|
||||||
if (ObjectUtils.isEmpty(user)) {
|
if (ObjectUtils.isEmpty(user)) {
|
||||||
log.info("登录用户:{} 不存在.", username);
|
log.info("登录用户:{} 不存在.", username);
|
||||||
throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
|
throw new UsernameNotFoundException("登录用户:" + username + " 不存在");
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
package cn.fateverse.auth.service.impl;
|
package cn.fateverse.auth.service.impl;
|
||||||
|
|
||||||
import cn.fateverse.auth.entity.UserInfo;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.fateverse.admin.dubbo.DubboMenuService;
|
import cn.fateverse.admin.dubbo.DubboMenuService;
|
||||||
import cn.fateverse.admin.dubbo.DubboUserService;
|
import cn.fateverse.admin.dubbo.DubboUserService;
|
||||||
import cn.fateverse.admin.vo.RouterVo;
|
import cn.fateverse.admin.vo.RouterVo;
|
||||||
import cn.fateverse.auth.entity.LoginBody;
|
import cn.fateverse.auth.entity.LoginBody;
|
||||||
|
import cn.fateverse.auth.entity.UserInfo;
|
||||||
|
import cn.fateverse.auth.event.LoginInfoEvent;
|
||||||
import cn.fateverse.auth.service.LoginService;
|
import cn.fateverse.auth.service.LoginService;
|
||||||
import cn.fateverse.admin.entity.Role;
|
import cn.fateverse.auth.utils.LoginInfoUtil;
|
||||||
import cn.fateverse.admin.entity.User;
|
|
||||||
import cn.fateverse.common.core.constant.CacheConstants;
|
import cn.fateverse.common.core.constant.CacheConstants;
|
||||||
import cn.fateverse.common.core.constant.DateConstants;
|
import cn.fateverse.common.core.constant.DateConstants;
|
||||||
|
import cn.fateverse.common.core.entity.LoginUser;
|
||||||
|
import cn.fateverse.common.core.entity.Role;
|
||||||
|
import cn.fateverse.common.core.entity.User;
|
||||||
import cn.fateverse.common.core.exception.CustomException;
|
import cn.fateverse.common.core.exception.CustomException;
|
||||||
import cn.fateverse.common.core.exception.UserPasswordNotMatchException;
|
import cn.fateverse.common.core.exception.UserPasswordNotMatchException;
|
||||||
import cn.fateverse.common.core.utils.SpringContextHolder;
|
import cn.fateverse.common.core.utils.SpringContextHolder;
|
||||||
import cn.fateverse.common.core.utils.uuid.IdUtils;
|
import cn.fateverse.common.core.utils.uuid.IdUtils;
|
||||||
import cn.fateverse.common.core.entity.LoginUser;
|
|
||||||
import cn.fateverse.common.security.service.TokenService;
|
import cn.fateverse.common.security.service.TokenService;
|
||||||
import cn.fateverse.common.security.utils.SecurityUtils;
|
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||||
import cn.fateverse.auth.event.LoginInfoEvent;
|
|
||||||
import cn.fateverse.auth.utils.LoginInfoUtil;
|
|
||||||
import cn.fateverse.log.entity.LoginInfo;
|
import cn.fateverse.log.entity.LoginInfo;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package cn.fateverse.auth.service.impl;
|
package cn.fateverse.auth.service.impl;
|
||||||
|
|
||||||
import cn.fateverse.admin.dubbo.DubboMenuService;
|
import cn.fateverse.admin.dubbo.DubboMenuService;
|
||||||
import cn.fateverse.admin.entity.User;
|
|
||||||
import cn.fateverse.common.core.entity.LoginUser;
|
import cn.fateverse.common.core.entity.LoginUser;
|
||||||
|
import cn.fateverse.common.core.entity.UserDetail;
|
||||||
|
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,9 +28,9 @@ public class PermissionService {
|
|||||||
* @param loginUser 登录用户
|
* @param loginUser 登录用户
|
||||||
*/
|
*/
|
||||||
public void getMenuPermission(LoginUser loginUser) {
|
public void getMenuPermission(LoginUser loginUser) {
|
||||||
User user = loginUser.getUser();
|
UserDetail user = loginUser.getUser();
|
||||||
Set<String> perms = new HashSet<>();
|
Set<String> perms = new HashSet<>();
|
||||||
if (user.isAdmin()) {
|
if (SecurityUtils.isAdmin(user.getUserId())) {
|
||||||
perms.add("*:*:*");
|
perms.add("*:*:*");
|
||||||
} else {
|
} else {
|
||||||
Set<String> menuSet = menuService.selectMenuPermsByUserId(user.getUserId());
|
Set<String> menuSet = menuService.selectMenuPermsByUserId(user.getUserId());
|
||||||
|
|||||||
@@ -60,6 +60,12 @@
|
|||||||
<artifactId>spring-security-core</artifactId>
|
<artifactId>spring-security-core</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-annotation</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package cn.fateverse.common.core.entity;
|
package cn.fateverse.common.core.entity;
|
||||||
|
|
||||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -16,14 +19,16 @@ import javax.validation.constraints.Pattern;
|
|||||||
* @date 2022/10/30
|
* @date 2022/10/30
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@TableName("sys_dept")
|
||||||
@EnableAutoField
|
@EnableAutoField
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class Dept extends BaseEntity {
|
public class Dept extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +68,7 @@ public class Dept extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 联系电话
|
* 联系电话
|
||||||
*/
|
*/
|
||||||
@Pattern(message = "手机号格式错误!",regexp = "^1[0-9]{10}$")
|
@Pattern(message = "手机号格式错误!", regexp = "^1[0-9]{10}$")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,5 +88,4 @@ public class Dept extends BaseEntity {
|
|||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package cn.fateverse.common.core.entity;
|
package cn.fateverse.common.core.entity;
|
||||||
|
|
||||||
import cn.fateverse.admin.entity.User;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -17,7 +15,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class LoginUser implements UserDetails {
|
public class LoginUser implements org.springframework.security.core.userdetails.UserDetails {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户唯一标识
|
* 用户唯一标识
|
||||||
@@ -37,7 +35,7 @@ public class LoginUser implements UserDetails {
|
|||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*/
|
*/
|
||||||
private User user;
|
private UserDetail user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录ip
|
* 登录ip
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
package cn.fateverse.common.core.entity;
|
package cn.fateverse.common.core.entity;
|
||||||
|
|
||||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.*;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/10/30
|
* @date 2022/10/30
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
|
||||||
@EnableAutoField
|
@EnableAutoField
|
||||||
@AllArgsConstructor
|
@TableName("sys_role")
|
||||||
@NoArgsConstructor
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class Role extends BaseEntity {
|
public class Role extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色ID
|
* 角色ID
|
||||||
*/
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,38 +1,111 @@
|
|||||||
package cn.fateverse.common.core.entity;
|
package cn.fateverse.common.core.entity;
|
||||||
|
|
||||||
|
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Clay
|
* @author Clay
|
||||||
* @date 2022/10/27
|
* @date 2022/11/7
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EnableAutoField
|
||||||
|
@TableName("sys_user")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class User extends UserBase {
|
public class User extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门对象
|
* 用户ID
|
||||||
*/
|
*/
|
||||||
private Dept dept;
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色对象
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
private List<Role> roles;
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户账号
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户性别
|
||||||
|
*/
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盐加密
|
||||||
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isAdmin() {
|
private String salt;
|
||||||
return isAdmin(super.getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帐号状态(1正常 0停用)
|
||||||
|
*/
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public static boolean isAdmin(Long userId) {
|
private String delFlag;
|
||||||
return userId != null && 1L == userId;
|
/**
|
||||||
}
|
* 用户类型
|
||||||
|
*/
|
||||||
|
private String userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一个微信开放平台帐号下的应用,同一用户的 union
|
||||||
|
*/
|
||||||
|
private String unionId;
|
||||||
|
/**
|
||||||
|
* 用户唯一标识
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录IP
|
||||||
|
*/
|
||||||
|
private String loginIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后登录时间
|
||||||
|
*/
|
||||||
|
private Date loginDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
package cn.fateverse.common.core.entity;
|
|
||||||
|
|
||||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Clay
|
|
||||||
* @date 2022/11/7
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@EnableAutoField
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class UserBase extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门ID
|
|
||||||
*/
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户账号
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户昵称
|
|
||||||
*/
|
|
||||||
private String nickName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号码
|
|
||||||
*/
|
|
||||||
private String phoneNumber;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户性别
|
|
||||||
*/
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户头像
|
|
||||||
*/
|
|
||||||
private String avatar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 盐加密
|
|
||||||
*/
|
|
||||||
@JsonIgnore
|
|
||||||
private String salt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 帐号状态(1正常 0停用)
|
|
||||||
*/
|
|
||||||
private String state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标志(0代表存在 2代表删除)
|
|
||||||
*/
|
|
||||||
@JsonIgnore
|
|
||||||
private String delFlag;
|
|
||||||
/**
|
|
||||||
* 用户类型
|
|
||||||
*/
|
|
||||||
private String userType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一个微信开放平台帐号下的应用,同一用户的 union
|
|
||||||
*/
|
|
||||||
private String unionId;
|
|
||||||
/**
|
|
||||||
* 用户唯一标识
|
|
||||||
*/
|
|
||||||
private String openId;
|
|
||||||
/**
|
|
||||||
* 城市
|
|
||||||
*/
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后登录IP
|
|
||||||
*/
|
|
||||||
private String loginIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后登录时间
|
|
||||||
*/
|
|
||||||
private Date loginDate;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.fateverse.common.core.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Clay
|
||||||
|
* @date 2022/10/27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class UserDetail extends User {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门对象
|
||||||
|
*/
|
||||||
|
private Dept dept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色对象
|
||||||
|
*/
|
||||||
|
private List<Role> roles;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return isAdmin(super.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public static boolean isAdmin(Long userId) {
|
||||||
|
return userId != null && 1L == userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
<artifactId>common-mybatis-puls</artifactId>
|
<artifactId>common-mybatis-puls</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.fateverse.common.mybatisplus.utils;
|
|||||||
import cn.fateverse.common.core.entity.PageInfo;
|
import cn.fateverse.common.core.entity.PageInfo;
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||||
import cn.fateverse.common.core.utils.TableSupport;
|
import cn.fateverse.common.core.utils.TableSupport;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -26,11 +27,21 @@ public class PageConditionUtil {
|
|||||||
* @param <R> 需要转换的对象类型
|
* @param <R> 需要转换的对象类型
|
||||||
* @return 转换后的对象
|
* @return 转换后的对象
|
||||||
*/
|
*/
|
||||||
public static <T, R> TableDataInfo<T> convertDataTable(Page<R> page, Function<R, T> map) {
|
public static <T, R> TableDataInfo<T> convertDataTable(IPage<R> page, Function<R, T> map) {
|
||||||
List<T> convertList = page.getRecords().stream().map(map).collect(Collectors.toList());
|
List<T> convertList = page.getRecords().stream().map(map).collect(Collectors.toList());
|
||||||
return convertDataTable(convertList, page.getTotal());
|
return convertDataTable(convertList, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为TableDataInfo对象
|
||||||
|
*
|
||||||
|
* @param page 源对象
|
||||||
|
* @return 转换后的对象
|
||||||
|
*/
|
||||||
|
public static <T> TableDataInfo<T> convertDataTable(IPage<T> page) {
|
||||||
|
return convertDataTable(page.getRecords(), page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为TableDataInfo对象
|
* 转换为TableDataInfo对象
|
||||||
@@ -50,7 +61,7 @@ public class PageConditionUtil {
|
|||||||
return tableDataInfo;
|
return tableDataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Page<T> getPage(){
|
public static <T> IPage<T> getPage() {
|
||||||
PageInfo pageInfo = TableSupport.getPageInfo();
|
PageInfo pageInfo = TableSupport.getPageInfo();
|
||||||
return new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
|
return new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
package cn.fateverse.common.mybatisplus.utils;
|
|
||||||
|
|
||||||
import cn.fateverse.common.core.entity.PageInfo;
|
|
||||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
|
||||||
import cn.fateverse.common.core.utils.TableSupport;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Clay
|
|
||||||
* @date 2023-05-25
|
|
||||||
*/
|
|
||||||
public class PageUtils {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换为TableDataInfo对象
|
|
||||||
*
|
|
||||||
* @param page 源对象
|
|
||||||
* @param map 转换方法
|
|
||||||
* @param <T> 转换后的对象类型
|
|
||||||
* @param <R> 需要转换的对象类型
|
|
||||||
* @return 转换后的对象
|
|
||||||
*/
|
|
||||||
public static <T, R> TableDataInfo<T> convertDataTable(Page<R> page, Function<R, T> map) {
|
|
||||||
List<T> convertList = page.getRecords().stream().map(map).collect(Collectors.toList());
|
|
||||||
return convertDataTable(convertList, page.getTotal());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换为TableDataInfo对象
|
|
||||||
*
|
|
||||||
* @param list
|
|
||||||
* @param count
|
|
||||||
* @param <T>
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T> TableDataInfo<T> convertDataTable(List<T> list, Long count) {
|
|
||||||
if (null == list) {
|
|
||||||
return new TableDataInfo<>(new ArrayList<>(), 0);
|
|
||||||
}
|
|
||||||
TableDataInfo<T> tableDataInfo = new TableDataInfo<>();
|
|
||||||
tableDataInfo.setRows(list);
|
|
||||||
tableDataInfo.setTotal(count);
|
|
||||||
return tableDataInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Page<T> getPage(){
|
|
||||||
PageInfo pageInfo = TableSupport.getPageInfo();
|
|
||||||
return new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,6 +56,10 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-reactor-netty</artifactId>
|
<artifactId>spring-boot-starter-reactor-netty</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.fateverse</groupId>
|
||||||
|
<artifactId>admin-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
1
pom.xml
1
pom.xml
@@ -45,6 +45,7 @@
|
|||||||
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
||||||
<swagger.annotations.version>1.6.8</swagger.annotations.version>
|
<swagger.annotations.version>1.6.8</swagger.annotations.version>
|
||||||
<spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
|
||||||
|
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ CREATE TABLE `sys_menu` (
|
|||||||
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 'D', 1, 'system', NULL, ' ', '0', 0, 1, 1, '0', '1', '', 'setting', '1', '2018-03-16 11:33:00', 'admin', '2023-10-23 20:48:54', '系统管理目录');
|
INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 'D', 1, 'system', NULL, ' ', '0', 0, 1, 1, '0', '1', '', 'setting', '1', '2018-03-16 11:33:00', 'admin', '2023-10-23 20:48:54', '系统管理目录');
|
||||||
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 'D', 2, 'monitor', NULL, NULL, '0', 0, 1, 1, '0', '1', '', 'data_board', '0', '2018-03-16 11:33:00', 'admin', '2023-10-23 21:00:29', '系统监控目录');
|
INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 'D', 2, 'monitor', NULL, NULL, '0', 0, 1, 1, '0', '1', '', 'data_board', '0', '2018-03-16 11:33:00', 'admin', '2023-10-23 21:00:29', '系统监控目录');
|
||||||
INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 'D', 3, 'tool', NULL, NULL, '0', 0, 1, 1, '0', '1', '', 'mokuaiguanli', '0', '2018-03-16 11:33:00', 'admin', '2023-10-23 21:00:54', '系统工具目录');
|
INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 'D', 3, 'tool', NULL, NULL, '0', 0, 1, 1, '0', '1', '', 'mokuaiguanli', '0', '2018-03-16 11:33:00', 'admin', '2023-10-23 21:00:54', '系统工具目录');
|
||||||
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 'M', 1, 'user', '{\"userId\": \"123\"}', 'system/user/index', '0', 0, 0, 1, '0', '1', 'system:user:list', 'User', '0', '2018-03-16 11:33:00', 'admin', '2023-08-23 14:39:12', '用户管理菜单');
|
INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 'M', 1, 'userDetail', '{\"userId\": \"123\"}', 'system/userDetail/index', '0', 0, 0, 1, '0', '1', 'system:userDetail:list', 'User', '0', '2018-03-16 11:33:00', 'admin', '2023-08-23 14:39:12', '用户管理菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 'M', 2, 'role', NULL, 'system/role/index', '0', 0, 0, 1, '0', '1', 'system:role:list', 'Avatar', '0', '2018-03-16 11:33:00', 'admin', '2023-06-02 15:30:09', '角色管理菜单');
|
INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 'M', 2, 'role', NULL, 'system/role/index', '0', 0, 0, 1, '0', '1', 'system:role:list', 'Avatar', '0', '2018-03-16 11:33:00', 'admin', '2023-06-02 15:30:09', '角色管理菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 'M', 3, 'menu', NULL, 'system/menu/index', '0', 0, 0, 1, '0', '1', 'system:menu:list', 'Menu', '0', '2018-03-16 11:33:00', 'admin', '2023-05-21 20:21:57', '菜单管理菜单');
|
INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 'M', 3, 'menu', NULL, 'system/menu/index', '0', 0, 0, 1, '0', '1', 'system:menu:list', 'Menu', '0', '2018-03-16 11:33:00', 'admin', '2023-05-21 20:21:57', '菜单管理菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (103, '部门管理', 1, 'M', 4, 'dept', NULL, 'system/dept/index', '0', 0, 0, 1, '0', '1', 'system:dept:list', 'bumenguanli', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:04:53', '部门管理菜单');
|
INSERT INTO `sys_menu` VALUES (103, '部门管理', 1, 'M', 4, 'dept', NULL, 'system/dept/index', '0', 0, 0, 1, '0', '1', 'system:dept:list', 'bumenguanli', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:04:53', '部门管理菜单');
|
||||||
@@ -292,13 +292,13 @@ INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 'M', 1, 'online', NULL, '
|
|||||||
INSERT INTO `sys_menu` VALUES (114, '代码生成', 1151, 'M', 2, 'gen', NULL, 'rapid/gen/index', '0', 0, 0, 1, '0', '1', 'rapid:gen:list', 'daimashengcheng', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:23:31', '代码生成菜单');
|
INSERT INTO `sys_menu` VALUES (114, '代码生成', 1151, 'M', 2, 'gen', NULL, 'rapid/gen/index', '0', 0, 0, 1, '0', '1', 'rapid:gen:list', 'daimashengcheng', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:23:31', '代码生成菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 'M', 1, 'operlog', NULL, 'monitor/operlog/index', '0', 0, 0, 1, '0', '1', 'monitor:operlog:list', 'caozuorizhi', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:13:51', '操作日志菜单');
|
INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 'M', 1, 'operlog', NULL, 'monitor/operlog/index', '0', 0, 0, 1, '0', '1', 'monitor:operlog:list', 'caozuorizhi', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:13:51', '操作日志菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 'M', 2, 'logininfor', NULL, 'monitor/logininfor/index', '0', 0, 0, 1, '0', '1', 'monitor:logininfor:list', 'guanlidenglurizhi', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:14:26', '登录日志菜单');
|
INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 'M', 2, 'logininfor', NULL, 'monitor/logininfor/index', '0', 0, 0, 1, '0', '1', 'monitor:logininfor:list', 'guanlidenglurizhi', '0', '2018-03-16 11:33:00', 'admin', '2023-07-19 17:14:26', '登录日志菜单');
|
||||||
INSERT INTO `sys_menu` VALUES (1001, '用户查询', 100, 'B', 1, '', NULL, '', '0', 0, 1, 1, '0', '1', 'admin:user:list', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1001, '用户查询', 100, 'B', 1, '', NULL, '', '0', 0, 1, 1, '0', '1', 'admin:userDetail:list', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1002, '用户新增', 100, 'B', 2, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:add', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1002, '用户新增', 100, 'B', 2, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:add', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1003, '用户修改', 100, 'B', 3, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:edit', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1003, '用户修改', 100, 'B', 3, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:edit', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1004, '用户删除', 100, 'B', 4, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:remove', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1004, '用户删除', 100, 'B', 4, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:remove', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1005, '用户导出', 100, 'B', 5, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:export', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1005, '用户导出', 100, 'B', 5, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:export', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1006, '用户导入', 100, 'B', 6, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:import', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1006, '用户导入', 100, 'B', 6, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:import', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1007, '重置密码', 100, 'B', 7, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:user:resetPwd', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1007, '重置密码', 100, 'B', 7, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:userDetail:resetPwd', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1008, '角色查询', 101, 'B', 1, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:query', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1008, '角色查询', 101, 'B', 1, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:query', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1009, '角色新增', 101, 'B', 2, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:add', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1009, '角色新增', 101, 'B', 2, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:add', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
INSERT INTO `sys_menu` VALUES (1010, '角色修改', 101, 'B', 3, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:edit', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
INSERT INTO `sys_menu` VALUES (1010, '角色修改', 101, 'B', 3, '', NULL, '', '0', 0, 1, 1, '0', '1', 'system:role:edit', '', '0', '2018-03-16 11:33:00', '0', '2018-03-16 11:33:00', '');
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ jobconf_trigger_type_api=Api trigger
|
|||||||
jobconf_trigger_type_retry=Fail retry trigger
|
jobconf_trigger_type_retry=Fail retry trigger
|
||||||
jobconf_trigger_type_misfire=Misfire compensation trigger
|
jobconf_trigger_type_misfire=Misfire compensation trigger
|
||||||
|
|
||||||
## user
|
## userDetail
|
||||||
user_manage=User Manage
|
user_manage=User Manage
|
||||||
user_username=Username
|
user_username=Username
|
||||||
user_password=Password
|
user_password=Password
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ jobconf_trigger_type_api=API触发
|
|||||||
jobconf_trigger_type_retry=失败重试触发
|
jobconf_trigger_type_retry=失败重试触发
|
||||||
jobconf_trigger_type_misfire=调度过期补偿
|
jobconf_trigger_type_misfire=调度过期补偿
|
||||||
|
|
||||||
## user
|
## userDetail
|
||||||
user_manage=用户管理
|
user_manage=用户管理
|
||||||
user_username=账号
|
user_username=账号
|
||||||
user_password=密码
|
user_password=密码
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ jobconf_trigger_type_api=API觸發
|
|||||||
jobconf_trigger_type_retry=失敗重試觸發
|
jobconf_trigger_type_retry=失敗重試觸發
|
||||||
jobconf_trigger_type_misfire=調度過期補償
|
jobconf_trigger_type_misfire=調度過期補償
|
||||||
|
|
||||||
## user
|
## userDetail
|
||||||
user_manage=用户管理
|
user_manage=用户管理
|
||||||
user_username=帳號
|
user_username=帳號
|
||||||
user_password=密碼
|
user_password=密碼
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ l502 -73q56 -9 56 -46z" />
|
|||||||
<glyph glyph-name="star_empty" unicode="" horiz-adv-x="1664"
|
<glyph glyph-name="star_empty" unicode="" horiz-adv-x="1664"
|
||||||
d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500
|
d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500
|
||||||
l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" />
|
l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" />
|
||||||
<glyph glyph-name="user" unicode="" horiz-adv-x="1280"
|
<glyph glyph-name="userDetail" unicode="" horiz-adv-x="1280"
|
||||||
d="M1280 137q0 -109 -62.5 -187t-150.5 -78h-854q-88 0 -150.5 78t-62.5 187q0 85 8.5 160.5t31.5 152t58.5 131t94 89t134.5 34.5q131 -128 313 -128t313 128q76 0 134.5 -34.5t94 -89t58.5 -131t31.5 -152t8.5 -160.5zM1024 1024q0 -159 -112.5 -271.5t-271.5 -112.5
|
d="M1280 137q0 -109 -62.5 -187t-150.5 -78h-854q-88 0 -150.5 78t-62.5 187q0 85 8.5 160.5t31.5 152t58.5 131t94 89t134.5 34.5q131 -128 313 -128t313 128q76 0 134.5 -34.5t94 -89t58.5 -131t31.5 -152t8.5 -160.5zM1024 1024q0 -159 -112.5 -271.5t-271.5 -112.5
|
||||||
t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" />
|
t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" />
|
||||||
<glyph glyph-name="film" unicode="" horiz-adv-x="1920"
|
<glyph glyph-name="film" unicode="" horiz-adv-x="1920"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
@@ -6,7 +6,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<!-- Tell the browser to be responsive to screen width -->
|
<!-- Tell the browser to be responsive to screen width -->
|
||||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1, userDetail-scalable=no" name="viewport">
|
||||||
<!-- Bootstrap -->
|
<!-- Bootstrap -->
|
||||||
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/bower_components/bootstrap/css/bootstrap.min.css">
|
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/bower_components/bootstrap/css/bootstrap.min.css">
|
||||||
<!-- Font Awesome -->
|
<!-- Font Awesome -->
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<div class="navbar-custom-menu">
|
<div class="navbar-custom-menu">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<#-- login user -->
|
<#-- login userDetail -->
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
<a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||||
${I18n.system_welcome} ${Request["XXL_JOB_LOGIN_IDENTITY"].username}
|
${I18n.system_welcome} ${Request["XXL_JOB_LOGIN_IDENTITY"].username}
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
<li class="nav-click <#if pageName == "joblog">active</#if>" ><a href="${request.contextPath}/joblog"><i class="fa fa-circle-o text-green"></i><span>${I18n.joblog_name}</span></a></li>
|
<li class="nav-click <#if pageName == "joblog">active</#if>" ><a href="${request.contextPath}/joblog"><i class="fa fa-circle-o text-green"></i><span>${I18n.joblog_name}</span></a></li>
|
||||||
<#if Request["XXL_JOB_LOGIN_IDENTITY"].role == 1>
|
<#if Request["XXL_JOB_LOGIN_IDENTITY"].role == 1>
|
||||||
<li class="nav-click <#if pageName == "jobgroup">active</#if>" ><a href="${request.contextPath}/jobgroup"><i class="fa fa-circle-o text-red"></i><span>${I18n.jobgroup_name}</span></a></li>
|
<li class="nav-click <#if pageName == "jobgroup">active</#if>" ><a href="${request.contextPath}/jobgroup"><i class="fa fa-circle-o text-red"></i><span>${I18n.jobgroup_name}</span></a></li>
|
||||||
<li class="nav-click <#if pageName == "user">active</#if>" ><a href="${request.contextPath}/user"><i class="fa fa-circle-o text-purple"></i><span>${I18n.user_manage}</span></a></li>
|
<li class="nav-click <#if pageName == "userDetail">active</#if>" ><a href="${request.contextPath}/userDetail"><i class="fa fa-circle-o text-purple"></i><span>${I18n.user_manage}</span></a></li>
|
||||||
</#if>
|
</#if>
|
||||||
<li class="nav-click <#if pageName == "help">active</#if>" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-gray"></i><span>${I18n.job_help}</span></a></li>
|
<li class="nav-click <#if pageName == "help">active</#if>" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-gray"></i><span>${I18n.job_help}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="javascript::;">
|
<a href="javascript::;">
|
||||||
<i class="menu-icon fa fa-user bg-yellow"></i>
|
<i class="menu-icon fa fa-userDetail bg-yellow"></i>
|
||||||
<div class="menu-info">
|
<div class="menu-info">
|
||||||
<h4 class="control-sidebar-subheading">Frodo 更新了资料</h4>
|
<h4 class="control-sidebar-subheading">Frodo 更新了资料</h4>
|
||||||
<p>更新手机号码 +1(800)555-1234</p>
|
<p>更新手机号码 +1(800)555-1234</p>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<p>
|
<p>
|
||||||
<a target="_blank" href="https://github.com/xuxueli/xxl-job">Github</a>
|
<a target="_blank" href="https://github.com/xuxueli/xxl-job">Github</a>
|
||||||
<iframe src="https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe>
|
<iframe src="https://ghbtns.com/github-btn.html?userDetail=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe>
|
||||||
<br><br>
|
<br><br>
|
||||||
<a target="_blank" href="https://www.xuxueli.com/xxl-job/">${I18n.job_help_document}</a>
|
<a target="_blank" href="https://www.xuxueli.com/xxl-job/">${I18n.job_help_document}</a>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- header -->
|
<!-- header -->
|
||||||
<@netCommon.commonHeader />
|
<@netCommon.commonHeader />
|
||||||
<!-- left -->
|
<!-- left -->
|
||||||
<@netCommon.commonLeft "user" />
|
<@netCommon.commonLeft "userDetail" />
|
||||||
|
|
||||||
<!-- Content Wrapper. Contains page content -->
|
<!-- Content Wrapper. Contains page content -->
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
@@ -183,6 +183,6 @@
|
|||||||
<!-- DataTables -->
|
<!-- DataTables -->
|
||||||
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
|
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
|
||||||
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
|
<script src="${request.contextPath}/static/adminlte/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
|
||||||
<script src="${request.contextPath}/static/js/user.index.1.js"></script>
|
<script src="${request.contextPath}/static/js/userDetail.index.1.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -120,6 +120,10 @@
|
|||||||
<groupId>cn.fateverse</groupId>
|
<groupId>cn.fateverse</groupId>
|
||||||
<artifactId>common-excel</artifactId>
|
<artifactId>common-excel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.fateverse</groupId>
|
||||||
|
<artifactId>admin-api</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
<if test="state != null">state,</if>
|
<if test="state != null">state,</if>
|
||||||
<if test="startTime != null ">start_time,</if>
|
<if test="startTime != null ">start_time,</if>
|
||||||
<if test="finishTime != null ">finish_time,</if>
|
<if test="finishTime != null ">finish_time,</if>
|
||||||
<if test="userInfo != null and userInfo != ''">user_info,</if>
|
<if test="userDetail != null and userDetail != ''">user_info,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="taskId != null and taskId != ''">#{taskId},</if>
|
<if test="taskId != null and taskId != ''">#{taskId},</if>
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
<if test="state != null">#{state},</if>
|
<if test="state != null">#{state},</if>
|
||||||
<if test="startTime != null ">#{startTime},</if>
|
<if test="startTime != null ">#{startTime},</if>
|
||||||
<if test="finishTime != null ">#{finishTime},</if>
|
<if test="finishTime != null ">#{finishTime},</if>
|
||||||
<if test="userInfo != null and userInfo != ''">#{userInfo},</if>
|
<if test="userDetail != null and userDetail != ''">#{userDetail},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<set>
|
<set>
|
||||||
<if test="finishTime != null ">finish_time = #{finishTime},</if>
|
<if test="finishTime != null ">finish_time = #{finishTime},</if>
|
||||||
<if test="state != null">state = #{state},</if>
|
<if test="state != null">state = #{state},</if>
|
||||||
<if test="userInfo != null and userInfo != ''">user_info = #{userInfo},</if>
|
<if test="userDetail != null and userDetail != ''">user_info = #{userDetail},</if>
|
||||||
<if test="message != null and message != ''">message = #{message},</if>
|
<if test="message != null and message != ''">message = #{message},</if>
|
||||||
</set>
|
</set>
|
||||||
where process_instance_id = #{processInstanceId} and node_id = #{nodeId}
|
where process_instance_id = #{processInstanceId} and node_id = #{nodeId}
|
||||||
@@ -145,9 +145,9 @@
|
|||||||
</trim>
|
</trim>
|
||||||
<trim prefix="user_info = case" suffix="end,">
|
<trim prefix="user_info = case" suffix="end,">
|
||||||
<foreach collection="list" separator=" " item="item">
|
<foreach collection="list" separator=" " item="item">
|
||||||
<if test="item.userInfo != null and item.userInfo != ''">
|
<if test="item.userDetail != null and item.userDetail != ''">
|
||||||
</if>
|
</if>
|
||||||
when task_id = #{item.taskId} then #{item.userInfo}
|
when task_id = #{item.taskId} then #{item.userDetail}
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="message = case" suffix="end,">
|
<trim prefix="message = case" suffix="end,">
|
||||||
|
|||||||
Reference in New Issue
Block a user