mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-05 08:57:12 +08:00
优化:部门新增类型字段,用于标识部门是系统内置或自定义
1.系统内置部门不允许禁用、删除、修改上级部门 2.抽取 getAncestors 方法,用于复用获取祖级列表 3.删除部门时,自动删除角色和部门关联
This commit is contained in:
@@ -144,7 +144,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "新增数据")
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
protected R<Long> add(@Validated @RequestBody C request) {
|
||||
protected R<Long> add(@Validated(BaseRequest.Add.class) @RequestBody C request) {
|
||||
this.checkPermission("add");
|
||||
Long id = baseService.add(request);
|
||||
return R.ok("新增成功", id);
|
||||
@@ -162,7 +162,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "修改数据")
|
||||
@ResponseBody
|
||||
@PutMapping("/{id}")
|
||||
protected R update(@Validated @RequestBody C request, @PathVariable Long id) {
|
||||
protected R update(@Validated(BaseRequest.Update.class) @RequestBody C request, @PathVariable Long id) {
|
||||
this.checkPermission("update");
|
||||
baseService.update(request, id);
|
||||
return R.ok("修改成功");
|
||||
|
||||
@@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
/**
|
||||
* VO 基类
|
||||
@@ -63,4 +64,10 @@ public class BaseVO implements Serializable {
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否禁用修改
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean disabled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user