refactor(system): 重构系统模块中的菜单和角色关联关系
This commit is contained in:
+1
-1
@@ -21,7 +21,6 @@ import cn.odboy.system.dal.model.response.SystemAuthVo;
|
||||
import cn.odboy.system.service.SystemAuthService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -29,6 +28,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 授权、根据token获取用户详细信息
|
||||
|
||||
+3
-3
@@ -26,9 +26,6 @@ import cn.odboy.system.service.SystemDeptService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -39,6 +36,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:部门管理")
|
||||
|
||||
+3
-3
@@ -25,9 +25,6 @@ import cn.odboy.system.service.SystemDictService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -37,6 +34,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:字典管理")
|
||||
|
||||
+2
-2
@@ -25,8 +25,6 @@ import cn.odboy.system.service.SystemJobService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -36,6 +34,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:岗位管理")
|
||||
|
||||
+1
-1
@@ -24,7 +24,6 @@ import cn.odboy.system.service.SystemLocalStorageService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -36,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "工具:本地存储管理")
|
||||
|
||||
+5
-5
@@ -27,9 +27,6 @@ import cn.odboy.system.service.SystemMenuService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -40,6 +37,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:菜单管理")
|
||||
@@ -67,8 +67,8 @@ public class SystemMenuController {
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@PostMapping(value = "/listMenuByPid")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<List<SystemMenuVo>> listMenuByPid(@RequestParam Long pid) {
|
||||
List<SystemMenuVo> systemMenuTbs = systemMenuService.listMenuByPid(pid);
|
||||
public ResponseEntity<List<SystemMenuTb>> listMenuByPid(@RequestParam Long pid) {
|
||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.listMenuByPid(pid);
|
||||
return ResponseEntity.ok(systemMenuTbs);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,13 +19,13 @@ import cn.odboy.system.framework.operalog.OperationLog;
|
||||
import cn.odboy.system.service.SystemMonitorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统-服务监控管理")
|
||||
|
||||
+2
-2
@@ -24,8 +24,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -35,6 +33,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/user/online")
|
||||
|
||||
+1
-1
@@ -25,7 +25,6 @@ import cn.odboy.system.service.SystemOssStorageService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -38,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
||||
+2
-2
@@ -28,8 +28,6 @@ import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -41,6 +39,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
||||
+4
-4
@@ -27,9 +27,6 @@ import cn.odboy.system.service.SystemRoleService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -39,6 +36,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:角色管理")
|
||||
@@ -52,7 +52,7 @@ public class SystemRoleController {
|
||||
@PostMapping(value = "/getRoleById")
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<SystemRoleVo> getRoleById(@RequestBody SystemRoleTb args) {
|
||||
return ResponseEntity.ok(systemRoleService.getRoleById(args.getId()));
|
||||
return ResponseEntity.ok(systemRoleService.getRoleVoById(args.getId()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出角色数据")
|
||||
|
||||
+3
-3
@@ -30,9 +30,6 @@ import cn.odboy.system.service.SystemUserService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -45,6 +42,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Api(tags = "系统:用户管理")
|
||||
@RestController
|
||||
|
||||
+3
-3
@@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -21,9 +21,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -19,9 +19,9 @@ import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 邮件配置类,数据存覆盖式存入数据存
|
||||
|
||||
+3
-3
@@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -21,10 +21,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -23,10 +23,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -22,9 +22,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("system_quartz_log")
|
||||
|
||||
+3
-3
@@ -23,11 +23,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
|
||||
+4
-4
@@ -21,13 +21,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -17,11 +17,11 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryDeptArgs {
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryMenuArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryQuartzJobArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryRoleArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryStorageArgs {
|
||||
|
||||
+2
-2
@@ -17,12 +17,12 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -16,12 +16,12 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送邮件时,接收参数的类
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -18,11 +18,11 @@ package cn.odboy.system.dal.model.response;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 构建前端路由时用到
|
||||
|
||||
+2
-2
@@ -18,11 +18,11 @@ package cn.odboy.system.dal.model.response;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+4
-4
@@ -18,12 +18,13 @@ package cn.odboy.system.dal.model.response;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -45,7 +46,7 @@ public class SystemRoleVo extends KitBaseUserTimeTb {
|
||||
@ApiModelProperty(value = "用户", hidden = true)
|
||||
private Set<SystemUserTb> users;
|
||||
@ApiModelProperty(value = "菜单", hidden = true)
|
||||
private Set<SystemMenuVo> menus;
|
||||
private Set<SystemMenuTb> menus;
|
||||
@ApiModelProperty(value = "部门", hidden = true)
|
||||
private Set<SystemDeptTb> depts;
|
||||
|
||||
@@ -66,5 +67,4 @@ public class SystemRoleVo extends KitBaseUserTimeTb {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,9 +20,9 @@ import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -16,11 +16,11 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -17,12 +17,12 @@ package cn.odboy.system.dal.model.response;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
|
||||
+1
-1
@@ -16,8 +16,8 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 在线用户
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@ import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典明细 Mapper
|
||||
|
||||
+4
@@ -18,6 +18,7 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 Mapper
|
||||
@@ -27,4 +28,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemMenuMapper extends BaseMapper<SystemMenuTb> {
|
||||
|
||||
default List<SystemMenuTb> listAll() {
|
||||
return selectList(null);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色部门关联 Mapper
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 Mapper
|
||||
|
||||
+9
@@ -15,9 +15,13 @@
|
||||
*/
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 Mapper
|
||||
@@ -27,4 +31,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemRoleMenuMapper extends BaseMapper<SystemRoleMenuTb> {
|
||||
|
||||
Set<String> listMenuPermissionByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
|
||||
List<SystemMenuTb> listMenuWithRoleIdsNeButton(@Param("roleIds") Set<Long> roleIds);
|
||||
|
||||
List<SystemMenuTb> listMenuWithRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户职位关联 Mapper
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户 Mapper
|
||||
|
||||
+5
-3
@@ -18,14 +18,16 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface SystemUserRoleMapper extends BaseMapper<SystemUserRoleTb> {
|
||||
|
||||
Set<SystemRoleTb> listUserRoleByUserId(@Param("userId") Long userId);
|
||||
List<Integer> listUserRoleLevelByUserId(@Param("userId") Long userId);
|
||||
|
||||
Set<Integer> listUserRoleLevelByUserId(@Param("userId") Long userId);
|
||||
|
||||
Set<Long> listUserRoleIdByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
+5
-5
@@ -30,17 +30,17 @@ import cn.odboy.util.KitIPUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
||||
+1
-1
@@ -29,13 +29,13 @@ import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 用户认证
|
||||
|
||||
+1
-1
@@ -25,9 +25,9 @@ import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.model.response.SystemCaptchaVo;
|
||||
import cn.odboy.system.dal.redis.SystemCacheKey;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
|
||||
+2
-2
@@ -20,14 +20,14 @@ import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据权限
|
||||
|
||||
+6
-6
@@ -36,6 +36,10 @@ import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -47,10 +51,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDeptService {
|
||||
@@ -129,7 +129,7 @@ public class SystemDeptService {
|
||||
/**
|
||||
* 更新父节点中子节点数目 -> TestPassed
|
||||
*
|
||||
* @param deptId /
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeptSubCnt(Long deptId) {
|
||||
@@ -179,7 +179,7 @@ public class SystemDeptService {
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @param args 条件
|
||||
* @param args /
|
||||
* @param isQuery /
|
||||
* @return /
|
||||
* @throws Exception /
|
||||
|
||||
+3
-3
@@ -31,14 +31,14 @@ import cn.odboy.util.KitValidUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDictDetailService {
|
||||
|
||||
+4
-4
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemDictService {
|
||||
|
||||
+1
-1
@@ -30,11 +30,11 @@ import cn.odboy.system.dal.model.request.SystemSendEmailArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemEmailConfigMapper;
|
||||
import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitResourceTemplateUtil;
|
||||
import java.util.Collections;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Collections;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
||||
+4
-4
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemJobService {
|
||||
|
||||
+4
-4
@@ -35,16 +35,16 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
||||
+204
-93
@@ -27,7 +27,6 @@ import cn.odboy.system.dal.model.request.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuMetaVo;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuRouterVo;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
@@ -36,19 +35,20 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemMenuService {
|
||||
@@ -59,23 +59,27 @@ public class SystemMenuService {
|
||||
private SystemRoleMenuService systemRoleMenuService;
|
||||
@Autowired
|
||||
private SystemUserRoleService systemUserRoleService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SystemMenuService proxyService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMenu(SystemMenuTb args) {
|
||||
if (this.getMenuByTitle(args.getTitle()) != null) {
|
||||
if (this.existMenuWithTitle(args.getTitle())) {
|
||||
throw new BadRequestException("菜单标题已存在");
|
||||
}
|
||||
if (StrUtil.isNotBlank(args.getComponentName())) {
|
||||
if (this.getMenuByComponentName(args.getComponentName()) != null) {
|
||||
if (this.existMenuWithComponentName(args.getComponentName())) {
|
||||
throw new BadRequestException("菜单组件名称已存在");
|
||||
}
|
||||
}
|
||||
if (Long.valueOf(0L).equals(args.getPid())) {
|
||||
// 顶级目录
|
||||
args.setPid(null);
|
||||
}
|
||||
if (args.getIFrame()) {
|
||||
@@ -92,7 +96,57 @@ public class SystemMenuService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 根据组件名称查询菜单是否存在 -> TestPassed
|
||||
*
|
||||
* @param componentName 组件名称
|
||||
* @return /
|
||||
*/
|
||||
private boolean existMenuWithComponentName(String componentName) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getComponentName, componentName);
|
||||
return systemMenuMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组件名称查询菜单是否存在 -> TestPassed
|
||||
*
|
||||
* @param componentName 组件名称
|
||||
* @return /
|
||||
*/
|
||||
private boolean existMenuWithComponentNameNeSelf(String componentName, Long currentMenuId) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getComponentName, componentName);
|
||||
wrapper.ne(SystemMenuTb::getId, currentMenuId);
|
||||
return systemMenuMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单标题查询菜单是否存在 -> TestPassed
|
||||
*
|
||||
* @param title 菜单标题
|
||||
* @return /
|
||||
*/
|
||||
private boolean existMenuWithTitle(String title) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getTitle, title);
|
||||
return systemMenuMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单标题查询菜单是否存在 -> TestPassed
|
||||
*
|
||||
* @param title 菜单标题
|
||||
* @return /
|
||||
*/
|
||||
private boolean existMenuWithTitleNeSelf(String title, Long currentMenuId) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getTitle, title);
|
||||
wrapper.ne(SystemMenuTb::getId, currentMenuId);
|
||||
return systemMenuMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -108,8 +162,7 @@ public class SystemMenuService {
|
||||
throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
SystemMenuTb menu1 = this.getMenuByTitle(args.getTitle());
|
||||
if (menu1 != null && !menu1.getId().equals(menu.getId())) {
|
||||
if (this.existMenuWithTitleNeSelf(args.getTitle(), menu.getId())) {
|
||||
throw new BadRequestException("菜单标题已存在");
|
||||
}
|
||||
if (args.getPid().equals(0L)) {
|
||||
@@ -119,8 +172,7 @@ public class SystemMenuService {
|
||||
Long oldPid = menu.getPid();
|
||||
Long newPid = args.getPid();
|
||||
if (StrUtil.isNotBlank(args.getComponentName())) {
|
||||
menu1 = this.getMenuByComponentName(args.getComponentName());
|
||||
if (menu1 != null && !menu1.getId().equals(menu.getId())) {
|
||||
if (this.existMenuWithComponentNameNeSelf(args.getTitle(), menu.getId())) {
|
||||
throw new BadRequestException("菜单组件名称已存在");
|
||||
}
|
||||
}
|
||||
@@ -139,36 +191,101 @@ public class SystemMenuService {
|
||||
// auto fill
|
||||
menu.setUpdateBy(null);
|
||||
menu.setUpdateTime(null);
|
||||
systemMenuMapper.insertOrUpdate(menu);
|
||||
systemMenuMapper.updateById(menu);
|
||||
// 计算父级菜单节点数目
|
||||
this.updateMenuSubCnt(oldPid);
|
||||
this.updateMenuSubCnt(newPid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteMenuByIds(Set<Long> ids) {
|
||||
Set<SystemMenuVo> menuSet = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
List<SystemMenuVo> menuList = this.listMenuByPid(id);
|
||||
menuSet.add(this.getMenuVoById(id));
|
||||
menuSet = this.queryChildMenuByArgs(menuList, menuSet);
|
||||
// Set<SystemMenuVo> menuSet = new HashSet<>();
|
||||
// for (Long id : ids) {
|
||||
// List<SystemMenuVo> menuList = this.listMenuByPid(id);
|
||||
// menuSet.add(this.getMenuVoById(id));
|
||||
// menuSet = this.queryChildMenuByArgs(menuList, menuSet);
|
||||
// }
|
||||
// List<Long> menuIds = menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
// if (CollUtil.isNotEmpty(menuIds)) {
|
||||
// systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds);
|
||||
// systemMenuMapper.deleteByIds(menuIds);
|
||||
// }
|
||||
// for (SystemMenuVo menu : menuSet) {
|
||||
// this.updateMenuSubCnt(menu.getPid());
|
||||
// }
|
||||
// ========= 优化 20260114 =========
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
List<Long> menuIds =
|
||||
menuSet.stream().map(SystemMenuVo::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(menuIds)) {
|
||||
systemRoleMenuService.deleteRoleMenuByMenuIds(menuIds);
|
||||
systemMenuMapper.deleteByIds(menuIds);
|
||||
}
|
||||
for (SystemMenuVo menu : menuSet) {
|
||||
this.updateMenuSubCnt(menu.getPid());
|
||||
// 查询所有菜单数据
|
||||
List<SystemMenuTb> allMenus = systemMenuMapper.listAll();
|
||||
// 根据ID集合获取当前菜单和其子菜单
|
||||
Set<Long> allMenuIds = this.getAllMenuIdsWithChildren(ids, allMenus);
|
||||
if (CollUtil.isNotEmpty(allMenuIds)) {
|
||||
// 删除角色菜单关联
|
||||
systemRoleMenuService.deleteRoleMenuByMenuIds(allMenuIds);
|
||||
// 批量删除菜单
|
||||
systemMenuMapper.deleteByIds(allMenuIds);
|
||||
// 更新父级菜单子节点数量
|
||||
this.updateParentMenuCounts(allMenuIds, allMenus);
|
||||
}
|
||||
}
|
||||
|
||||
private SystemMenuVo getMenuVoById(Long id) {
|
||||
return KitBeanUtil.copyToClass(systemMenuMapper.selectById(id), SystemMenuVo.class);
|
||||
/**
|
||||
* 从所有菜单中找出指定ID及其子菜单ID
|
||||
*
|
||||
* @param rootIds 要删除的根菜单ID集合
|
||||
* @param allMenus 所有菜单数据
|
||||
* @return 包含根菜单及其所有子菜单的ID集合
|
||||
*/
|
||||
private Set<Long> getAllMenuIdsWithChildren(Set<Long> rootIds, List<SystemMenuTb> allMenus) {
|
||||
Set<Long> result = new HashSet<>(rootIds);
|
||||
Set<Long> currentLevelIds = new HashSet<>(rootIds);
|
||||
// 构建父ID到子菜单的映射
|
||||
Map<Long, List<SystemMenuTb>> parentToChildrenMap = allMenus.stream().filter(menu -> menu.getPid() != null)
|
||||
.collect(Collectors.groupingBy(SystemMenuTb::getPid));
|
||||
while (!currentLevelIds.isEmpty()) {
|
||||
Set<Long> nextLevelIds = new HashSet<>();
|
||||
// 对于当前层级的每个菜单ID,查找其子菜单
|
||||
for (Long parentId : currentLevelIds) {
|
||||
List<SystemMenuTb> children = parentToChildrenMap.get(parentId);
|
||||
if (children != null && !children.isEmpty()) {
|
||||
for (SystemMenuTb child : children) {
|
||||
if (result.add(child.getId())) { // 如果成功添加(之前不存在),则继续查找其子菜单
|
||||
nextLevelIds.add(child.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
currentLevelIds = nextLevelIds;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新被删除菜单的父菜单子节点计数
|
||||
*/
|
||||
private void updateParentMenuCounts(Set<Long> deletedMenuIds, List<SystemMenuTb> allMenus) {
|
||||
// 获取被删除菜单的父ID
|
||||
Set<Long> parentIds =
|
||||
allMenus.stream().filter(menu -> deletedMenuIds.contains(menu.getId()) && menu.getPid() != null)
|
||||
.map(SystemMenuTb::getPid).collect(Collectors.toSet());
|
||||
// 更新每个父菜单的子节点计数
|
||||
for (Long parentId : parentIds) {
|
||||
proxyService.updateMenuSubCnt(parentId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单id查询目录 -> TestPassed
|
||||
*
|
||||
* @param id 菜单id
|
||||
*/
|
||||
private SystemMenuTb getMenuById(Long id) {
|
||||
return systemMenuMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -217,29 +334,30 @@ public class SystemMenuService {
|
||||
* @param currentUserId /
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuVo> listMenuByUserId(Long currentUserId) {
|
||||
List<SystemRoleVo> roles = systemUserRoleService.listRoleVoByUsersId(currentUserId);
|
||||
Set<Long> roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet());
|
||||
return new ArrayList<>(systemRoleMenuService.queryMenuByRoleIds(roleIds));
|
||||
public List<SystemMenuTb> listMenuByUserId(Long currentUserId) {
|
||||
// List<SystemRoleVo> roles = systemUserRoleService.listRoleVoByUsersId(currentUserId);
|
||||
// Set<Long> roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet());
|
||||
Set<Long> roleIds = systemUserRoleService.listUserRoleIdByUserId(currentUserId);
|
||||
return systemRoleMenuService.listMenuByRoleIds(roleIds, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有子节点, 包含自身ID
|
||||
*
|
||||
* @param menuList /
|
||||
* @param menuSet /
|
||||
* @return /
|
||||
*/
|
||||
public Set<SystemMenuVo> queryChildMenuByArgs(List<SystemMenuVo> menuList, Set<SystemMenuVo> menuSet) {
|
||||
for (SystemMenuVo menu : menuList) {
|
||||
menuSet.add(menu);
|
||||
List<SystemMenuVo> menus = this.listMenuByPid(menu.getId());
|
||||
if (CollUtil.isNotEmpty(menus)) {
|
||||
queryChildMenuByArgs(menus, menuSet);
|
||||
}
|
||||
}
|
||||
return menuSet;
|
||||
}
|
||||
// /**
|
||||
// * 查询所有子节点, 包含自身ID
|
||||
// *
|
||||
// * @param menuList /
|
||||
// * @param menuSet /
|
||||
// * @return /
|
||||
// */
|
||||
// public Set<SystemMenuTb> queryChildMenuByArgs(List<SystemMenuTb> menuList, Set<SystemMenuTb> menuSet) {
|
||||
// for (SystemMenuTb menu : menuList) {
|
||||
// menuSet.add(menu);
|
||||
// List<SystemMenuTb> menus = this.listMenuByPid(menu.getId());
|
||||
// if (CollUtil.isNotEmpty(menus)) {
|
||||
// queryChildMenuByArgs(menus, menuSet);
|
||||
// }
|
||||
// }
|
||||
// return menuSet;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 懒加载菜单数据
|
||||
@@ -247,13 +365,13 @@ public class SystemMenuService {
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuVo> listMenuByPid(Long pid) {
|
||||
List<SystemMenuVo> menus;
|
||||
public List<SystemMenuTb> listMenuByPid(Long pid) {
|
||||
List<SystemMenuTb> menus;
|
||||
if (pid != null && !pid.equals(0L)) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getPid, pid);
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class);
|
||||
return systemMenuMapper.selectList(wrapper);
|
||||
} else {
|
||||
menus = this.listRootMenu();
|
||||
}
|
||||
@@ -261,19 +379,19 @@ public class SystemMenuService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询同级与上级数据
|
||||
* 根据ID查询同级与上级数据 -> TestPassed
|
||||
*
|
||||
* @param menu /
|
||||
* @param menus /
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuVo> querySuperiorMenuByArgs(SystemMenuVo menu, List<SystemMenuVo> menus) {
|
||||
public List<SystemMenuTb> querySuperiorMenuByArgs(SystemMenuTb menu, List<SystemMenuTb> menus) {
|
||||
if (menu.getPid() == null) {
|
||||
menus.addAll(this.listRootMenu());
|
||||
return menus;
|
||||
}
|
||||
menus.addAll(this.listMenuByPid(menu.getPid()));
|
||||
return querySuperiorMenuByArgs(this.getMenuVoById(menu.getPid()), menus);
|
||||
return querySuperiorMenuByArgs(this.getMenuById(menu.getPid()), menus);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,14 +400,15 @@ public class SystemMenuService {
|
||||
* @param menus 原始数据
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuVo> buildMenuTree(List<SystemMenuVo> menus) {
|
||||
public List<SystemMenuVo> buildMenuTree(List<SystemMenuTb> menus) {
|
||||
List<SystemMenuVo> systemMenuVos = KitBeanUtil.copyToList(menus, SystemMenuVo.class);
|
||||
List<SystemMenuVo> trees = new ArrayList<>();
|
||||
Set<Long> ids = new HashSet<>();
|
||||
for (SystemMenuVo menu : menus) {
|
||||
for (SystemMenuVo menu : systemMenuVos) {
|
||||
if (menu.getPid() == null) {
|
||||
trees.add(menu);
|
||||
}
|
||||
for (SystemMenuVo it : menus) {
|
||||
for (SystemMenuVo it : systemMenuVos) {
|
||||
if (menu.getId().equals(it.getPid())) {
|
||||
if (menu.getChildren() == null) {
|
||||
menu.setChildren(new ArrayList<>());
|
||||
@@ -300,7 +419,7 @@ public class SystemMenuService {
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(trees)) {
|
||||
trees = menus.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
|
||||
trees = systemMenuVos.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
@@ -375,20 +494,8 @@ public class SystemMenuService {
|
||||
return menuVo1;
|
||||
}
|
||||
|
||||
public List<SystemMenuVo> listMenuByIds(List<Long> ids) {
|
||||
return KitBeanUtil.copyToList(systemMenuMapper.selectByIds(ids), SystemMenuVo.class);
|
||||
}
|
||||
|
||||
private SystemMenuTb getMenuByComponentName(String componentName) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getComponentName, componentName);
|
||||
return systemMenuMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
private SystemMenuTb getMenuByTitle(String title) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getTitle, title);
|
||||
return systemMenuMapper.selectOne(wrapper);
|
||||
public List<SystemMenuTb> listMenuByIds(List<Long> ids) {
|
||||
return systemMenuMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
private Long countMenuByPid(Long pid) {
|
||||
@@ -412,35 +519,39 @@ public class SystemMenuService {
|
||||
return systemMenuMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
private List<SystemMenuVo> listRootMenu() {
|
||||
/**
|
||||
* 查询根目录 -> TestPassed
|
||||
*/
|
||||
private List<SystemMenuTb> listRootMenu() {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(SystemMenuTb::getPid);
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return KitBeanUtil.copyToList(systemMenuMapper.selectList(wrapper), SystemMenuVo.class);
|
||||
return systemMenuMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public List<SystemMenuRouterVo> buildFrontMenus() {
|
||||
List<SystemMenuVo> originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId());
|
||||
List<SystemMenuTb> originMenus = this.listMenuByUserId(KitSecurityHelper.getCurrentUserId());
|
||||
List<SystemMenuVo> targetMenus = this.buildMenuTree(originMenus);
|
||||
return this.buildMenuVo(targetMenus);
|
||||
}
|
||||
|
||||
public Set<Long> listChildMenuSetByMenuId(Long id) {
|
||||
Set<SystemMenuVo> menuSet = new HashSet<>();
|
||||
List<SystemMenuVo> menuList = this.listMenuByPid(id);
|
||||
menuSet.add(this.getMenuVoById(id));
|
||||
menuSet = this.queryChildMenuByArgs(menuList, menuSet);
|
||||
return menuSet.stream().map(SystemMenuVo::getId).collect(Collectors.toSet());
|
||||
// Set<SystemMenuTb> menuSet = new HashSet<>();
|
||||
// List<SystemMenuTb> menuList = this.listMenuByPid(id);
|
||||
// menuSet.add(this.getMenuById(id));
|
||||
// menuSet = this.queryChildMenuByArgs(menuList, menuSet);
|
||||
// return menuSet.stream().map(SystemMenuTb::getId).collect(Collectors.toSet());
|
||||
List<SystemMenuTb> allMenus = systemMenuMapper.listAll();
|
||||
return this.getAllMenuIdsWithChildren(CollUtil.newHashSet(id), allMenus);
|
||||
}
|
||||
|
||||
public List<SystemMenuVo> listMenuSuperior(List<Long> ids) {
|
||||
Set<SystemMenuVo> menus;
|
||||
List<SystemMenuVo> systemMenuTbs;
|
||||
Set<SystemMenuTb> menus;
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
menus = new LinkedHashSet<>(this.listMenuByIds(ids));
|
||||
for (SystemMenuVo menu : menus) {
|
||||
List<SystemMenuVo> menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>());
|
||||
for (SystemMenuVo data : menuList) {
|
||||
for (SystemMenuTb menu : menus) {
|
||||
List<SystemMenuTb> menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>());
|
||||
for (SystemMenuTb data : menuList) {
|
||||
if (data.getId().equals(menu.getPid())) {
|
||||
data.setSubCount(data.getSubCount() - 1);
|
||||
}
|
||||
@@ -449,12 +560,12 @@ public class SystemMenuService {
|
||||
}
|
||||
// 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题
|
||||
menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
||||
List<SystemMenuVo> newMenuList = new ArrayList<>(menus);
|
||||
systemMenuTbs = this.buildMenuTree(newMenuList);
|
||||
List<SystemMenuTb> newMenuList = new ArrayList<>(menus);
|
||||
return this.buildMenuTree(newMenuList);
|
||||
} else {
|
||||
systemMenuTbs = this.listMenuByPid(null);
|
||||
List<SystemMenuTb> records = this.listMenuByPid(null);
|
||||
return KitBeanUtil.copyToList(records, SystemMenuVo.class);
|
||||
}
|
||||
return systemMenuTbs;
|
||||
}
|
||||
|
||||
public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception {
|
||||
|
||||
+7
-7
@@ -20,13 +20,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
@@ -39,6 +32,13 @@ import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
import oshi.util.Util;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+5
-5
@@ -37,15 +37,15 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemQuartzJobService {
|
||||
|
||||
+3
-3
@@ -20,12 +20,12 @@ import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleDeptMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemRoleDeptService {
|
||||
|
||||
+62
-30
@@ -16,30 +16,30 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SystemRoleMenuService {
|
||||
|
||||
@Autowired
|
||||
private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
@Autowired
|
||||
private SystemMenuMapper systemMenuMapper;
|
||||
|
||||
/**
|
||||
* 删除角色菜单关联 -> TestPassed
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleMenuByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -47,11 +47,17 @@ public class SystemRoleMenuService {
|
||||
systemRoleMenuMapper.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量绑定角色菜单关联 -> TestPassed
|
||||
*
|
||||
* @param menus 菜单集合
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsertRoleMenu(Set<SystemMenuVo> menus, Long roleId) {
|
||||
public void batchInsertRoleMenu(Set<SystemMenuTb> menus, Long roleId) {
|
||||
if (CollUtil.isNotEmpty(menus)) {
|
||||
List<SystemRoleMenuTb> records = new ArrayList<>();
|
||||
for (SystemMenuVo menu : menus) {
|
||||
for (SystemMenuTb menu : menus) {
|
||||
SystemRoleMenuTb record = new SystemRoleMenuTb();
|
||||
record.setMenuId(menu.getId());
|
||||
record.setRoleId(roleId);
|
||||
@@ -61,6 +67,11 @@ public class SystemRoleMenuService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除角色菜单关联 -> TestPassed
|
||||
*
|
||||
* @param roleIds 角色id集合
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDeleteRoleMenu(Set<Long> roleIds) {
|
||||
if (CollUtil.isNotEmpty(roleIds)) {
|
||||
@@ -70,30 +81,40 @@ public class SystemRoleMenuService {
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedHashSet<SystemMenuVo> queryMenuByRoleIds(Set<Long> roleIds) {
|
||||
/**
|
||||
* @param roleIds 角色id集合 -> TestPassed
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuTb> listMenuByRoleIds(Set<Long> roleIds, boolean hasButton) {
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
return new LinkedHashSet<>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> roleMenuWrapper = new LambdaQueryWrapper<>();
|
||||
roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds);
|
||||
List<Long> menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(menuIds)) {
|
||||
return new LinkedHashSet<>();
|
||||
// LambdaQueryWrapper<SystemRoleMenuTb> roleMenuWrapper = new LambdaQueryWrapper<>();
|
||||
// roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds);
|
||||
// List<Long> menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId)
|
||||
// .collect(Collectors.toList());
|
||||
// if (CollUtil.isEmpty(menuIds)) {
|
||||
// return new ArrayList<>();
|
||||
// }
|
||||
// LambdaQueryWrapper<SystemMenuTb> menuWrapper = new LambdaQueryWrapper<>();
|
||||
// menuWrapper.in(SystemMenuTb::getId, menuIds);
|
||||
// // 排除"按钮"
|
||||
// menuWrapper.ne(SystemMenuTb::getType, 2);
|
||||
// menuWrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
// return systemMenuMapper.selectList(menuWrapper);
|
||||
if (hasButton){
|
||||
return systemRoleMenuMapper.listMenuWithRoleIds(roleIds);
|
||||
}
|
||||
LambdaQueryWrapper<SystemMenuTb> menuWrapper = new LambdaQueryWrapper<>();
|
||||
menuWrapper.in(SystemMenuTb::getId, menuIds);
|
||||
// 排除"按钮"
|
||||
menuWrapper.ne(SystemMenuTb::getType, 2);
|
||||
menuWrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
|
||||
List<SystemMenuTb> systemMenuTbs = systemMenuMapper.selectList(menuWrapper);
|
||||
List<SystemMenuVo> systemMenuVos = KitBeanUtil.copyToList(systemMenuTbs, SystemMenuVo.class);
|
||||
return new LinkedHashSet<>(systemMenuVos);
|
||||
return systemRoleMenuMapper.listMenuWithRoleIdsNeButton(roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜单角色关联 -> TestPassed
|
||||
*
|
||||
* @param menuIds 菜单id集合
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleMenuByMenuIds(List<Long> menuIds) {
|
||||
public void deleteRoleMenuByMenuIds(Set<Long> menuIds) {
|
||||
if (CollUtil.isEmpty(menuIds)) {
|
||||
return;
|
||||
}
|
||||
@@ -101,4 +122,15 @@ public class SystemRoleMenuService {
|
||||
wrapper.in(SystemRoleMenuTb::getMenuId, menuIds);
|
||||
systemRoleMenuMapper.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id集合查询菜单权限 -> TestPassed
|
||||
*
|
||||
* @param roleIds 角色id集合
|
||||
* @return /
|
||||
*/
|
||||
public List<String> listMenuPermissionByRoleIds(Set<Long> roleIds) {
|
||||
Set<String> permissions = systemRoleMenuMapper.listMenuPermissionByRoleIds(roleIds);
|
||||
return permissions.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+51
-63
@@ -20,11 +20,11 @@ import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.export.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
@@ -32,20 +32,20 @@ import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleService {
|
||||
@@ -67,7 +67,7 @@ public class SystemRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRole(SystemCreateRoleArgs args) {
|
||||
checkRoleLevels(args.getLevel());
|
||||
if (this.countRoleByName(args.getName()) > 0) {
|
||||
if (this.existRoleWithName(args.getName())) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class);
|
||||
@@ -78,16 +78,17 @@ public class SystemRoleService {
|
||||
}
|
||||
}
|
||||
|
||||
private SystemRoleTb getRoleByName(String name) {
|
||||
private boolean existRoleWithName(String name) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleTb::getName, name);
|
||||
return systemRoleMapper.selectOne(wrapper);
|
||||
return systemRoleMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
private long countRoleByName(String name) {
|
||||
private boolean existRoleWithNameNeSelf(String name, Long roleId) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleTb::getName, name);
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
wrapper.eq(SystemRoleTb::getId, roleId);
|
||||
return systemRoleMapper.exists(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,9 +99,8 @@ public class SystemRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRoleById(SystemRoleVo args) {
|
||||
checkRoleLevels(args.getLevel());
|
||||
SystemRoleTb role = this.getRoleTbById(args.getId());
|
||||
SystemRoleTb role1 = this.getRoleByName(args.getName());
|
||||
if (role1 != null && !role1.getId().equals(role.getId())) {
|
||||
SystemRoleTb role = systemRoleMapper.selectById(args.getId());
|
||||
if (this.existRoleWithNameNeSelf(args.getName(), role.getId())) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
role.setName(args.getName());
|
||||
@@ -108,7 +108,7 @@ public class SystemRoleService {
|
||||
role.setDataScope(args.getDataScope());
|
||||
role.setLevel(args.getLevel());
|
||||
// 更新
|
||||
systemRoleMapper.insertOrUpdate(role);
|
||||
systemRoleMapper.updateById(role);
|
||||
// 删除关联部门数据
|
||||
systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId()));
|
||||
// 判断是否有部门数据, 若有, 则需更新关联
|
||||
@@ -117,10 +117,6 @@ public class SystemRoleService {
|
||||
}
|
||||
}
|
||||
|
||||
private SystemRoleTb getRoleTbById(Long id) {
|
||||
return systemRoleMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绑定的菜单 -> TestPassed
|
||||
*
|
||||
@@ -132,8 +128,7 @@ public class SystemRoleService {
|
||||
checkRoleLevels(role.getLevel());
|
||||
// 更新菜单
|
||||
systemRoleMenuService.deleteRoleMenuByRoleId(role.getId());
|
||||
// 判断是否为空
|
||||
Set<SystemMenuVo> menus = args.getMenus();
|
||||
Set<SystemMenuTb> menus = args.getMenus();
|
||||
if (CollUtil.isNotEmpty(menus)) {
|
||||
systemRoleMenuService.batchInsertRoleMenu(menus, role.getId());
|
||||
}
|
||||
@@ -146,8 +141,7 @@ public class SystemRoleService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleByIds(Set<Long> ids) {
|
||||
List<Integer> roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Integer> roleLevels = systemRoleMapper.listRoleLevelByRoleIds(new ArrayList<>(ids));
|
||||
for (Integer roleLevel : roleLevels) {
|
||||
checkRoleLevels(roleLevel);
|
||||
}
|
||||
@@ -165,7 +159,7 @@ public class SystemRoleService {
|
||||
*/
|
||||
public List<SystemRoleTb> listAllRole() {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
wrapper.orderByDesc(SystemRoleTb::getCreateTime);
|
||||
return systemRoleMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@@ -176,24 +170,21 @@ public class SystemRoleService {
|
||||
* @param rolePage 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemRoleVo> queryRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> rolePage) {
|
||||
KitValidUtil.notNull(args);
|
||||
// 查询角色基本信息
|
||||
public List<SystemRoleTb> queryRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> rolePage) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
this.injectQueryParams(args, wrapper);
|
||||
return systemRoleMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
private void injectQueryParams(SystemQueryRoleArgs args, LambdaQueryWrapper<SystemRoleTb> wrapper) {
|
||||
if (args != null) {
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
List<SystemRoleTb> roles;
|
||||
if (rolePage == null) {
|
||||
roles = systemRoleMapper.selectList(wrapper);
|
||||
} else {
|
||||
Page<SystemRoleTb> page = systemRoleMapper.selectPage(rolePage, wrapper);
|
||||
roles = page.getRecords();
|
||||
}
|
||||
return roles.stream().map(systemUserRoleService::convertToRoleVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,13 +195,14 @@ public class SystemRoleService {
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemRoleVo> searchRoleByArgs(SystemQueryRoleArgs args, Page<SystemRoleTb> page) {
|
||||
List<SystemRoleVo> roles = this.queryRoleByArgs(args, page);
|
||||
Long total = this.countRoleByArgs(args);
|
||||
return KitPageUtil.toPage(roles, total);
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQueryParams(args, wrapper);
|
||||
IPage<SystemRoleVo> data = systemRoleMapper.selectPage(page, wrapper).convert(systemUserRoleService::convertToRoleVo);
|
||||
return KitPageUtil.toPage(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户权限信息 -> TestPassed
|
||||
* 查询用户权限信息 -> TestPassed?
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 权限信息
|
||||
@@ -222,9 +214,17 @@ public class SystemRoleService {
|
||||
permissions.add("admin");
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
List<SystemRoleVo> roles = systemUserRoleService.listRoleVoByUsersId(user.getId());
|
||||
permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission)
|
||||
.filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
// List<SystemRoleVo> roles = systemUserRoleService.listRoleVoByUsersId(user.getId());
|
||||
// permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission)
|
||||
// .filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
// return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
Set<Long> roleIds = systemUserRoleService.listUserRoleIdByUserId(user.getId());
|
||||
// 查询角色权限
|
||||
if (CollUtil.isNotEmpty(roleIds)) {
|
||||
return systemRoleMenuService.listMenuPermissionByRoleIds(roleIds).stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
// 没有包含任何角色,赋予默认权限
|
||||
permissions.add("IsAJoker");
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -234,23 +234,12 @@ public class SystemRoleService {
|
||||
* @param ids /
|
||||
*/
|
||||
public void verifyBindRelationByIds(Set<Long> ids) {
|
||||
if (systemUserRoleService.countUserByRoleIds(ids) > 0) {
|
||||
if (systemUserRoleService.existUserWithRoleIds(ids)) {
|
||||
throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!");
|
||||
}
|
||||
}
|
||||
|
||||
public Long countRoleByArgs(SystemQueryRoleArgs args) {
|
||||
KitValidUtil.notNull(args);
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public SystemRoleVo getRoleById(Long id) {
|
||||
public SystemRoleVo getRoleVoById(Long id) {
|
||||
SystemRoleTb roleTb = systemRoleMapper.selectById(id);
|
||||
if (roleTb == null) {
|
||||
return null;
|
||||
@@ -268,8 +257,7 @@ public class SystemRoleService {
|
||||
* @return /
|
||||
*/
|
||||
private int checkRoleLevels(Integer level) {
|
||||
List<Integer> levels = systemUserRoleService.listRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleVo::getLevel).collect(Collectors.toList());
|
||||
Set<Integer> levels = systemUserRoleService.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId());
|
||||
int min = Collections.min(levels);
|
||||
if (level != null) {
|
||||
if (level < min) {
|
||||
@@ -280,9 +268,9 @@ public class SystemRoleService {
|
||||
}
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args, null);
|
||||
List<SystemRoleTb> systemRoleVos = this.queryRoleByArgs(args, null);
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
for (SystemRoleTb dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setLevel(dataObject.getLevel());
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@ package cn.odboy.system.service;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserDeptService {
|
||||
|
||||
+3
-3
@@ -20,12 +20,12 @@ import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserJobMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserJobService {
|
||||
|
||||
+35
-18
@@ -18,9 +18,9 @@ package cn.odboy.system.service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
@@ -28,15 +28,16 @@ import cn.odboy.system.dal.mysql.SystemUserRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemUserRoleService {
|
||||
@@ -91,8 +92,8 @@ public class SystemUserRoleService {
|
||||
}
|
||||
SystemRoleVo roleVo = KitBeanUtil.copyToClass(role, SystemRoleVo.class);
|
||||
// 查询关联的菜单信息
|
||||
Set<SystemMenuVo> menus = systemRoleMenuService.queryMenuByRoleIds(Collections.singleton(role.getId()));
|
||||
roleVo.setMenus(menus);
|
||||
List<SystemMenuTb> menus = systemRoleMenuService.listMenuByRoleIds(Collections.singleton(role.getId()), true);
|
||||
roleVo.setMenus(new HashSet<>(menus));
|
||||
// 查询关联的部门信息
|
||||
Set<SystemDeptTb> depts = systemRoleDeptService.listUserDeptByRoleId(role.getId());
|
||||
roleVo.setDepts(depts);
|
||||
@@ -140,7 +141,7 @@ public class SystemUserRoleService {
|
||||
* @param args /
|
||||
*/
|
||||
public void checkLevel(SystemUserVo args) {
|
||||
List<Integer> roleLevels = systemUserRoleMapper.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId());
|
||||
Set<Integer> roleLevels = systemUserRoleMapper.listUserRoleLevelByUserId(KitSecurityHelper.getCurrentUserId());
|
||||
Integer currentLevel = Collections.min(roleLevels);
|
||||
Integer optLevel = this.getDeptLevelByRoles(args.getRoles());
|
||||
if (currentLevel > optLevel) {
|
||||
@@ -148,15 +149,6 @@ public class SystemUserRoleService {
|
||||
}
|
||||
}
|
||||
|
||||
public long countUserByRoleIds(Set<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return 0L;
|
||||
}
|
||||
LambdaQueryWrapper<SystemUserRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemUserRoleTb::getRoleId, ids);
|
||||
return systemUserRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色 -> TestPassed
|
||||
*
|
||||
@@ -168,12 +160,37 @@ public class SystemUserRoleService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色级别 -> TestPassed
|
||||
* 根据用户id查询角色级别集合 -> TestPassed
|
||||
*
|
||||
* @param userId /
|
||||
* @return /
|
||||
*/
|
||||
public List<Integer> listUserRoleLevelByUserId(Long userId) {
|
||||
public Set<Integer> listUserRoleLevelByUserId(Long userId) {
|
||||
return systemUserRoleMapper.listUserRoleLevelByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色id集合 -> TestPassed
|
||||
*
|
||||
* @param userId /
|
||||
* @return /
|
||||
*/
|
||||
public Set<Long> listUserRoleIdByUserId(Long userId) {
|
||||
return systemUserRoleMapper.listUserRoleIdByUserId(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id集合判断是否存在关联用户 -> TestPassed
|
||||
*
|
||||
* @param ids 角色id集合
|
||||
* @return /
|
||||
*/
|
||||
public boolean existUserWithRoleIds(Set<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return false;
|
||||
}
|
||||
LambdaQueryWrapper<SystemUserRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemUserRoleTb::getRoleId, ids);
|
||||
return systemUserRoleMapper.exists(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -45,6 +45,13 @@ import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -54,13 +61,6 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class SystemUserService {
|
||||
|
||||
+3
-3
@@ -39,13 +39,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+25
-25
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemDictDetailMapper">
|
||||
<select id="selectPageByArgs" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT
|
||||
t1.*
|
||||
FROM system_dict_detail t1 LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
<where>
|
||||
<if test="args.dictName != null and args.dictName != ''">
|
||||
AND t2.name = #{args.dictName}
|
||||
</if>
|
||||
<if test="args.label != null and args.label != ''">
|
||||
AND t1.label = #{args.label}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
<select id="listDictDetailByName" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT t1.*
|
||||
FROM system_dict_detail t1
|
||||
LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND t2.name = #{name}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
<select id="selectPageByArgs" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT
|
||||
t1.*
|
||||
FROM system_dict_detail t1 LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
<where>
|
||||
<if test="args.dictName != null and args.dictName != ''">
|
||||
AND t2.name = #{args.dictName}
|
||||
</if>
|
||||
<if test="args.label != null and args.label != ''">
|
||||
AND t1.label = #{args.label}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
<select id="listDictDetailByName" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT t1.*
|
||||
FROM system_dict_detail t1
|
||||
LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND t2.name = #{name}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemRoleMapper">
|
||||
<select id="listRoleLevelByRoleIds" resultType="java.lang.Integer">
|
||||
SELECT DISTINCT t1.`level`
|
||||
FROM system_role t1
|
||||
WHERE t1.`level` IS NOT NULL
|
||||
AND t1.role_id IN
|
||||
<foreach collection="roleIds" separator="," open="(" close=")" item="roleId">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemRoleMenuMapper">
|
||||
<select id="listMenuPermissionByRoleIds" resultType="java.lang.String">
|
||||
SELECT DISTINCT
|
||||
t2.permission
|
||||
FROM
|
||||
system_roles_menus t1
|
||||
LEFT JOIN system_menu t2 ON t1.menu_id = t2.menu_id
|
||||
WHERE
|
||||
t1.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="listMenuWithRoleIdsNeButton" resultType="cn.odboy.system.dal.dataobject.SystemMenuTb">
|
||||
SELECT t2.*,
|
||||
t2.menu_id AS id
|
||||
FROM system_roles_menus t1
|
||||
LEFT JOIN system_menu t2 ON t1.menu_id = t2.menu_id
|
||||
WHERE t2.`type` != 2 AND t1.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
ORDER BY
|
||||
menu_sort ASC
|
||||
</select>
|
||||
<select id="listMenuWithRoleIds" resultType="cn.odboy.system.dal.dataobject.SystemMenuTb">
|
||||
SELECT t2.*,
|
||||
t2.menu_id AS id
|
||||
FROM system_roles_menus t1
|
||||
LEFT JOIN system_menu t2 ON t1.menu_id = t2.menu_id
|
||||
WHERE t1.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
ORDER BY
|
||||
menu_sort ASC
|
||||
</select>
|
||||
</mapper>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemUserMapper">
|
||||
<select id="listUsernameByIds" resultType="java.lang.String">
|
||||
SELECT DISTINCT
|
||||
t1.username
|
||||
FROM
|
||||
system_user t1
|
||||
WHERE
|
||||
t1.user_id IN
|
||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
+12
@@ -7,4 +7,16 @@
|
||||
LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id
|
||||
WHERE t2.user_id = #{userId}
|
||||
</select>
|
||||
<select id="listUserRoleLevelByUserId" resultType="java.lang.Integer">
|
||||
SELECT DISTINCT t1.`level`
|
||||
FROM system_role t1
|
||||
LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id
|
||||
WHERE t2.user_id = #{userId}
|
||||
</select>
|
||||
<select id="listUserRoleIdByUserId" resultType="java.lang.Long">
|
||||
SELECT DISTINCT t1.`role_id`
|
||||
FROM system_role t1
|
||||
LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id
|
||||
WHERE t2.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user