mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-10-25 18:57:17 +08:00
fix(extension/crud): 修复新增响应结构 BaseIdResp 无法被继承问题
This commit is contained in:
@@ -42,27 +42,10 @@ public class BaseIdResp<T extends Serializable> implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseIdResp(final T id) {
|
public BaseIdResp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseIdResp(final T id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends Serializable> BaseIdRespBuilder<T> builder() {
|
|
||||||
return new BaseIdRespBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BaseIdRespBuilder<T extends Serializable> {
|
|
||||||
private T id;
|
|
||||||
|
|
||||||
BaseIdRespBuilder() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseIdRespBuilder<T> id(final T id) {
|
|
||||||
this.id = id;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseIdResp<T> build() {
|
|
||||||
return new BaseIdResp(this.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) {
|
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) {
|
||||||
this.checkPermission(Api.ADD);
|
this.checkPermission(Api.ADD);
|
||||||
return BaseIdResp.<Long>builder().id(baseService.add(req)).build();
|
return new BaseIdResp<>(baseService.add(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) {
|
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody C req) {
|
||||||
this.checkPermission(Api.ADD);
|
this.checkPermission(Api.ADD);
|
||||||
return BaseIdResp.<Long>builder().id(baseService.add(req)).build();
|
return new BaseIdResp<>(baseService.add(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user