diff --git a/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java b/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java index 0b1bccfc0..91fd36104 100644 --- a/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java +++ b/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java @@ -1,12 +1,78 @@ package club.joylink.rtss.controller.permission2; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import club.joylink.rtss.vo.AccountVO; +import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.permission.*; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** - *功能权限管理接口V2 + * 权限管理接口V2 */ @RestController @RequestMapping("/api/v2/permission") public class AcPermissionController { + + /** + * 创建权限 + * + * @return 如果创建成功,则返回权限id + */ + @PostMapping("/create") + public String createPermission(@RequestBody CreatePermissionReqVo req, @RequestAttribute AccountVO user) { + return null; + } + + /** + * 修改权限基础信息(名称和描述) + */ + @PutMapping("/basic") + public void updatePermissionBasic(@RequestBody UpdatePermissionBasicReqVo req) { + + } + + /** + * 给权限添加功能 + * + * @param permissionId 权限id + * @param abilityId 权限功能id,即system_ability.id + */ + @PostMapping("/{permissionId}/accept/{abilityId}") + public void addAbilityToPermission(@PathVariable("permissionId") Long permissionId, @PathVariable("abilityId") Long abilityId) { + + } + + /** + * 获取权限的所有功能 + * + * @param permissionId 权限id + */ + @GetMapping("/{permissionId}/abilities") + public List findAbilities(@PathVariable("permissionId") Long permissionId) { + return null; + } + + /** + * 删除权限的功能 + */ + @DeleteMapping("/{permissionId}/abilities") + public void deleteAbilities(@RequestBody PermissionAbilityDeletedReqVo req) { + + } + + /** + * 获取一个权限的完整信息 + */ + @GetMapping("/{permissionId}/whole") + public WholePermissionRspVo findWholePermission() { + return null; + } + /** + * 分页获取权限 + */ + @PostMapping("/find/page") + public PageVOfindByPage(@RequestBody FindPermissionBasicByPageReqVo req){ + return null; + } } diff --git a/src/main/java/club/joylink/rtss/controller/permission2/PermissionSubjectController.java b/src/main/java/club/joylink/rtss/controller/permission2/PermissionSubjectController.java index 8cc489324..78250b41a 100644 --- a/src/main/java/club/joylink/rtss/controller/permission2/PermissionSubjectController.java +++ b/src/main/java/club/joylink/rtss/controller/permission2/PermissionSubjectController.java @@ -3,7 +3,7 @@ package club.joylink.rtss.controller.permission2; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** - * 主体(用户或组织)权限管理接口 + * 主体(用户或组织)的权限管理接口
*/ @RestController @RequestMapping("/api/v2/permission/subject") diff --git a/src/main/java/club/joylink/rtss/controller/permission2/SystemAbilityController.java b/src/main/java/club/joylink/rtss/controller/permission2/SystemAbilityController.java index 5b7a923ef..2ca71eb68 100644 --- a/src/main/java/club/joylink/rtss/controller/permission2/SystemAbilityController.java +++ b/src/main/java/club/joylink/rtss/controller/permission2/SystemAbilityController.java @@ -4,7 +4,6 @@ import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.permission.*; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; - import java.util.List; /** diff --git a/src/main/java/club/joylink/rtss/vo/permission/CreatePermissionReqVo.java b/src/main/java/club/joylink/rtss/vo/permission/CreatePermissionReqVo.java new file mode 100644 index 000000000..82aeb4a7c --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/CreatePermissionReqVo.java @@ -0,0 +1,18 @@ +package club.joylink.rtss.vo.permission; + +import lombok.Data; + +/** + * 创建权限请求 + */ +@Data +public class CreatePermissionReqVo { + /** + * 权限名称 + */ + private String name; + /** + * 权限描述 + */ + private String des; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/FindPermissionBasicByPageReqVo.java b/src/main/java/club/joylink/rtss/vo/permission/FindPermissionBasicByPageReqVo.java new file mode 100644 index 000000000..7a7312521 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/FindPermissionBasicByPageReqVo.java @@ -0,0 +1,12 @@ +package club.joylink.rtss.vo.permission; + +import club.joylink.rtss.vo.client.PageQueryVO; +import lombok.Data; + +@Data +public class FindPermissionBasicByPageReqVo extends PageQueryVO { + /** + * 是否降序,true-降序,false-升序,默认值为true; + */ + private Boolean desc = true; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityDeletedReqVo.java b/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityDeletedReqVo.java new file mode 100644 index 000000000..a05724abd --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityDeletedReqVo.java @@ -0,0 +1,25 @@ +package club.joylink.rtss.vo.permission; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 请求要删除的权限的功能 + */ +@Data +public class PermissionAbilityDeletedReqVo { + /** + * 权限id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long permissionId; + /** + * 要删除的功能的id,system_ability.id + */ + @NotNull + private List deleteAbilityIds; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityRspVo.java b/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityRspVo.java new file mode 100644 index 000000000..dfa1204ba --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/PermissionAbilityRspVo.java @@ -0,0 +1,32 @@ +package club.joylink.rtss.vo.permission; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 权限的功能 + */ +@Data +public class PermissionAbilityRspVo { + /** + * 功能id + */ + @JsonSerialize(using = ToStringSerializer.class) + @NotNull + private Long id; + /** + * 权限功能名称 + */ + private String name; + /** + * 功能描述 + */ + private String des; + /** + * 功能类型 + */ + private SystemAbilityType type; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/PermissionBasicRspVo.java b/src/main/java/club/joylink/rtss/vo/permission/PermissionBasicRspVo.java new file mode 100644 index 000000000..7ff8b4460 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/PermissionBasicRspVo.java @@ -0,0 +1,39 @@ +package club.joylink.rtss.vo.permission; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class PermissionBasicRspVo { + /** + * 权限id,对功能(system_ability)的管理 + */ + private Long id; + + /** + * 权限名称 + */ + private String name; + + /** + * 权限描述 + */ + private String des; + + /** + * 创建者id + */ + private Long creatorId; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/UpdatePermissionBasicReqVo.java b/src/main/java/club/joylink/rtss/vo/permission/UpdatePermissionBasicReqVo.java new file mode 100644 index 000000000..5b1380c1c --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/UpdatePermissionBasicReqVo.java @@ -0,0 +1,25 @@ +package club.joylink.rtss.vo.permission; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class UpdatePermissionBasicReqVo { + /** + * 权限id + */ + @JsonSerialize(using = ToStringSerializer.class) + @NotNull + private Long id; + /** + * 权限名称 + */ + private String name; + /** + * 权限描述 + */ + private String des; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/WholePermissionRspVo.java b/src/main/java/club/joylink/rtss/vo/permission/WholePermissionRspVo.java new file mode 100644 index 000000000..d681ba333 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/WholePermissionRspVo.java @@ -0,0 +1,44 @@ +package club.joylink.rtss.vo.permission; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class WholePermissionRspVo { + /** + * 权限id,对功能(system_ability)的管理 + */ + private Long id; + + /** + * 权限名称 + */ + private String name; + + /** + * 权限描述 + */ + private String des; + + /** + * 创建者id + */ + private Long creatorId; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + + /** + * 权限能力列表 + */ + private List abilityList; +}