Commit 81630a096f9c46b20138c609770575e5491bd623
1 parent
21780d81
代码生成同步保留必填/类型选项
Showing
3 changed files
with
14 additions
and
1 deletions
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
... | ... | @@ -304,8 +304,17 @@ public class GenTableServiceImpl implements IGenTableService |
304 | 304 | column.setColumnId(prevColumn.getColumnId()); |
305 | 305 | if (column.isList()) |
306 | 306 | { |
307 | - // 如果是列表,继续保留字典类型 | |
307 | + // 如果是列表,继续保留查询方式/字典类型选项 | |
308 | 308 | column.setDictType(prevColumn.getDictType()); |
309 | + column.setQueryType(prevColumn.getQueryType()); | |
310 | + } | |
311 | + if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() | |
312 | + && (column.isInsert() || column.isEdit()) | |
313 | + && ((column.isUsableColumn()) || (!column.isSuperColumn()))) | |
314 | + { | |
315 | + // 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项 | |
316 | + column.setIsRequired(prevColumn.getIsRequired()); | |
317 | + column.setHtmlType(prevColumn.getHtmlType()); | |
309 | 318 | } |
310 | 319 | genTableColumnMapper.updateGenTableColumn(column); |
311 | 320 | } |
... | ... |
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
... | ... | @@ -42,6 +42,7 @@ public class GenUtils |
42 | 42 | column.setJavaField(StringUtils.toCamelCase(columnName)); |
43 | 43 | // 设置默认类型 |
44 | 44 | column.setJavaType(GenConstants.TYPE_STRING); |
45 | + column.setQueryType(GenConstants.QUERY_EQ); | |
45 | 46 | |
46 | 47 | if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) |
47 | 48 | { |
... | ... |