判断checkbox存在
This commit is contained in:
parent
017c320843
commit
64e94c8d1c
@ -101,6 +101,7 @@ public interface IDynamicDataService {
|
||||
|
||||
/**
|
||||
* 修改动态数据(链接)(APP)
|
||||
*
|
||||
* @param token
|
||||
* @param tableName
|
||||
* @param joinKey
|
||||
@ -120,6 +121,15 @@ public interface IDynamicDataService {
|
||||
*/
|
||||
List<Map<String, Object>> listDynamicData(String tableName, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 动态数据列表,默认
|
||||
*
|
||||
* @param tableName
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listDynamicDataDefault(String tableName, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 分页动态数据列表
|
||||
*
|
||||
@ -151,4 +161,11 @@ public interface IDynamicDataService {
|
||||
*/
|
||||
Map<String, Object> getDynamicJoinData(String tableName, String joinKey, String joinId) throws SearchException;
|
||||
|
||||
/**
|
||||
* 设置表字段为驼峰式
|
||||
*
|
||||
* @param listDynamicData
|
||||
*/
|
||||
void resetDynamicDataKey2LowerUpper(List<Map<String, Object>> listDynamicData);
|
||||
|
||||
}
|
||||
|
@ -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<Map<String, Object>> listDynamicDataDefault(String tableName, Map<String, Object> params) {
|
||||
setSearchBaseListInfo(tableName, params);
|
||||
return dynamicDataDao.listDynamicData(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<Map<String, Object>>> 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<Map<String, Object>> listDynamicData) {
|
||||
for (Map<String, Object> dynamicData : listDynamicData) {
|
||||
resetDynamicDataKey2LowerUpper(dynamicData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置查询列表基础信息
|
||||
*
|
||||
@ -210,6 +224,9 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
||||
// 列表显示字段
|
||||
List<Map<String, Object>> listShowFieldList = dynamicFormService.listListShowField(dynamicFormDTOs);
|
||||
params.put("listShowFieldList", listShowFieldList);
|
||||
if (isCheckboxExist(listShowFieldList)) {
|
||||
params.put("isCheckboxExist", "exist");
|
||||
}
|
||||
// 联表字段列表
|
||||
List<Map<String, Object>> 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<Map<String, Object>> listShowFieldList) {
|
||||
boolean isCheckboxExist = false;
|
||||
for (Map<String, Object> 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<Map<String, Object>> listDynamicData) {
|
||||
for (Map<String, Object> dynamicData : listDynamicData) {
|
||||
resetDynamicDataKey2LowerUpper(dynamicData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置表字段为驼峰式
|
||||
*
|
||||
|
@ -80,8 +80,11 @@
|
||||
<foreach collection="listShowFieldList" index="index" item="item" open="" separator="" close="">
|
||||
t1.${item.fieldName},
|
||||
<!-- 主表字典表字段 start -->
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'checkbox' or item.fieldType == 'select'">
|
||||
GROUP_CONCAT(dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name,
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'select'">
|
||||
dt${index + 1}.dictionary_name ${item.fieldName}_dictionary_name,
|
||||
</if>
|
||||
<if test="item.fieldType == 'checkbox'">
|
||||
GROUP_CONCAT(DISTINCT dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name,
|
||||
</if>
|
||||
<!-- 主表字典表字段 end -->
|
||||
</foreach>
|
||||
@ -101,7 +104,15 @@
|
||||
${tableName} t1
|
||||
<!-- 主表字典表 start -->
|
||||
<foreach collection="listShowFieldList" index="index" item="item" open="" separator="" close="">
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'checkbox' or item.fieldType == 'select'">
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'select'">
|
||||
LEFT JOIN
|
||||
data_dictionary dt${index + 1}
|
||||
ON
|
||||
dt${index + 1}.dictionary_id = t1.${item.fieldName}
|
||||
AND
|
||||
dt${index + 1}.is_delete = 0
|
||||
</if>
|
||||
<if test="item.fieldType == 'checkbox'">
|
||||
LEFT JOIN
|
||||
data_dictionary dt${index + 1}
|
||||
ON
|
||||
@ -133,6 +144,7 @@
|
||||
<!-- 联表字段 end -->
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="isCheckboxExist != null and isCheckboxExist == 'exist'">
|
||||
GROUP BY
|
||||
t1.${uuidField}
|
||||
<foreach collection="listShowFieldList" item="item" open="," separator="," close="">
|
||||
@ -147,6 +159,7 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 动态数据详情 -->
|
||||
|
Loading…
Reference in New Issue
Block a user