生成菜单代码.
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemMenuDTO", description = "菜单 业务对象")
|
||||
public class SystemMenuDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "菜单权限")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
private Integer cache;
|
||||
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "组件地址")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 角色 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleDTO", description = "角色 业务对象")
|
||||
public class SystemRoleDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleMenuDTO", description = "角色菜单关联 业务对象")
|
||||
public class SystemRoleMenuDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemUserRoleDTO", description = "用户角色关联 业务对象")
|
||||
public class SystemUserRoleDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
### 创建菜单
|
||||
POST {{baseUrl}}/infra/system-menu/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"parentId": "",
|
||||
"name": "",
|
||||
"permission": "",
|
||||
"type": "",
|
||||
"sort": "",
|
||||
"status": "",
|
||||
"cache": "",
|
||||
"icon": "",
|
||||
"path": "",
|
||||
"componentName": "",
|
||||
"component": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新菜单
|
||||
PUT {{baseUrl}}/infra/system-menu/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"parentId": "",
|
||||
"name": "",
|
||||
"permission": "",
|
||||
"type": "",
|
||||
"sort": "",
|
||||
"status": "",
|
||||
"cache": "",
|
||||
"icon": "",
|
||||
"path": "",
|
||||
"componentName": "",
|
||||
"component": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询菜单
|
||||
GET {{baseUrl}}/infra/system-menu/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量查询菜单
|
||||
GET {{baseUrl}}/infra/system-menu/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询菜单
|
||||
POST {{baseUrl}}/infra/system-menu/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"parentId": "",
|
||||
"name": "",
|
||||
"permission": "",
|
||||
"type": "",
|
||||
"sort": "",
|
||||
"status": "",
|
||||
"cache": "",
|
||||
"icon": "",
|
||||
"path": "",
|
||||
"componentName": "",
|
||||
"component": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除菜单
|
||||
DELETE {{baseUrl}}/infra/system-menu/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量删除菜单
|
||||
DELETE {{baseUrl}}/infra/system-menu/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.service.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Tag(name = "infra - 菜单服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/system-menu")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class SystemMenuController {
|
||||
|
||||
@Resource
|
||||
private SystemMenuService systemMenuService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建菜单")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:create')")
|
||||
public Long createSystemMenu(@Validated @RequestBody SystemMenuCreateRequest request) {
|
||||
return systemMenuService.createSystemMenu(request);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新菜单")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:update')")
|
||||
public Integer updateSystemMenu(@Validated @RequestBody SystemMenuUpdateRequest request) {
|
||||
return systemMenuService.updateSystemMenu(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询菜单")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:query')")
|
||||
public SystemMenuVO getSystemMenu(@RequestParam("id") Long id) {
|
||||
return systemMenuService.getSystemMenu(id);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "通过 id 批量查询菜单")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:query')")
|
||||
public List<SystemMenuVO> getSystemMenuList(@RequestParam("idList") List<Long> idList) {
|
||||
return systemMenuService.getSystemMenuList(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询菜单")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:query')")
|
||||
public DataGrid<SystemMenuVO> getSystemMenuPage(@Validated @RequestBody SystemMenuQueryRequest request) {
|
||||
return systemMenuService.getSystemMenuPage(request);
|
||||
}
|
||||
|
||||
@PutMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除菜单")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:delete')")
|
||||
public Integer deleteSystemMenu(@RequestParam("id") Long id) {
|
||||
return systemMenuService.deleteSystemMenu(id);
|
||||
}
|
||||
|
||||
@PutMapping("/delete-batch")
|
||||
@Operation(summary = "通过 id 批量删除菜单")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-menu:delete')")
|
||||
public Integer batchDeleteSystemMenu(@RequestParam("idList") List<Long> idList) {
|
||||
return systemMenuService.batchDeleteSystemMenu(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
### 创建角色
|
||||
POST {{baseUrl}}/infra/system-role/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"name": "",
|
||||
"code": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新角色
|
||||
PUT {{baseUrl}}/infra/system-role/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"code": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询角色
|
||||
GET {{baseUrl}}/infra/system-role/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量查询角色
|
||||
GET {{baseUrl}}/infra/system-role/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询角色
|
||||
POST {{baseUrl}}/infra/system-role/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"name": "",
|
||||
"code": "",
|
||||
"status": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除角色
|
||||
DELETE {{baseUrl}}/infra/system-role/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量删除角色
|
||||
DELETE {{baseUrl}}/infra/system-role/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.service.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 03:03
|
||||
*/
|
||||
@Tag(name = "infra - 角色服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/system-role")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class SystemRoleController {
|
||||
|
||||
@Resource
|
||||
private SystemRoleService systemRoleService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建角色")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:create')")
|
||||
public Long createSystemRole(@Validated @RequestBody SystemRoleCreateRequest request) {
|
||||
return systemRoleService.createSystemRole(request);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新角色")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:update')")
|
||||
public Integer updateSystemRole(@Validated @RequestBody SystemRoleUpdateRequest request) {
|
||||
return systemRoleService.updateSystemRole(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询角色")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
||||
public SystemRoleVO getSystemRole(@RequestParam("id") Long id) {
|
||||
return systemRoleService.getSystemRole(id);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "通过 id 批量查询角色")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
||||
public List<SystemRoleVO> getSystemRoleList(@RequestParam("idList") List<Long> idList) {
|
||||
return systemRoleService.getSystemRoleList(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询角色")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:query')")
|
||||
public DataGrid<SystemRoleVO> getSystemRolePage(@Validated @RequestBody SystemRoleQueryRequest request) {
|
||||
return systemRoleService.getSystemRolePage(request);
|
||||
}
|
||||
|
||||
@PutMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除角色")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:delete')")
|
||||
public Integer deleteSystemRole(@RequestParam("id") Long id) {
|
||||
return systemRoleService.deleteSystemRole(id);
|
||||
}
|
||||
|
||||
@PutMapping("/delete-batch")
|
||||
@Operation(summary = "通过 id 批量删除角色")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role:delete')")
|
||||
public Integer batchDeleteSystemRole(@RequestParam("idList") List<Long> idList) {
|
||||
return systemRoleService.batchDeleteSystemRole(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
### 创建角色菜单关联
|
||||
POST {{baseUrl}}/infra/system-role-menu/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"roleId": "",
|
||||
"menuId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新角色菜单关联
|
||||
PUT {{baseUrl}}/infra/system-role-menu/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"roleId": "",
|
||||
"menuId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询角色菜单关联
|
||||
GET {{baseUrl}}/infra/system-role-menu/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量查询角色菜单关联
|
||||
GET {{baseUrl}}/infra/system-role-menu/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询角色菜单关联
|
||||
POST {{baseUrl}}/infra/system-role-menu/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"roleId": "",
|
||||
"menuId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除角色菜单关联
|
||||
DELETE {{baseUrl}}/infra/system-role-menu/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量删除角色菜单关联
|
||||
DELETE {{baseUrl}}/infra/system-role-menu/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.service.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Tag(name = "infra - 角色菜单关联服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/system-role-menu")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class SystemRoleMenuController {
|
||||
|
||||
@Resource
|
||||
private SystemRoleMenuService systemRoleMenuService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建角色菜单关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:create')")
|
||||
public Long createSystemRoleMenu(@Validated @RequestBody SystemRoleMenuCreateRequest request) {
|
||||
return systemRoleMenuService.createSystemRoleMenu(request);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新角色菜单关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:update')")
|
||||
public Integer updateSystemRoleMenu(@Validated @RequestBody SystemRoleMenuUpdateRequest request) {
|
||||
return systemRoleMenuService.updateSystemRoleMenu(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询角色菜单关联")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:query')")
|
||||
public SystemRoleMenuVO getSystemRoleMenu(@RequestParam("id") Long id) {
|
||||
return systemRoleMenuService.getSystemRoleMenu(id);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "通过 id 批量查询角色菜单关联")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:query')")
|
||||
public List<SystemRoleMenuVO> getSystemRoleMenuList(@RequestParam("idList") List<Long> idList) {
|
||||
return systemRoleMenuService.getSystemRoleMenuList(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询角色菜单关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:query')")
|
||||
public DataGrid<SystemRoleMenuVO> getSystemRoleMenuPage(@Validated @RequestBody SystemRoleMenuQueryRequest request) {
|
||||
return systemRoleMenuService.getSystemRoleMenuPage(request);
|
||||
}
|
||||
|
||||
@PutMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除角色菜单关联")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:delete')")
|
||||
public Integer deleteSystemRoleMenu(@RequestParam("id") Long id) {
|
||||
return systemRoleMenuService.deleteSystemRoleMenu(id);
|
||||
}
|
||||
|
||||
@PutMapping("/delete-batch")
|
||||
@Operation(summary = "通过 id 批量删除角色菜单关联")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-role-menu:delete')")
|
||||
public Integer batchDeleteSystemRoleMenu(@RequestParam("idList") List<Long> idList) {
|
||||
return systemRoleMenuService.batchDeleteSystemRoleMenu(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
### 创建用户角色关联
|
||||
POST {{baseUrl}}/infra/system-user-role/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"userId": "",
|
||||
"roleId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 更新用户角色关联
|
||||
PUT {{baseUrl}}/infra/system-user-role/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"userId": "",
|
||||
"roleId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 查询用户角色关联
|
||||
GET {{baseUrl}}/infra/system-user-role/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量查询用户角色关联
|
||||
GET {{baseUrl}}/infra/system-user-role/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 分页查询用户角色关联
|
||||
POST {{baseUrl}}/infra/system-user-role/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"userId": "",
|
||||
"roleId": ""
|
||||
}
|
||||
|
||||
|
||||
### 通过 id 删除用户角色关联
|
||||
DELETE {{baseUrl}}/infra/system-user-role/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 通过 id 批量删除用户角色关联
|
||||
DELETE {{baseUrl}}/infra/system-user-role/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.service.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Tag(name = "infra - 用户角色关联服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/system-user-role")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class SystemUserRoleController {
|
||||
|
||||
@Resource
|
||||
private SystemUserRoleService systemUserRoleService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户角色关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:create')")
|
||||
public Long createSystemUserRole(@Validated @RequestBody SystemUserRoleCreateRequest request) {
|
||||
return systemUserRoleService.createSystemUserRole(request);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "通过 id 更新用户角色关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:update')")
|
||||
public Integer updateSystemUserRole(@Validated @RequestBody SystemUserRoleUpdateRequest request) {
|
||||
return systemUserRoleService.updateSystemUserRole(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "通过 id 查询用户角色关联")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:query')")
|
||||
public SystemUserRoleVO getSystemUserRole(@RequestParam("id") Long id) {
|
||||
return systemUserRoleService.getSystemUserRole(id);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "通过 id 批量查询用户角色关联")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:query')")
|
||||
public List<SystemUserRoleVO> getSystemUserRoleList(@RequestParam("idList") List<Long> idList) {
|
||||
return systemUserRoleService.getSystemUserRoleList(idList);
|
||||
}
|
||||
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询用户角色关联")
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:query')")
|
||||
public DataGrid<SystemUserRoleVO> getSystemUserRolePage(@Validated @RequestBody SystemUserRoleQueryRequest request) {
|
||||
return systemUserRoleService.getSystemUserRolePage(request);
|
||||
}
|
||||
|
||||
@PutMapping("/delete")
|
||||
@Operation(summary = "通过 id 删除用户角色关联")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:delete')")
|
||||
public Integer deleteSystemUserRole(@RequestParam("id") Long id) {
|
||||
return systemUserRoleService.deleteSystemUserRole(id);
|
||||
}
|
||||
|
||||
@PutMapping("/delete-batch")
|
||||
@Operation(summary = "通过 id 批量删除用户角色关联")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user-role:delete')")
|
||||
public Integer batchDeleteSystemUserRole(@RequestParam("idList") List<Long> idList) {
|
||||
return systemUserRoleService.batchDeleteSystemUserRole(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.SystemMenuDO;
|
||||
import com.orion.ops.module.infra.entity.dto.SystemMenuCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemMenuConvert {
|
||||
|
||||
SystemMenuConvert MAPPER = Mappers.getMapper(SystemMenuConvert.class);
|
||||
|
||||
SystemMenuDO to(SystemMenuCreateRequest request);
|
||||
|
||||
SystemMenuDO to(SystemMenuUpdateRequest request);
|
||||
|
||||
SystemMenuDO to(SystemMenuQueryRequest request);
|
||||
|
||||
SystemMenuVO to(SystemMenuDO domain);
|
||||
|
||||
List<SystemMenuVO> to(List<SystemMenuDO> list);
|
||||
|
||||
List<SystemMenuCacheDTO> toCache(List<SystemMenuDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 暴露服务转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemMenuProviderConvert {
|
||||
|
||||
SystemMenuProviderConvert MAPPER = Mappers.getMapper(SystemMenuProviderConvert.class);
|
||||
|
||||
SystemMenuDO to(SystemMenuDTO dto);
|
||||
|
||||
SystemMenuDTO to(SystemMenuDO domain);
|
||||
|
||||
List<SystemMenuDO> toDO(List<SystemMenuDTO> list);
|
||||
|
||||
List<SystemMenuDTO> toDTO(List<SystemMenuDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleConvert {
|
||||
|
||||
SystemRoleConvert MAPPER = Mappers.getMapper(SystemRoleConvert.class);
|
||||
|
||||
SystemRoleDO to(SystemRoleCreateRequest request);
|
||||
|
||||
SystemRoleDO to(SystemRoleUpdateRequest request);
|
||||
|
||||
SystemRoleDO to(SystemRoleQueryRequest request);
|
||||
|
||||
SystemRoleVO to(SystemRoleDO domain);
|
||||
|
||||
List<SystemRoleVO> to(List<SystemRoleDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleMenuConvert {
|
||||
|
||||
SystemRoleMenuConvert MAPPER = Mappers.getMapper(SystemRoleMenuConvert.class);
|
||||
|
||||
SystemRoleMenuDO to(SystemRoleMenuCreateRequest request);
|
||||
|
||||
SystemRoleMenuDO to(SystemRoleMenuUpdateRequest request);
|
||||
|
||||
SystemRoleMenuDO to(SystemRoleMenuQueryRequest request);
|
||||
|
||||
SystemRoleMenuVO to(SystemRoleMenuDO domain);
|
||||
|
||||
List<SystemRoleMenuVO> to(List<SystemRoleMenuDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 暴露服务转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleMenuProviderConvert {
|
||||
|
||||
SystemRoleMenuProviderConvert MAPPER = Mappers.getMapper(SystemRoleMenuProviderConvert.class);
|
||||
|
||||
SystemRoleMenuDO to(SystemRoleMenuDTO dto);
|
||||
|
||||
SystemRoleMenuDTO to(SystemRoleMenuDO domain);
|
||||
|
||||
List<SystemRoleMenuDO> toDO(List<SystemRoleMenuDTO> list);
|
||||
|
||||
List<SystemRoleMenuDTO> toDTO(List<SystemRoleMenuDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 暴露服务转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleProviderConvert {
|
||||
|
||||
SystemRoleProviderConvert MAPPER = Mappers.getMapper(SystemRoleProviderConvert.class);
|
||||
|
||||
SystemRoleDO to(SystemRoleDTO dto);
|
||||
|
||||
SystemRoleDTO to(SystemRoleDO domain);
|
||||
|
||||
List<SystemRoleDO> toDO(List<SystemRoleDTO> list);
|
||||
|
||||
List<SystemRoleDTO> toDTO(List<SystemRoleDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemUserRoleConvert {
|
||||
|
||||
SystemUserRoleConvert MAPPER = Mappers.getMapper(SystemUserRoleConvert.class);
|
||||
|
||||
SystemUserRoleDO to(SystemUserRoleCreateRequest request);
|
||||
|
||||
SystemUserRoleDO to(SystemUserRoleUpdateRequest request);
|
||||
|
||||
SystemUserRoleDO to(SystemUserRoleQueryRequest request);
|
||||
|
||||
SystemUserRoleVO to(SystemUserRoleDO domain);
|
||||
|
||||
List<SystemUserRoleVO> to(List<SystemUserRoleDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import com.orion.ops.module.infra.entity.domain.*;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联 暴露服务转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemUserRoleProviderConvert {
|
||||
|
||||
SystemUserRoleProviderConvert MAPPER = Mappers.getMapper(SystemUserRoleProviderConvert.class);
|
||||
|
||||
SystemUserRoleDO to(SystemUserRoleDTO dto);
|
||||
|
||||
SystemUserRoleDTO to(SystemUserRoleDO domain);
|
||||
|
||||
List<SystemUserRoleDO> toDO(List<SystemUserRoleDTO> list);
|
||||
|
||||
List<SystemUserRoleDTO> toDTO(List<SystemUserRoleDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemMenuDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 菜单 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemMenuDAO extends IMapper<SystemMenuDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleDO;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 角色 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleDAO extends IMapper<SystemRoleDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleMenuDO;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleMenuDAO extends IMapper<SystemRoleMenuDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.SystemUserRoleDO;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户角色关联 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemUserRoleDAO extends IMapper<SystemUserRoleDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.orion.ops.module.infra.define;
|
||||
|
||||
/**
|
||||
* 权限定义
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/16 1:39
|
||||
*/
|
||||
public interface RoleDefine {
|
||||
|
||||
/**
|
||||
* 超级管理员权限
|
||||
*/
|
||||
String ADMIN_CODE = "admin";
|
||||
|
||||
/**
|
||||
* 是否为管理员权限
|
||||
*
|
||||
* @param role role
|
||||
* @return 是否为管理员
|
||||
*/
|
||||
static boolean isAdmin(String role) {
|
||||
return ADMIN_CODE.equals(role);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 菜单 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "system_menu", autoResultMap = true)
|
||||
@Schema(name = "SystemMenuDO", description = "菜单 实体对象")
|
||||
public class SystemMenuDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
@TableField("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "菜单权限")
|
||||
@TableField("permission")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
@TableField("type")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@TableField("sort")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
@TableField("cache")
|
||||
private Integer cache;
|
||||
|
||||
@Schema(description = "菜单图标")
|
||||
@TableField("icon")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "路由地址")
|
||||
@TableField("path")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
@TableField("component_name")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "组件地址")
|
||||
@TableField("component")
|
||||
private String component;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "system_role", autoResultMap = true)
|
||||
@Schema(name = "SystemRoleDO", description = "角色 实体对象")
|
||||
public class SystemRoleDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "角色编码")
|
||||
@TableField("code")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "system_role_menu", autoResultMap = true)
|
||||
@Schema(name = "SystemRoleMenuDO", description = "角色菜单关联 实体对象")
|
||||
public class SystemRoleMenuDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
@TableField("role_id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
@TableField("menu_id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "system_user_role", autoResultMap = true)
|
||||
@Schema(name = "SystemUserRoleDO", description = "用户角色关联 实体对象")
|
||||
public class SystemUserRoleDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
@TableField("role_id")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemMenuCreateRequest", description = "菜单 创建请求对象")
|
||||
public class SystemMenuCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "父id")
|
||||
private Long parentId;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单权限")
|
||||
private String permission;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
private Integer type;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
private Integer cache;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Size(max = 128)
|
||||
@NotBlank
|
||||
@Schema(description = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Size(max = 128)
|
||||
@NotBlank
|
||||
@Schema(description = "组件地址")
|
||||
private String component;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 菜单 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SystemMenuQueryRequest", description = "菜单 查询请求对象")
|
||||
public class SystemMenuQueryRequest extends PageRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private Long parentId;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 64)
|
||||
@Schema(description = "菜单权限")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
private Integer cache;
|
||||
|
||||
@Size(max = 64)
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Size(max = 128)
|
||||
@Schema(description = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Size(max = 64)
|
||||
@Schema(description = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Size(max = 128)
|
||||
@Schema(description = "组件地址")
|
||||
private String component;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemMenuUpdateRequest", description = "菜单 更新请求对象")
|
||||
public class SystemMenuUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "父id")
|
||||
private Long parentId;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单权限")
|
||||
private String permission;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
private Integer type;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
private Integer cache;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Size(max = 128)
|
||||
@NotBlank
|
||||
@Schema(description = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotBlank
|
||||
@Schema(description = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Size(max = 128)
|
||||
@NotBlank
|
||||
@Schema(description = "组件地址")
|
||||
private String component;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleCreateRequest", description = "角色 创建请求对象")
|
||||
public class SystemRoleCreateRequest implements Serializable {
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleMenuCreateRequest", description = "角色菜单关联 创建请求对象")
|
||||
public class SystemRoleMenuCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SystemRoleMenuQueryRequest", description = "角色菜单关联 查询请求对象")
|
||||
public class SystemRoleMenuQueryRequest extends PageRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleMenuUpdateRequest", description = "角色菜单关联 更新请求对象")
|
||||
public class SystemRoleMenuUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SystemRoleQueryRequest", description = "角色 查询请求对象")
|
||||
public class SystemRoleQueryRequest extends PageRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleUpdateRequest", description = "角色 更新请求对象")
|
||||
public class SystemRoleUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
@Size(max = 32)
|
||||
@NotBlank
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemUserRoleCreateRequest", description = "用户角色关联 创建请求对象")
|
||||
public class SystemUserRoleCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "SystemUserRoleQueryRequest", description = "用户角色关联 查询请求对象")
|
||||
public class SystemUserRoleQueryRequest extends PageRequest {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.orion.ops.module.infra.entity.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemUserRoleUpdateRequest", description = "用户角色关联 更新请求对象")
|
||||
public class SystemUserRoleUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 菜单 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemMenuVO", description = "菜单 视图响应对象")
|
||||
public class SystemMenuVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "菜单权限")
|
||||
private String permission;
|
||||
|
||||
@Schema(description = "菜单类型 1目录 2菜单 3功能")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "菜单缓存 0不缓存 1缓存")
|
||||
private Integer cache;
|
||||
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Schema(description = "组件地址")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleMenuVO", description = "角色菜单关联 视图响应对象")
|
||||
public class SystemRoleMenuVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemRoleVO", description = "角色 视图响应对象")
|
||||
public class SystemRoleVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "状态 0停用 1启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户角色关联 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "SystemUserRoleVO", description = "用户角色关联 视图响应对象")
|
||||
public class SystemUserRoleVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.orion.ops.module.infra.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 菜单状态枚举
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/16 1:45
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MenuStatusEnum {
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*/
|
||||
DISABLED(0),
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
ENABLED(1),
|
||||
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.orion.ops.module.infra.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 角色状态枚举
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/16 1:45
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RoleStatusEnum {
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*/
|
||||
DISABLED(0),
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
ENABLED(1),
|
||||
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/16 1:03
|
||||
*/
|
||||
public interface PermissionService {
|
||||
|
||||
/**
|
||||
* 检查角色是否含有此角色 (有效性判断)
|
||||
*
|
||||
* @param roles roles
|
||||
* @param role role
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean rolesHasRole(List<String> roles, String role);
|
||||
|
||||
/**
|
||||
* 检查角色是否含有此权限 (有效性判断)
|
||||
*
|
||||
* @param roles roles
|
||||
* @param permission permission
|
||||
* @return 是否包含
|
||||
*/
|
||||
boolean rolesHasPermission(List<String> roles, String permission);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
public interface SystemMenuService {
|
||||
|
||||
/**
|
||||
* 创建菜单
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createSystemMenu(SystemMenuCreateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 更新菜单
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateSystemMenu(SystemMenuUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 查询菜单
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
SystemMenuVO getSystemMenu(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量查询菜单
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<SystemMenuVO> getSystemMenuList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 分页查询菜单
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<SystemMenuVO> getSystemMenuPage(SystemMenuQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除菜单
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteSystemMenu(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除菜单
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteSystemMenu(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
public interface SystemRoleMenuService {
|
||||
|
||||
/**
|
||||
* 创建角色菜单关联
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createSystemRoleMenu(SystemRoleMenuCreateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 更新角色菜单关联
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateSystemRoleMenu(SystemRoleMenuUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 查询角色菜单关联
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
SystemRoleMenuVO getSystemRoleMenu(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量查询角色菜单关联
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<SystemRoleMenuVO> getSystemRoleMenuList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 分页查询角色菜单关联
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<SystemRoleMenuVO> getSystemRoleMenuPage(SystemRoleMenuQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除角色菜单关联
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteSystemRoleMenu(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除角色菜单关联
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteSystemRoleMenu(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
public interface SystemRoleService {
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createSystemRole(SystemRoleCreateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 更新角色
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateSystemRole(SystemRoleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 查询角色
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
SystemRoleVO getSystemRole(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量查询角色
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<SystemRoleVO> getSystemRoleList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 分页查询角色
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<SystemRoleVO> getSystemRolePage(SystemRoleQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除角色
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteSystemRole(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除角色
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteSystemRole(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
public interface SystemUserRoleService {
|
||||
|
||||
/**
|
||||
* 创建用户角色关联
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createSystemUserRole(SystemUserRoleCreateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 更新用户角色关联
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateSystemUserRole(SystemUserRoleUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 查询用户角色关联
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
SystemUserRoleVO getSystemUserRole(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量查询用户角色关联
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<SystemUserRoleVO> getSystemUserRoleList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 分页查询用户角色关联
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<SystemUserRoleVO> getSystemUserRolePage(SystemUserRoleQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除用户角色关联
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteSystemUserRole(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除用户角色关联
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteSystemUserRole(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.module.infra.convert.SystemMenuConvert;
|
||||
import com.orion.ops.module.infra.dao.SystemMenuDAO;
|
||||
import com.orion.ops.module.infra.dao.SystemRoleDAO;
|
||||
import com.orion.ops.module.infra.dao.SystemRoleMenuDAO;
|
||||
import com.orion.ops.module.infra.define.RoleDefine;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemMenuDO;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleDO;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleMenuDO;
|
||||
import com.orion.ops.module.infra.entity.dto.SystemMenuCacheDTO;
|
||||
import com.orion.ops.module.infra.enums.MenuStatusEnum;
|
||||
import com.orion.ops.module.infra.enums.RoleStatusEnum;
|
||||
import com.orion.ops.module.infra.service.PermissionService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 权限服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/7/16 1:05
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PermissionServiceImpl implements PermissionService {
|
||||
|
||||
/**
|
||||
* 菜单缓存
|
||||
*/
|
||||
private final Map<String, SystemRoleDO> roleCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 菜单缓存 以作角色权限直接引用
|
||||
*
|
||||
* @see #roleMenuCache
|
||||
*/
|
||||
private final List<SystemMenuCacheDTO> menuCache = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 角色菜单关联
|
||||
*/
|
||||
private final Map<String, List<SystemMenuCacheDTO>> roleMenuCache = new HashMap<>();
|
||||
|
||||
@Resource
|
||||
private SystemRoleDAO systemRoleDAO;
|
||||
|
||||
@Resource
|
||||
private SystemMenuDAO systemMenuDAO;
|
||||
|
||||
@Resource
|
||||
private SystemRoleMenuDAO systemRoleMenuDAO;
|
||||
|
||||
/**
|
||||
* 初始化缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initRoleMenuCache() {
|
||||
// TODO 分布式解决方案?
|
||||
long start = System.currentTimeMillis();
|
||||
log.info("initRoleMenuCache-start");
|
||||
// 加载所有角色
|
||||
List<SystemRoleDO> roles = systemRoleDAO.selectList(null);
|
||||
Map<Long, SystemRoleDO> roleRel = roles.stream()
|
||||
.collect(Collectors.toMap(SystemRoleDO::getId, Function.identity()));
|
||||
for (SystemRoleDO role : roles) {
|
||||
roleCache.put(role.getCode(), role);
|
||||
}
|
||||
// 加载所有菜单信息
|
||||
List<SystemMenuDO> menuList = systemMenuDAO.selectList(null);
|
||||
List<SystemMenuCacheDTO> menus = SystemMenuConvert.MAPPER.toCache(menuList);
|
||||
Map<Long, SystemMenuCacheDTO> menuMapping = menus.stream()
|
||||
.collect(Collectors.toMap(SystemMenuCacheDTO::getId, Function.identity()));
|
||||
menuCache.addAll(menus);
|
||||
// 查询所有角色菜单
|
||||
systemRoleMenuDAO.selectList(null)
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(SystemRoleMenuDO::getRoleId,
|
||||
Collectors.mapping(SystemRoleMenuDO::getMenuId, Collectors.toList())))
|
||||
.forEach((rid, mids) -> {
|
||||
// 获取菜单引用
|
||||
List<SystemMenuCacheDTO> roleMenus = mids.stream()
|
||||
.map(menuMapping::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
// 获取角色引用
|
||||
Optional.ofNullable(rid)
|
||||
.map(roleRel::get)
|
||||
.map(SystemRoleDO::getCode)
|
||||
.ifPresent(code -> roleMenuCache.put(code, roleMenus));
|
||||
});
|
||||
log.info("initRoleMenuCache-end used: {}ms", System.currentTimeMillis() - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rolesHasRole(List<String> roles, String role) {
|
||||
// 检查是否包含
|
||||
if (!roles.contains(role)) {
|
||||
return false;
|
||||
}
|
||||
// 检查是否启用
|
||||
return this.checkRoleEnabled(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rolesHasPermission(List<String> roles, String permission) {
|
||||
// 检查是否为超级管理员
|
||||
for (String role : roles) {
|
||||
// 角色是否启用
|
||||
if (this.checkRoleEnabled(role)) {
|
||||
continue;
|
||||
}
|
||||
// 是否为超级管理员
|
||||
if (RoleDefine.isAdmin(role)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 检查普通角色是否有此权限
|
||||
for (String role : roles) {
|
||||
// 角色是否启用
|
||||
if (this.checkRoleEnabled(role)) {
|
||||
continue;
|
||||
}
|
||||
// 获取角色权限列表
|
||||
List<SystemMenuCacheDTO> menus = roleMenuCache.get(role);
|
||||
if (Lists.isEmpty(menus)) {
|
||||
continue;
|
||||
}
|
||||
boolean has = menus.stream()
|
||||
.filter(s -> MenuStatusEnum.ENABLED.getStatus().equals(s.getStatus()))
|
||||
.map(SystemMenuCacheDTO::getPermission)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(permission::equals);
|
||||
if (has) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查角色是否启用
|
||||
*
|
||||
* @param role role
|
||||
* @return 是否启用
|
||||
*/
|
||||
private boolean checkRoleEnabled(String role) {
|
||||
SystemRoleDO systemRole = roleCache.get(role);
|
||||
if (systemRole == null) {
|
||||
return false;
|
||||
}
|
||||
return RoleStatusEnum.ENABLED.getStatus().equals(systemRole.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Valid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.module.infra.convert.SystemMenuConvert;
|
||||
import com.orion.ops.module.infra.dao.SystemMenuDAO;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemMenuDO;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.SystemMenuUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.SystemMenuVO;
|
||||
import com.orion.ops.module.infra.service.SystemMenuService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemMenuServiceImpl implements SystemMenuService {
|
||||
|
||||
@Resource
|
||||
private SystemMenuDAO systemMenuDAO;
|
||||
|
||||
@Override
|
||||
public Long createSystemMenu(SystemMenuCreateRequest request) {
|
||||
// 转换
|
||||
SystemMenuDO record = SystemMenuConvert.MAPPER.to(request);
|
||||
record.setId(null);
|
||||
// 查询是否存在
|
||||
this.checkSystemMenuPresent(record);
|
||||
// 插入
|
||||
int effect = systemMenuDAO.insert(record);
|
||||
log.info("SystemMenuService-createSystemMenu effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateSystemMenu(SystemMenuUpdateRequest request) {
|
||||
// 转换
|
||||
SystemMenuDO record = SystemMenuConvert.MAPPER.to(request);
|
||||
Valid.notNull(record.getId(), ErrorMessage.ID_MISSING);
|
||||
// 查询是否存在
|
||||
this.checkSystemMenuPresent(record);
|
||||
// 更新
|
||||
int effect = systemMenuDAO.updateById(record);
|
||||
log.info("SystemMenuService-updateSystemMenu effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemMenuVO getSystemMenu(Long id) {
|
||||
// 查询
|
||||
SystemMenuDO record = systemMenuDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return SystemMenuConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemMenuVO> getSystemMenuList(List<Long> idList) {
|
||||
// 查询
|
||||
List<SystemMenuDO> records = systemMenuDAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 转换
|
||||
return SystemMenuConvert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<SystemMenuVO> getSystemMenuPage(SystemMenuQueryRequest request) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemMenuDO> wrapper = systemMenuDAO.wrapper()
|
||||
.eq(SystemMenuDO::getId, request.getId())
|
||||
.eq(SystemMenuDO::getParentId, request.getParentId())
|
||||
.eq(SystemMenuDO::getName, request.getName())
|
||||
.eq(SystemMenuDO::getPermission, request.getPermission())
|
||||
.eq(SystemMenuDO::getType, request.getType())
|
||||
.eq(SystemMenuDO::getSort, request.getSort())
|
||||
.eq(SystemMenuDO::getStatus, request.getStatus())
|
||||
.eq(SystemMenuDO::getCache, request.getCache())
|
||||
.eq(SystemMenuDO::getIcon, request.getIcon())
|
||||
.eq(SystemMenuDO::getPath, request.getPath())
|
||||
.eq(SystemMenuDO::getComponentName, request.getComponentName())
|
||||
.eq(SystemMenuDO::getComponent, request.getComponent());
|
||||
// 查询
|
||||
return systemMenuDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(SystemMenuConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemMenu(Long id) {
|
||||
int effect = systemMenuDAO.deleteById(id);
|
||||
log.info("SystemMenuService-deleteSystemMenu id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteSystemMenu(List<Long> idList) {
|
||||
int effect = systemMenuDAO.deleteBatchIds(idList);
|
||||
log.info("SystemMenuService-batchDeleteSystemMenu idList: {}, effect: {}", JSON.toJSONString(idList), effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkSystemMenuPresent(SystemMenuDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemMenuDO> wrapper = systemMenuDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(SystemMenuDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(SystemMenuDO::getParentId, domain.getParentId())
|
||||
.eq(SystemMenuDO::getName, domain.getName())
|
||||
.eq(SystemMenuDO::getPermission, domain.getPermission())
|
||||
.eq(SystemMenuDO::getType, domain.getType())
|
||||
.eq(SystemMenuDO::getSort, domain.getSort())
|
||||
.eq(SystemMenuDO::getStatus, domain.getStatus())
|
||||
.eq(SystemMenuDO::getCache, domain.getCache())
|
||||
.eq(SystemMenuDO::getIcon, domain.getIcon())
|
||||
.eq(SystemMenuDO::getPath, domain.getPath())
|
||||
.eq(SystemMenuDO::getComponentName, domain.getComponentName())
|
||||
.eq(SystemMenuDO::getComponent, domain.getComponent());
|
||||
// 检查是否存在
|
||||
boolean present = systemMenuDAO.of().wrapper(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Valid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleMenuDO;
|
||||
import com.orion.ops.module.infra.dao.SystemRoleMenuDAO;
|
||||
import com.orion.ops.module.infra.service.SystemRoleMenuService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemRoleMenuServiceImpl implements SystemRoleMenuService {
|
||||
|
||||
@Resource
|
||||
private SystemRoleMenuDAO systemRoleMenuDAO;
|
||||
|
||||
@Override
|
||||
public Long createSystemRoleMenu(SystemRoleMenuCreateRequest request) {
|
||||
// 转换
|
||||
SystemRoleMenuDO record = SystemRoleMenuConvert.MAPPER.to(request);
|
||||
record.setId(null);
|
||||
// 查询是否存在
|
||||
this.checkSystemRoleMenuPresent(record);
|
||||
// 插入
|
||||
int effect = systemRoleMenuDAO.insert(record);
|
||||
log.info("SystemRoleMenuService-createSystemRoleMenu effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateSystemRoleMenu(SystemRoleMenuUpdateRequest request) {
|
||||
// 转换
|
||||
SystemRoleMenuDO record = SystemRoleMenuConvert.MAPPER.to(request);
|
||||
Valid.notNull(record.getId(), ErrorMessage.ID_MISSING);
|
||||
// 查询是否存在
|
||||
this.checkSystemRoleMenuPresent(record);
|
||||
// 更新
|
||||
int effect = systemRoleMenuDAO.updateById(record);
|
||||
log.info("SystemRoleMenuService-updateSystemRoleMenu effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemRoleMenuVO getSystemRoleMenu(Long id) {
|
||||
// 查询
|
||||
SystemRoleMenuDO record = systemRoleMenuDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return SystemRoleMenuConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemRoleMenuVO> getSystemRoleMenuList(List<Long> idList) {
|
||||
// 查询
|
||||
List<SystemRoleMenuDO> records = systemRoleMenuDAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 转换
|
||||
return SystemRoleMenuConvert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<SystemRoleMenuVO> getSystemRoleMenuPage(SystemRoleMenuQueryRequest request) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemRoleMenuDO> wrapper = systemRoleMenuDAO.wrapper()
|
||||
.eq(SystemRoleMenuDO::getId, request.getId())
|
||||
.eq(SystemRoleMenuDO::getRoleId, request.getRoleId())
|
||||
.eq(SystemRoleMenuDO::getMenuId, request.getMenuId());
|
||||
// 查询
|
||||
return systemRoleMenuDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(SystemRoleMenuConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemRoleMenu(Long id) {
|
||||
int effect = systemRoleMenuDAO.deleteById(id);
|
||||
log.info("SystemRoleMenuService-deleteSystemRoleMenu id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteSystemRoleMenu(List<Long> idList) {
|
||||
int effect = systemRoleMenuDAO.deleteBatchIds(idList);
|
||||
log.info("SystemRoleMenuService-batchDeleteSystemRoleMenu idList: {}, effect: {}", JSON.toJSONString(idList), effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkSystemRoleMenuPresent(SystemRoleMenuDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemRoleMenuDO> wrapper = systemRoleMenuDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(SystemRoleMenuDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(SystemRoleMenuDO::getRoleId, domain.getRoleId())
|
||||
.eq(SystemRoleMenuDO::getMenuId, domain.getMenuId());
|
||||
// 检查是否存在
|
||||
boolean present = systemRoleMenuDAO.of().wrapper(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Valid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemRoleDO;
|
||||
import com.orion.ops.module.infra.dao.SystemRoleDAO;
|
||||
import com.orion.ops.module.infra.service.SystemRoleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemRoleServiceImpl implements SystemRoleService {
|
||||
|
||||
@Resource
|
||||
private SystemRoleDAO systemRoleDAO;
|
||||
|
||||
@Override
|
||||
public Long createSystemRole(SystemRoleCreateRequest request) {
|
||||
// 转换
|
||||
SystemRoleDO record = SystemRoleConvert.MAPPER.to(request);
|
||||
record.setId(null);
|
||||
// 查询是否存在
|
||||
this.checkSystemRolePresent(record);
|
||||
// 插入
|
||||
int effect = systemRoleDAO.insert(record);
|
||||
log.info("SystemRoleService-createSystemRole effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateSystemRole(SystemRoleUpdateRequest request) {
|
||||
// 转换
|
||||
SystemRoleDO record = SystemRoleConvert.MAPPER.to(request);
|
||||
Valid.notNull(record.getId(), ErrorMessage.ID_MISSING);
|
||||
// 查询是否存在
|
||||
this.checkSystemRolePresent(record);
|
||||
// 更新
|
||||
int effect = systemRoleDAO.updateById(record);
|
||||
log.info("SystemRoleService-updateSystemRole effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemRoleVO getSystemRole(Long id) {
|
||||
// 查询
|
||||
SystemRoleDO record = systemRoleDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return SystemRoleConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemRoleVO> getSystemRoleList(List<Long> idList) {
|
||||
// 查询
|
||||
List<SystemRoleDO> records = systemRoleDAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 转换
|
||||
return SystemRoleConvert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<SystemRoleVO> getSystemRolePage(SystemRoleQueryRequest request) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemRoleDO> wrapper = systemRoleDAO.wrapper()
|
||||
.eq(SystemRoleDO::getId, request.getId())
|
||||
.eq(SystemRoleDO::getName, request.getName())
|
||||
.eq(SystemRoleDO::getCode, request.getCode())
|
||||
.eq(SystemRoleDO::getStatus, request.getStatus());
|
||||
// 查询
|
||||
return systemRoleDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(SystemRoleConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemRole(Long id) {
|
||||
int effect = systemRoleDAO.deleteById(id);
|
||||
log.info("SystemRoleService-deleteSystemRole id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteSystemRole(List<Long> idList) {
|
||||
int effect = systemRoleDAO.deleteBatchIds(idList);
|
||||
log.info("SystemRoleService-batchDeleteSystemRole idList: {}, effect: {}", JSON.toJSONString(idList), effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkSystemRolePresent(SystemRoleDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemRoleDO> wrapper = systemRoleDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(SystemRoleDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(SystemRoleDO::getName, domain.getName())
|
||||
.eq(SystemRoleDO::getCode, domain.getCode())
|
||||
.eq(SystemRoleDO::getStatus, domain.getStatus());
|
||||
// 检查是否存在
|
||||
boolean present = systemRoleDAO.of().wrapper(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Valid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.module.infra.entity.vo.*;
|
||||
import com.orion.ops.module.infra.entity.dto.*;
|
||||
import com.orion.ops.module.infra.entity.request.*;
|
||||
import com.orion.ops.module.infra.convert.*;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemUserRoleDO;
|
||||
import com.orion.ops.module.infra.dao.SystemUserRoleDAO;
|
||||
import com.orion.ops.module.infra.service.SystemUserRoleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色关联 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-7-16 01:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemUserRoleServiceImpl implements SystemUserRoleService {
|
||||
|
||||
@Resource
|
||||
private SystemUserRoleDAO systemUserRoleDAO;
|
||||
|
||||
@Override
|
||||
public Long createSystemUserRole(SystemUserRoleCreateRequest request) {
|
||||
// 转换
|
||||
SystemUserRoleDO record = SystemUserRoleConvert.MAPPER.to(request);
|
||||
record.setId(null);
|
||||
// 查询是否存在
|
||||
this.checkSystemUserRolePresent(record);
|
||||
// 插入
|
||||
int effect = systemUserRoleDAO.insert(record);
|
||||
log.info("SystemUserRoleService-createSystemUserRole effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateSystemUserRole(SystemUserRoleUpdateRequest request) {
|
||||
// 转换
|
||||
SystemUserRoleDO record = SystemUserRoleConvert.MAPPER.to(request);
|
||||
Valid.notNull(record.getId(), ErrorMessage.ID_MISSING);
|
||||
// 查询是否存在
|
||||
this.checkSystemUserRolePresent(record);
|
||||
// 更新
|
||||
int effect = systemUserRoleDAO.updateById(record);
|
||||
log.info("SystemUserRoleService-updateSystemUserRole effect: {}, domain: {}", effect, JSON.toJSONString(record));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemUserRoleVO getSystemUserRole(Long id) {
|
||||
// 查询
|
||||
SystemUserRoleDO record = systemUserRoleDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return SystemUserRoleConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemUserRoleVO> getSystemUserRoleList(List<Long> idList) {
|
||||
// 查询
|
||||
List<SystemUserRoleDO> records = systemUserRoleDAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
return Lists.empty();
|
||||
}
|
||||
// 转换
|
||||
return SystemUserRoleConvert.MAPPER.to(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<SystemUserRoleVO> getSystemUserRolePage(SystemUserRoleQueryRequest request) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemUserRoleDO> wrapper = systemUserRoleDAO.wrapper()
|
||||
.eq(SystemUserRoleDO::getId, request.getId())
|
||||
.eq(SystemUserRoleDO::getUserId, request.getUserId())
|
||||
.eq(SystemUserRoleDO::getRoleId, request.getRoleId());
|
||||
// 查询
|
||||
return systemUserRoleDAO.of()
|
||||
.wrapper(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(SystemUserRoleConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemUserRole(Long id) {
|
||||
int effect = systemUserRoleDAO.deleteById(id);
|
||||
log.info("SystemUserRoleService-deleteSystemUserRole id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteSystemUserRole(List<Long> idList) {
|
||||
int effect = systemUserRoleDAO.deleteBatchIds(idList);
|
||||
log.info("SystemUserRoleService-batchDeleteSystemUserRole idList: {}, effect: {}", JSON.toJSONString(idList), effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkSystemUserRolePresent(SystemUserRoleDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<SystemUserRoleDO> wrapper = systemUserRoleDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(SystemUserRoleDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(SystemUserRoleDO::getUserId, domain.getUserId())
|
||||
.eq(SystemUserRoleDO::getRoleId, domain.getRoleId());
|
||||
// 检查是否存在
|
||||
boolean present = systemUserRoleDAO.of().wrapper(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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="com.orion.ops.module.infra.dao.SystemMenuDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.SystemMenuDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="permission" property="permission"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="cache" property="cache"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="path" property="path"/>
|
||||
<result column="component_name" property="componentName"/>
|
||||
<result column="component" property="component"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, update_time, creator, updater, deleted, id, parent_id, name, permission, type, sort, status, cache, icon, path, component_name, component
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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="com.orion.ops.module.infra.dao.SystemRoleDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.SystemRoleDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="code" property="code"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, update_time, creator, updater, deleted, id, name, code, status
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="com.orion.ops.module.infra.dao.SystemRoleMenuDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.SystemRoleMenuDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="menu_id" property="menuId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, update_time, creator, updater, deleted, id, role_id, menu_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="com.orion.ops.module.infra.dao.SystemUserRoleDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.SystemUserRoleDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, update_time, creator, updater, deleted, id, user_id, role_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user