permission

This commit is contained in:
xzb 2022-10-13 16:37:46 +08:00
parent 2955125f76
commit 5b61c9bef6
10 changed files with 265 additions and 5 deletions

View File

@ -1,12 +1,78 @@
package club.joylink.rtss.controller.permission2; package club.joylink.rtss.controller.permission2;
import org.springframework.web.bind.annotation.RequestMapping; import club.joylink.rtss.vo.AccountVO;
import org.springframework.web.bind.annotation.RestController; 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 @RestController
@RequestMapping("/api/v2/permission") @RequestMapping("/api/v2/permission")
public class AcPermissionController { 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<PermissionAbilityRspVo> 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 PageVO<PermissionBasicRspVo>findByPage(@RequestBody FindPermissionBasicByPageReqVo req){
return null;
}
} }

View File

@ -3,7 +3,7 @@ package club.joylink.rtss.controller.permission2;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 主体(用户或组织)权限管理接口 * 主体(用户或组织)权限管理接口<br>
*/ */
@RestController @RestController
@RequestMapping("/api/v2/permission/subject") @RequestMapping("/api/v2/permission/subject")

View File

@ -4,7 +4,6 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.permission.*; import club.joylink.rtss.vo.permission.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** /**

View File

@ -0,0 +1,18 @@
package club.joylink.rtss.vo.permission;
import lombok.Data;
/**
* 创建权限请求
*/
@Data
public class CreatePermissionReqVo {
/**
* 权限名称
*/
private String name;
/**
* 权限描述
*/
private String des;
}

View File

@ -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;
}

View File

@ -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<Long> deleteAbilityIds;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<PermissionAbilityRspVo> abilityList;
}