From e15d9d810abc2a0b08101b88d070abcd023ac19d Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Wed, 20 Jan 2021 12:35:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AF=B7=E6=B1=82=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cm/common/result/SuccessResultLayImData.java | 15 +++++++++++++++ .../common/utils/annotation/AnnotationUtil.java | 3 +++ 2 files changed, 18 insertions(+) diff --git a/cloud-common/src/main/java/com/cm/common/result/SuccessResultLayImData.java b/cloud-common/src/main/java/com/cm/common/result/SuccessResultLayImData.java index 2e236de..a6fbc1e 100644 --- a/cloud-common/src/main/java/com/cm/common/result/SuccessResultLayImData.java +++ b/cloud-common/src/main/java/com/cm/common/result/SuccessResultLayImData.java @@ -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 extends SuccessResult { this.avatar = avatar; } } + + @ApiModel + public static class MemberData { + @ApiModelProperty(name = "list", value = "组员列表") + private List list; + + public List getList() { + return list == null ? new ArrayList<>() : list; + } + + public void setList(List list) { + this.list = list; + } + } } diff --git a/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java b/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java index 123fd7c..763d35d 100644 --- a/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java +++ b/cloud-common/src/main/java/com/cm/common/utils/annotation/AnnotationUtil.java @@ -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); }