diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java b/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java index cfc8f11c..6fe425af 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java @@ -17,6 +17,7 @@ public class ResultCommon { public static final String EMPTY_STANDARD_NAME = "message.empty.standard.name"; // 标准名称不能为空 public static final String EMPTY_COMMON = "message.empty.common"; // {0}不能为空 public static final String EXIST_STANDARD_NUMBER = "message.exists.standard.number"; // 标准编号已经存在 + public static final String NOT_EXIST_PARAM = "message.no.exists.param"; // 参数{0}不存在 public static final String RMR_SET_QUALITY_OVER_TEN = "es.rmr.setQuality.overTen"; // 请最多选择10条 diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index f23e2529..34e8ad6e 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -899,8 +899,12 @@ public class LawsCommonServiceImpl implements ILawsCommonService { String orderByField = (String) parameterMap.get(FieldCommon.ORDER_BY_FIELD); if (StringUtils.isNotBlank(orderByField)) { // 排序字段的类型 - String fieldShowType = fieldList.stream().filter(lawsTag -> orderByField - .equals(lawsTag.getDbFieldName())).collect(Collectors.toList()).get(0).getFieldShowType(); + List lawsTagList = fieldList.stream().filter(lawsTag -> orderByField + .equals(lawsTag.getDbFieldName())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(lawsTagList)) { + throw new JeroBootException(ResultCommon.NOT_EXIST_PARAM, orderByField); + } + String fieldShowType = lawsTagList.get(0).getFieldShowType(); if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(fieldShowType)) { // 多日期的排序逻辑不一样 orderBySortDateMany(parameterMap, selectCondition); diff --git a/laws-single-startup/src/main/resources/i18n/messages.properties b/laws-single-startup/src/main/resources/i18n/messages.properties index b7381d38..61a99b84 100644 --- a/laws-single-startup/src/main/resources/i18n/messages.properties +++ b/laws-single-startup/src/main/resources/i18n/messages.properties @@ -13,6 +13,7 @@ message.empty.common=The {0} cannot be empty message.empty.standard.number=The standard number cannot be empty message.empty.standard.name=The standard name cannot be empty message.exists.standard.number=standard number already exists +message.no.exists.param=param {0} not exists successfully.cleared=successfully cleared successfully.deleted.in.bulk=successfully deleted in bulk diff --git a/laws-single-startup/src/main/resources/i18n/messages_en.properties b/laws-single-startup/src/main/resources/i18n/messages_en.properties index e0804f9c..f0577f88 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_en.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_en.properties @@ -12,6 +12,7 @@ message.empty.common=The {0} cannot be empty message.empty.standard.number=The standard number cannot be empty message.empty.standard.name=The standard name cannot be empty message.exists.standard.number=standard number already exists +message.no.exists.param=param {0} not exists es.rmr.setQuality.overTen=Please select up to 10 diff --git a/laws-single-startup/src/main/resources/i18n/messages_zh.properties b/laws-single-startup/src/main/resources/i18n/messages_zh.properties index d6bb3e5a..cc185b00 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_zh.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_zh.properties @@ -13,6 +13,7 @@ message.empty.common={0}\u4E0D\u80FD\u4E3A\u7A7A message.empty.standard.number=\u6807\u51C6\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A message.empty.standard.name=\u6807\u51C6\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A message.exists.standard.number=标准编号已经存在 +message.no.exists.param=参数{0}不存在 successfully.cleared=\u6E05\u9664\u6210\u529F successfully.deleted.in.bulk=\u6279\u91CF\u5220\u9664\u6210\u529F