diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java index 3f5a217..9c7055a 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/IDynamicDataService.java @@ -101,6 +101,7 @@ public interface IDynamicDataService { /** * 修改动态数据(链接)(APP) + * * @param token * @param tableName * @param joinKey @@ -120,6 +121,15 @@ public interface IDynamicDataService { */ List> listDynamicData(String tableName, Map params); + /** + * 动态数据列表,默认 + * + * @param tableName + * @param params + * @return + */ + List> listDynamicDataDefault(String tableName, Map params); + /** * 分页动态数据列表 * @@ -151,4 +161,11 @@ public interface IDynamicDataService { */ Map getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException; + /** + * 设置表字段为驼峰式 + * + * @param listDynamicData + */ + void resetDynamicDataKey2LowerUpper(List> listDynamicData); + } diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java index 4b4aae0..c0fab4d 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicDataServiceImpl.java @@ -4,6 +4,7 @@ import com.cm.common.base.AbstractService; import com.cm.common.exception.*; import com.cm.common.plugin.dao.dynamic.IDynamicDataDao; import com.cm.common.plugin.enums.dynamic.FieldRequireTypeEnum; +import com.cm.common.plugin.enums.dynamic.FieldTypeEnum; import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormDTO; import com.cm.common.plugin.service.dynamic.IDynamicDataService; import com.cm.common.plugin.service.dynamic.IDynamicFormService; @@ -165,6 +166,12 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD return listDynamicData; } + @Override + public List> listDynamicDataDefault(String tableName, Map params) { + setSearchBaseListInfo(tableName, params); + return dynamicDataDao.listDynamicData(params); + } + @Override public SuccessResultList>> listPageDynamicData(String tableName, ListPage listPage) throws SearchException { setSearchBaseListInfo(tableName, listPage.getParams()); @@ -199,6 +206,13 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD return dynamicData; } + @Override + public void resetDynamicDataKey2LowerUpper(List> listDynamicData) { + for (Map dynamicData : listDynamicData) { + resetDynamicDataKey2LowerUpper(dynamicData); + } + } + /** * 设置查询列表基础信息 * @@ -210,6 +224,9 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD // 列表显示字段 List> listShowFieldList = dynamicFormService.listListShowField(dynamicFormDTOs); params.put("listShowFieldList", listShowFieldList); + if (isCheckboxExist(listShowFieldList)) { + params.put("isCheckboxExist", "exist"); + } // 联表字段列表 List> listJoinTableField = dynamicFormService.listJoinTableField(dynamicFormDTOs); if (!listJoinTableField.isEmpty()) { @@ -219,6 +236,23 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD setSearchBaseInfo(tableName, params); } + /** + * checkbox是否存在 + * + * @param listShowFieldList + * @return + */ + private boolean isCheckboxExist(List> listShowFieldList) { + boolean isCheckboxExist = false; + for (Map showFieldList : listShowFieldList) { + if (StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), showFieldList.get("fieldType").toString())) { + isCheckboxExist = true; + break; + } + } + return isCheckboxExist; + } + /** * 设置查询详情基础信息 * @@ -255,17 +289,6 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD params.put("uuidField", String.format("%s_id", lowerUnderLineTableName)); } - /** - * 设置表字段为驼峰式 - * - * @param listDynamicData - */ - private void resetDynamicDataKey2LowerUpper(List> listDynamicData) { - for (Map dynamicData : listDynamicData) { - resetDynamicDataKey2LowerUpper(dynamicData); - } - } - /** * 设置表字段为驼峰式 * 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 2e80e6c..020aa15 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 @@ -80,8 +80,11 @@ t1.${item.fieldName}, - - GROUP_CONCAT(dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name, + + dt${index + 1}.dictionary_name ${item.fieldName}_dictionary_name, + + + GROUP_CONCAT(DISTINCT dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name, @@ -101,7 +104,15 @@ ${tableName} t1 - + + LEFT JOIN + data_dictionary dt${index + 1} + ON + dt${index + 1}.dictionary_id = t1.${item.fieldName} + AND + dt${index + 1}.is_delete = 0 + + LEFT JOIN data_dictionary dt${index + 1} ON @@ -133,19 +144,21 @@ WHERE t1.is_delete = 0 + GROUP BY t1.${uuidField} - + t1.${item.fieldName} - - - - - - jt${index + 1}.${item} - - + + + + + jt${index + 1}.${item} + + + +