判断checkbox存在
This commit is contained in:
parent
017c320843
commit
64e94c8d1c
@ -101,6 +101,7 @@ public interface IDynamicDataService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改动态数据(链接)(APP)
|
* 修改动态数据(链接)(APP)
|
||||||
|
*
|
||||||
* @param token
|
* @param token
|
||||||
* @param tableName
|
* @param tableName
|
||||||
* @param joinKey
|
* @param joinKey
|
||||||
@ -120,6 +121,15 @@ public interface IDynamicDataService {
|
|||||||
*/
|
*/
|
||||||
List<Map<String, Object>> listDynamicData(String tableName, Map<String, Object> params);
|
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;
|
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.exception.*;
|
||||||
import com.cm.common.plugin.dao.dynamic.IDynamicDataDao;
|
import com.cm.common.plugin.dao.dynamic.IDynamicDataDao;
|
||||||
import com.cm.common.plugin.enums.dynamic.FieldRequireTypeEnum;
|
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.pojo.dtos.dynamic.DynamicFormDTO;
|
||||||
import com.cm.common.plugin.service.dynamic.IDynamicDataService;
|
import com.cm.common.plugin.service.dynamic.IDynamicDataService;
|
||||||
import com.cm.common.plugin.service.dynamic.IDynamicFormService;
|
import com.cm.common.plugin.service.dynamic.IDynamicFormService;
|
||||||
@ -165,6 +166,12 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
return listDynamicData;
|
return listDynamicData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> listDynamicDataDefault(String tableName, Map<String, Object> params) {
|
||||||
|
setSearchBaseListInfo(tableName, params);
|
||||||
|
return dynamicDataDao.listDynamicData(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<Map<String, Object>>> listPageDynamicData(String tableName, ListPage listPage) throws SearchException {
|
public SuccessResultList<List<Map<String, Object>>> listPageDynamicData(String tableName, ListPage listPage) throws SearchException {
|
||||||
setSearchBaseListInfo(tableName, listPage.getParams());
|
setSearchBaseListInfo(tableName, listPage.getParams());
|
||||||
@ -199,6 +206,13 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
return dynamicData;
|
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);
|
List<Map<String, Object>> listShowFieldList = dynamicFormService.listListShowField(dynamicFormDTOs);
|
||||||
params.put("listShowFieldList", listShowFieldList);
|
params.put("listShowFieldList", listShowFieldList);
|
||||||
|
if (isCheckboxExist(listShowFieldList)) {
|
||||||
|
params.put("isCheckboxExist", "exist");
|
||||||
|
}
|
||||||
// 联表字段列表
|
// 联表字段列表
|
||||||
List<Map<String, Object>> listJoinTableField = dynamicFormService.listJoinTableField(dynamicFormDTOs);
|
List<Map<String, Object>> listJoinTableField = dynamicFormService.listJoinTableField(dynamicFormDTOs);
|
||||||
if (!listJoinTableField.isEmpty()) {
|
if (!listJoinTableField.isEmpty()) {
|
||||||
@ -219,6 +236,23 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
|||||||
setSearchBaseInfo(tableName, params);
|
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));
|
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="">
|
<foreach collection="listShowFieldList" index="index" item="item" open="" separator="" close="">
|
||||||
t1.${item.fieldName},
|
t1.${item.fieldName},
|
||||||
<!-- 主表字典表字段 start -->
|
<!-- 主表字典表字段 start -->
|
||||||
<if test="item.fieldType == 'radio' or item.fieldType == 'checkbox' or item.fieldType == 'select'">
|
<if test="item.fieldType == 'radio' or item.fieldType == 'select'">
|
||||||
GROUP_CONCAT(dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name,
|
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>
|
</if>
|
||||||
<!-- 主表字典表字段 end -->
|
<!-- 主表字典表字段 end -->
|
||||||
</foreach>
|
</foreach>
|
||||||
@ -101,7 +104,15 @@
|
|||||||
${tableName} t1
|
${tableName} t1
|
||||||
<!-- 主表字典表 start -->
|
<!-- 主表字典表 start -->
|
||||||
<foreach collection="listShowFieldList" index="index" item="item" open="" separator="" close="">
|
<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
|
LEFT JOIN
|
||||||
data_dictionary dt${index + 1}
|
data_dictionary dt${index + 1}
|
||||||
ON
|
ON
|
||||||
@ -133,19 +144,21 @@
|
|||||||
<!-- 联表字段 end -->
|
<!-- 联表字段 end -->
|
||||||
WHERE
|
WHERE
|
||||||
t1.is_delete = 0
|
t1.is_delete = 0
|
||||||
|
<if test="isCheckboxExist != null and isCheckboxExist == 'exist'">
|
||||||
GROUP BY
|
GROUP BY
|
||||||
t1.${uuidField}
|
t1.${uuidField}
|
||||||
<foreach collection="listShowFieldList" item="item" open="," separator="," close="">
|
<foreach collection="listShowFieldList" item="item" open="," separator="," close="">
|
||||||
t1.${item.fieldName}
|
t1.${item.fieldName}
|
||||||
</foreach>
|
|
||||||
<if test="listJoinTableField != null and listJoinTableField.size > 0">
|
|
||||||
<foreach collection="listJoinTableField" index="index" item="item" open="" separator="" close="">
|
|
||||||
<if test="item.joinTableListShow != null and item.joinTableListShow.size > 0" >
|
|
||||||
<foreach collection="item.joinTableListShow" index="joinIndex" item="item" open="," separator="," close="">
|
|
||||||
jt${index + 1}.${item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="listJoinTableField != null and listJoinTableField.size > 0">
|
||||||
|
<foreach collection="listJoinTableField" index="index" item="item" open="" separator="" close="">
|
||||||
|
<if test="item.joinTableListShow != null and item.joinTableListShow.size > 0" >
|
||||||
|
<foreach collection="item.joinTableListShow" index="joinIndex" item="item" open="," separator="," close="">
|
||||||
|
jt${index + 1}.${item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user