feat(perm): 补充 Protocol/PermCode Controller 缺失的 @PermCode 注解

- UserProtocolController: +类级 menuCode=system:protocol + 10 方法级 (view/manage), find-default 已有 @IgnoreAuth 跳过
- UserProtocolVersionController: +类级 menuCode=system:protocol + 7 方法级 (view/manage/publish)
- PermCodeController: get-by-menu 补 view; find-codes-by-user 已有 @IgnoreAuth 跳过
This commit is contained in:
DaxPay Dev
2026-06-27 22:56:00 +08:00
parent 918437abc7
commit de34430db7
3 changed files with 22 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ public class PermCodeController {
return Res.ok(permCodeScanService.scan(new PermCodeScanParam()));
}
@PermCode(code = "view", nameCn = "菜单查看", nameEn = "Menu View")
@Operation(summary = "根据菜单查询权限码列表")
@GetMapping("/get-by-menu")
public Result<List<MenuPermCodeItemResult>> findByMenu(

View File

@@ -8,6 +8,7 @@ import cn.daxpay.open.platform.system.result.protocol.UserProtocolContentResult;
import cn.daxpay.open.platform.system.result.protocol.UserProtocolResult;
import cn.daxpay.open.platform.system.service.protocol.UserProtocolService;
import cn.daxpay.open.platform.core.annotation.IgnoreAuth;
import cn.daxpay.open.platform.core.annotation.PermCode;
import cn.daxpay.open.platform.common.i18n.util.I18nUtil;
import cn.daxpay.open.platform.core.rest.dto.LabelValue;
import cn.daxpay.open.platform.core.rest.Res;
@@ -27,6 +28,7 @@ import java.util.List;
/// # 用户协议控制器
///
@PermCode(menuCode = "system:protocol")
@Validated
@Tag(name = "用户协议")
@RestController
@@ -40,6 +42,7 @@ public class UserProtocolController {
/// @param pageParam 分页参数
/// @param query 查询条件
/// @return 用户协议分页结果
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "分页")
@GetMapping("/page")
public Result<PageResult<UserProtocolResult>> page(PageParam pageParam, UserProtocolQuery query){
@@ -50,6 +53,7 @@ public class UserProtocolController {
///
/// @param param 用户协议参数
/// @return 操作结果
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "新增")
@PostMapping("/add")
public Result<Void> add(@RequestBody @Validated(ValidationGroup.add.class) UserProtocolParam param){
@@ -61,6 +65,7 @@ public class UserProtocolController {
///
/// @param param 用户协议参数
/// @return 操作结果
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "修改")
@PostMapping("/update")
public Result<Void> update(@RequestBody @Validated(ValidationGroup.edit.class) UserProtocolParam param){
@@ -72,6 +77,7 @@ public class UserProtocolController {
///
/// @param id 协议ID
/// @return 操作结果
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "删除")
@PostMapping("/delete")
public Result<Void> delete(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -83,6 +89,7 @@ public class UserProtocolController {
///
/// @param id 协议ID
/// @return 用户协议信息
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "查询")
@GetMapping("/get")
public Result<UserProtocolResult> findById(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -104,6 +111,7 @@ public class UserProtocolController {
return Res.ok(userProtocolService.findDefault(type, clientType, language));
}
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "协议类型列表")
@GetMapping("/type-options")
public Result<List<LabelValue>> typeOptions(){
@@ -112,6 +120,7 @@ public class UserProtocolController {
.toList());
}
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "协议端类型列表")
@GetMapping("/client-type-options")
public Result<List<LabelValue>> clientTypeOptions(){
@@ -124,6 +133,7 @@ public class UserProtocolController {
///
/// @param id 协议ID
/// @return 操作结果
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "设置默认")
@PostMapping("/set-default")
public Result<Void> setDefault(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -135,6 +145,7 @@ public class UserProtocolController {
///
/// @param id 协议ID
/// @return 操作结果
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "取消默认")
@PostMapping("/cancel-default")
public Result<Void> cancelDefault(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -147,6 +158,7 @@ public class UserProtocolController {
/// @param id 源协议ID
/// @param clientType 目标端类型
/// @return 目标协议ID
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "复制到其他端")
@PostMapping("/copy-to-client")
public Result<Long> copyToClient(@NotNull(message = "{validation.field.id.notNull}") Long id,

View File

@@ -1,5 +1,6 @@
package cn.daxpay.open.platform.system.controller.protocol;
import cn.daxpay.open.platform.core.annotation.PermCode;
import cn.daxpay.open.platform.core.rest.Res;
import cn.daxpay.open.platform.core.rest.param.PageParam;
import cn.daxpay.open.platform.core.rest.result.PageResult;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
/// # 用户协议版本控制器
///
@PermCode(menuCode = "system:protocol")
@Validated
@Tag(name = "用户协议版本")
@RestController
@@ -31,6 +33,7 @@ public class UserProtocolVersionController {
/// @param pageParam 分页参数
/// @param query 查询条件
/// @return 版本分页结果
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "分页")
@GetMapping("/page")
public Result<PageResult<UserProtocolVersionResult>> page(PageParam pageParam, UserProtocolVersionQuery query){
@@ -40,6 +43,7 @@ public class UserProtocolVersionController {
/// 新建草稿
///
/// @param param 版本参数
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "新建草稿")
@PostMapping("/add")
public Result<Void> add(@RequestBody @Validated(ValidationGroup.add.class) UserProtocolVersionParam param){
@@ -50,6 +54,7 @@ public class UserProtocolVersionController {
/// 编辑草稿内容(仅草稿可编辑)
///
/// @param param 版本参数
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "编辑草稿")
@PostMapping("/update")
public Result<Void> update(@RequestBody @Validated(ValidationGroup.edit.class) UserProtocolVersionParam param){
@@ -60,6 +65,7 @@ public class UserProtocolVersionController {
/// 删除草稿(仅草稿可删除)
///
/// @param id 版本ID
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "删除草稿")
@PostMapping("/delete")
public Result<Void> delete(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -71,6 +77,7 @@ public class UserProtocolVersionController {
///
/// @param id 版本ID
/// @return 版本信息
@PermCode(code = "view", nameCn = "协议查看", nameEn = "Protocol View")
@Operation(summary = "查询")
@GetMapping("/get")
public Result<UserProtocolVersionResult> findById(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -80,6 +87,7 @@ public class UserProtocolVersionController {
/// 发布版本(草稿 -> 已发布, 同协议同语言原已发布自动归档)
///
/// @param id 版本ID
@PermCode(code = "publish", nameCn = "协议发布", nameEn = "Protocol Publish")
@Operation(summary = "发布版本")
@PostMapping("/publish")
public Result<Void> publish(@NotNull(message = "{validation.field.id.notNull}") Long id){
@@ -90,6 +98,7 @@ public class UserProtocolVersionController {
/// 归档版本(已发布 -> 归档)
///
/// @param id 版本ID
@PermCode(code = "manage", nameCn = "协议管理", nameEn = "Protocol Manage")
@Operation(summary = "归档版本")
@PostMapping("/archive")
public Result<Void> archive(@NotNull(message = "{validation.field.id.notNull}") Long id){