diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/config/impl/DynamicConfigTableServiceImpl.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/config/impl/DynamicConfigTableServiceImpl.java index c3f0b98..a4017b6 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/config/impl/DynamicConfigTableServiceImpl.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/config/impl/DynamicConfigTableServiceImpl.java @@ -195,6 +195,9 @@ public class DynamicConfigTableServiceImpl extends AbstractService implements ID if (StringUtils.equals(FieldTypeEnum.RADIO.getValue(), dynamicConfigFormDTO.getFieldType()) || StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), dynamicConfigFormDTO.getFieldType()) || StringUtils.equals(FieldTypeEnum.SELECT.getValue(), dynamicConfigFormDTO.getFieldType())) { + if (StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), dynamicConfigFormDTO.getFieldType())) { + templateMap.put("isCheckboxExist", "exist"); + } field.put("dictionaryIndex", ++dictionaryIndex); } else if (StringUtils.equals(FieldTypeEnum.INNER_JOIN.getValue(), dynamicConfigFormDTO.getFieldType()) || StringUtils.equals(FieldTypeEnum.LEFT_JOIN.getValue(), dynamicConfigFormDTO.getFieldType()) diff --git a/cloud-common-plugin-dynamic/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml b/cloud-common-plugin-dynamic/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml index 020aa15..90976aa 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml +++ b/cloud-common-plugin-dynamic/src/main/resources/mybatis/mapper/dynamic/dynamicdata-mapper.xml @@ -147,7 +147,10 @@ GROUP BY t1.${uuidField} - + + + dt${index + 1}.dictionary_name, + t1.${item.fieldName} diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/mapper/mapper.ftl b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/mapper/mapper.ftl index d5c510a..d3e01bd 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/mapper/mapper.ftl +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/mapper/mapper.ftl @@ -122,8 +122,11 @@ <#if field.listShow == 1> t1.${field.underLineFieldName}, <#-- 字典 start --> - <#if field.fieldType == "radio" || field.fieldType == "checkbox" || field.fieldType == "select"> + <#if field.fieldType == "radio" || field.fieldType == "select"> dt${field.dictionaryIndex}.dictionary_name ${field.underLineFieldName}_dictionary_name, + + <#if field.fieldType == "checkbox"> + GROUP_CONCAT(DISTINCT dt${field.dictionaryIndex}.dictionary_name) ${field.underLineFieldName}_dictionary_name, <#-- 字典 end --> @@ -142,7 +145,14 @@ ${tablePrefix}${underLineTableName} t1 <#list fieldList! as field> <#if field.listShow == 1> - <#if field.fieldType == "radio" || field.fieldType == "checkbox" || field.fieldType == "select"> + <#if field.fieldType == "radio" || field.fieldType == "select"> + LEFT JOIN + data_dictionary dt${field.dictionaryIndex} + ON + dt${field.dictionaryIndex}.dictionary_id = t1.${field.underLineFieldName} + AND + dt${field.dictionaryIndex}.is_delete = 0 + <#if field.fieldType == "checkbox"> LEFT JOIN data_dictionary dt${field.dictionaryIndex} ON @@ -193,6 +203,27 @@ ${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"} + <#if isCheckboxExist == 'exist'> + GROUP BY + <#list fieldList! as field> + <#if field.listShow == 1> + t1.${field.underLineFieldName}, + <#if field.fieldType == "radio" || field.fieldType == "select"> + dt${field.dictionaryIndex}.dictionary_name, + + + <#-- 联表 start --> + <#if field.fieldType == "innerJoin" || field.fieldType == "leftJoin" || field.fieldType == "rightJoin"> + <#list field.listJoinTableField! as joinTableField> + <#if joinTableField.listShow == 1> + jt${field.joinTableIndex}.${joinTableField.underLineFieldName}, + + + + <#-- 联表 end --> + + t1.${underLineTableName}_id + diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/route/list.ftl b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/route/list.ftl index 5211a5b..7c88572 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/route/list.ftl +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/route/list.ftl @@ -108,9 +108,9 @@ } return downloadFile; <#elseif field.fieldType == "date"> - return common.formatDate('yyyy-MM-dd', new Date(rowData)); + return rowData; <#elseif field.fieldType == "datetime"> - return common.formatDate('yyyy-MM-dd hh:mm:ss', new Date(rowData)); + return rowData; <#elseif field.fieldType == "selectUser"> var selectArray = rowData.split(','); var value = '';