refactor: 优化部分代码

修复 Sonar 扫描问题
This commit is contained in:
2024-01-27 14:33:15 +08:00
parent 9c0cd2fd9d
commit fe0bff3d3e
13 changed files with 56 additions and 44 deletions

View File

@@ -153,7 +153,7 @@ public abstract class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q,
@Parameter(name = "ids", description = "ID 列表", example = "1,2", in = ParameterIn.PATH)
@ResponseBody
@DeleteMapping("/{ids}")
public R delete(@PathVariable List<Long> ids) {
public R<Void> delete(@PathVariable List<Long> ids) {
this.checkPermission(Api.DELETE);
baseService.delete(ids);
return R.ok("删除成功");

View File

@@ -24,6 +24,9 @@ package top.charles7c.continew.starter.extension.crud.constant;
*/
public class ContainerPool {
private ContainerPool() {
}
/**
* 用户昵称
*/

View File

@@ -63,9 +63,9 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
private RequestMappingInfo getMappingForMethodWrapper(@NonNull Method method,
@NonNull Class<?> handlerType,
CrudRequestMapping crudRequestMapping) {
RequestMappingInfo info = this.createRequestMappingInfo(method);
RequestMappingInfo info = this.buildRequestMappingInfo(method);
if (null != info) {
RequestMappingInfo typeInfo = this.createRequestMappingInfo(handlerType);
RequestMappingInfo typeInfo = this.buildRequestMappingInfo(handlerType);
if (null != typeInfo) {
info = typeInfo.combine(info);
}
@@ -79,11 +79,11 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
return info;
}
private RequestMappingInfo createRequestMappingInfo(AnnotatedElement element) {
private RequestMappingInfo buildRequestMappingInfo(AnnotatedElement element) {
RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(element, RequestMapping.class);
RequestCondition<?> condition = (element instanceof Class<?> clazz
? getCustomTypeCondition(clazz)
: getCustomMethodCondition((Method)element));
return (requestMapping != null ? createRequestMappingInfo(requestMapping, condition) : null);
return (requestMapping != null ? super.createRequestMappingInfo(requestMapping, condition) : null);
}
}

View File

@@ -68,9 +68,6 @@ public class PageQuery extends SortQuery {
@Range(min = 1, max = 1000, message = "每页条数(取值范围 {min}-{max}")
private Integer size = DEFAULT_SIZE;
public PageQuery() {
}
/**
* 基于分页查询条件转换为 MyBatis Plus 分页条件
*