diff --git a/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/constants/DictConstants.java b/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/constants/DictConstants.java index 4fbeb979b..ba86925f0 100644 --- a/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/constants/DictConstants.java +++ b/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/constants/DictConstants.java @@ -42,4 +42,19 @@ public interface DictConstants { */ String DICT_EXCEPTION_STEP_CODE = "13"; + /** + * 添加字典的权限标识 + */ + String ADD_DICT = "ADD_DICT"; + + /** + * 修改字典的权限标识 + */ + String EDIT_DICT = "EDIT_DICT"; + + /** + * 删除字典的权限标识 + */ + String DELETE_DICT = "DELETE_DICT"; + } diff --git a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/AreaController.java b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/AreaController.java index 5fe664b87..d743f6bcb 100644 --- a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/AreaController.java +++ b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/AreaController.java @@ -1,16 +1,16 @@ package cn.stylefeng.roses.kernel.dict.modular.controller; +import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.dict.modular.entity.Area; import cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo; import cn.stylefeng.roses.kernel.dict.modular.pojo.request.AreaRequest; import cn.stylefeng.roses.kernel.dict.modular.service.AreaService; -import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource; -import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum; import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; +import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; +import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; +import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; diff --git a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictController.java b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictController.java index fc62510ab..767b3c182 100644 --- a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictController.java +++ b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictController.java @@ -24,12 +24,12 @@ */ package cn.stylefeng.roses.kernel.dict.modular.controller; +import cn.stylefeng.roses.kernel.dict.api.constants.DictConstants; import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict; import cn.stylefeng.roses.kernel.dict.modular.pojo.TreeDictInfo; import cn.stylefeng.roses.kernel.dict.modular.pojo.request.DictRequest; import cn.stylefeng.roses.kernel.dict.modular.service.DictService; import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog; -import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum; import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest; import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; @@ -50,7 +50,7 @@ import java.util.List; * @since 2020/10/29 14:45 */ @RestController -@ApiResource(name = "字典详情管理", resBizType = ResBizTypeEnum.SYSTEM) +@ApiResource(name = "字典详情管理") public class DictController { @Resource @@ -74,7 +74,7 @@ public class DictController { * @author fengshuonan * @since 2020/10/29 16:35 */ - @PostResource(name = "添加字典", path = "/dict/add") + @PostResource(name = "添加字典", path = "/dict/add", requiredPermission = true, requirePermissionCode = DictConstants.ADD_DICT) @BusinessLog public ResponseData add(@RequestBody @Validated(DictRequest.add.class) DictRequest dictRequest) { this.dictService.add(dictRequest); @@ -87,19 +87,20 @@ public class DictController { * @author liyanjun * @date 2023/07/04 10:29 */ - @PostResource(name = "批量删除字典条目", path = "/dict/batchDelete") + @PostResource(name = "批量删除字典条目", path = "/dict/batchDelete", requiredPermission = true, + requirePermissionCode = DictConstants.DELETE_DICT) public ResponseData batchDelete(@RequestBody @Validated(DictRequest.batchDelete.class) DictRequest dictRequest) { - dictService.batchDelete(dictRequest); + dictService.batchDelete(dictRequest); return new SuccessResponseData<>(); } - + /** * 删除字典条目 * * @author fengshuonan * @since 2020/10/29 16:35 */ - @PostResource(name = "删除字典", path = "/dict/delete") + @PostResource(name = "删除字典", path = "/dict/delete", requiredPermission = true, requirePermissionCode = DictConstants.DELETE_DICT) @BusinessLog public ResponseData delete(@RequestBody @Validated(DictRequest.delete.class) DictRequest dictRequest) { this.dictService.del(dictRequest); @@ -112,7 +113,7 @@ public class DictController { * @author fengshuonan * @since 2020/10/29 16:35 */ - @PostResource(name = "修改字典", path = "/dict/edit") + @PostResource(name = "修改字典", path = "/dict/edit", requiredPermission = true, requirePermissionCode = DictConstants.EDIT_DICT) @BusinessLog public ResponseData edit(@RequestBody @Validated(DictRequest.edit.class) DictRequest dictRequest) { this.dictService.edit(dictRequest); @@ -150,7 +151,8 @@ public class DictController { * @author fengshuonan * @since 2023/6/27 18:23 */ - @PostResource(name = "更新整个字典树结构,用来更新上下级结构和顺序", path = "/dict/updateDictTree") + @PostResource(name = "更新整个字典树结构,用来更新上下级结构和顺序", path = "/dict/updateDictTree", requiredPermission = true, + requirePermissionCode = DictConstants.EDIT_DICT) public ResponseData> updateDictTree(@RequestBody @Validated(DictRequest.updateTree.class) DictRequest dictRequest) { this.dictService.updateDictTree(dictRequest); return new SuccessResponseData<>(); diff --git a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictTypeController.java b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictTypeController.java index 1f10ece59..5cbe49a46 100644 --- a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictTypeController.java +++ b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/controller/DictTypeController.java @@ -24,11 +24,11 @@ */ package cn.stylefeng.roses.kernel.dict.modular.controller; +import cn.stylefeng.roses.kernel.dict.api.constants.DictConstants; import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType; import cn.stylefeng.roses.kernel.dict.modular.pojo.request.DictTypeRequest; import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService; import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog; -import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum; import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest; import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; @@ -49,7 +49,7 @@ import java.util.List; * @since 2020/10/30 21:46 */ @RestController -@ApiResource(name = "字典类型管理", resBizType = ResBizTypeEnum.SYSTEM) +@ApiResource(name = "字典类型管理") public class DictTypeController { @Resource @@ -61,7 +61,7 @@ public class DictTypeController { * @author fengshuonan * @since 2018/7/25 下午12:36 */ - @PostResource(name = "添加字典类型", path = "/dictType/add") + @PostResource(name = "添加字典类型", path = "/dictType/add", requiredPermission = true, requirePermissionCode = DictConstants.ADD_DICT) @BusinessLog public ResponseData add(@RequestBody @Validated(DictTypeRequest.add.class) DictTypeRequest dictTypeRequest) { this.dictTypeService.add(dictTypeRequest); @@ -74,7 +74,8 @@ public class DictTypeController { * @author fengshuonan * @since 2018/7/25 下午12:36 */ - @PostResource(name = "删除字典类型", path = "/dictType/delete") + @PostResource(name = "删除字典类型", path = "/dictType/delete", requiredPermission = true, + requirePermissionCode = DictConstants.DELETE_DICT) @BusinessLog public ResponseData delete(@RequestBody @Validated(DictTypeRequest.delete.class) DictTypeRequest dictTypeRequest) { this.dictTypeService.del(dictTypeRequest); @@ -87,7 +88,8 @@ public class DictTypeController { * @author fengshuonan * @since 2018/7/25 下午12:36 */ - @PostResource(name = "修改字典类型", path = "/dictType/edit") + @PostResource(name = "修改字典类型", path = "/dictType/edit", requiredPermission = true, + requirePermissionCode = DictConstants.EDIT_DICT) @BusinessLog public ResponseData edit(@RequestBody @Validated(DictTypeRequest.edit.class) DictTypeRequest dictTypeRequest) { this.dictTypeService.edit(dictTypeRequest);