From 81630a096f9c46b20138c609770575e5491bd623 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 13 Feb 2022 21:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=9D=E7=95=99=E5=BF=85=E5=A1=AB/=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/constant/GenConstants.java | 3 +++ .../ruoyi/generator/service/GenTableServiceImpl.java | 11 ++++++++++- .../main/java/com/ruoyi/generator/util/GenUtils.java | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java index 1d5d884..e7382b3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -109,6 +109,9 @@ public class GenConstants /** 模糊查询 */ public static final String QUERY_LIKE = "LIKE"; + /** 相等查询 */ + public static final String QUERY_EQ = "EQ"; + /** 需要 */ public static final String REQUIRE = "1"; } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 68bba7b..71f2f8a 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -304,8 +304,17 @@ public class GenTableServiceImpl implements IGenTableService column.setColumnId(prevColumn.getColumnId()); if (column.isList()) { - // 如果是列表,继续保留字典类型 + // 如果是列表,继续保留查询方式/字典类型选项 column.setDictType(prevColumn.getDictType()); + column.setQueryType(prevColumn.getQueryType()); + } + if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() + && (column.isInsert() || column.isEdit()) + && ((column.isUsableColumn()) || (!column.isSuperColumn()))) + { + // 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项 + column.setIsRequired(prevColumn.getIsRequired()); + column.setHtmlType(prevColumn.getHtmlType()); } genTableColumnMapper.updateGenTableColumn(column); } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index c3ccdae..e28c0bb 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -42,6 +42,7 @@ public class GenUtils column.setJavaField(StringUtils.toCamelCase(columnName)); // 设置默认类型 column.setJavaType(GenConstants.TYPE_STRING); + column.setQueryType(GenConstants.QUERY_EQ); if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {