处理请求列表空问题
This commit is contained in:
parent
06b5fc35da
commit
e15d9d810a
@ -3,6 +3,7 @@ package com.cm.common.result;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -216,4 +217,18 @@ public class SuccessResultLayImData<T> extends SuccessResult {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel
|
||||
public static class MemberData {
|
||||
@ApiModelProperty(name = "list", value = "组员列表")
|
||||
private List<User> list;
|
||||
|
||||
public List<User> getList() {
|
||||
return list == null ? new ArrayList<>() : list;
|
||||
}
|
||||
|
||||
public void setList(List<User> list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,9 @@ public class AnnotationUtil {
|
||||
}
|
||||
if (fieldValue instanceof List) {
|
||||
List fieldValueList = (List) fieldValue;
|
||||
if (fieldValueList.isEmpty()) {
|
||||
throw new ParamsException(String.format("%s不能为空", checkListAnnotation.name()));
|
||||
}
|
||||
for (Object obj : fieldValueList) {
|
||||
checkField(obj);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user