mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 08:57:17 +08:00
refactor(extension/crud): 优化校验器分组命名
This commit is contained in:
@@ -33,7 +33,7 @@ import top.continew.starter.extension.crud.model.req.BaseReq;
|
||||
import top.continew.starter.extension.crud.model.resp.BaseIdResp;
|
||||
import top.continew.starter.extension.crud.model.resp.BasePageResp;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidateGroup;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Operation(summary = "新增数据", description = "新增数据")
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
public BaseIdResp<Long> add(@Validated(CrudValidateGroup.Add.class) @RequestBody C req) {
|
||||
public BaseIdResp<Long> add(@Validated(CrudValidationGroup.Add.class) @RequestBody C req) {
|
||||
return new BaseIdResp<>(baseService.add(req));
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
||||
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
|
||||
@ResponseBody
|
||||
@PutMapping("/{id}")
|
||||
public void update(@Validated(CrudValidateGroup.Update.class) @RequestBody C req, @PathVariable("id") Long id) {
|
||||
public void update(@Validated(CrudValidationGroup.Update.class) @RequestBody C req, @PathVariable("id") Long id) {
|
||||
baseService.update(req, id);
|
||||
}
|
||||
|
||||
|
@@ -24,15 +24,15 @@ import jakarta.validation.groups.Default;
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface CrudValidateGroup extends Default {
|
||||
public interface CrudValidationGroup extends Default {
|
||||
|
||||
/**
|
||||
* CRUD 分组校验-新增
|
||||
*/
|
||||
interface Add extends CrudValidateGroup {}
|
||||
interface Add extends CrudValidationGroup {}
|
||||
|
||||
/**
|
||||
* CRUD 分组校验-修改
|
||||
*/
|
||||
interface Update extends CrudValidateGroup {}
|
||||
interface Update extends CrudValidationGroup {}
|
||||
}
|
Reference in New Issue
Block a user