新增动态表单列表的联表(left,inner,right)功能
This commit is contained in:
parent
00c2aad58c
commit
39ba55149e
@ -41,9 +41,9 @@ public interface IDynamicFormDao {
|
||||
/**
|
||||
* 动态表单详情
|
||||
*
|
||||
* @param tableName
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<DynamicFormDTO> listDynamicForm(String tableName) throws SearchException;
|
||||
List<DynamicFormDTO> listDynamicForm(Map<String, Object> params) throws SearchException;
|
||||
}
|
||||
|
@ -67,7 +67,19 @@ public enum FieldTypeEnum {
|
||||
/**
|
||||
* 外联
|
||||
*/
|
||||
JOIN("join");
|
||||
JOIN("join"),
|
||||
/**
|
||||
* 内联
|
||||
*/
|
||||
INNER_JOIN("innerJoin"),
|
||||
/**
|
||||
* 左联
|
||||
*/
|
||||
LEFT_JOIN("leftJoin"),
|
||||
/**
|
||||
* 右联
|
||||
*/
|
||||
RIGHT_JOIN("rightJoin");
|
||||
|
||||
private String value;
|
||||
|
||||
|
@ -40,6 +40,16 @@ public class DynamicFormDTO {
|
||||
private Integer listShow;
|
||||
@ApiModelProperty(name = "formShow", value = "表单显示")
|
||||
private Integer formShow;
|
||||
@ApiModelProperty(name = "joinTable", value = "联表")
|
||||
private String joinTable;
|
||||
@ApiModelProperty(name = "joinTableField", value = "联表字段")
|
||||
private String joinTableField;
|
||||
@ApiModelProperty(name = "joinTableSort", value = "联表顺序")
|
||||
private Integer joinTableSort;
|
||||
@ApiModelProperty(name = "joinTableListShow", value = "联表列表显示")
|
||||
private String joinTableListShow;
|
||||
@ApiModelProperty(name = "joinTableFormShow", value = "联表表单显示")
|
||||
private String joinTableFormShow;
|
||||
|
||||
public String getId() {
|
||||
return id == null ? "" : id;
|
||||
@ -137,34 +147,83 @@ public class DynamicFormDTO {
|
||||
this.formShow = formShow;
|
||||
}
|
||||
|
||||
public String getJoinTable() {
|
||||
return joinTable == null ? "" : joinTable.trim();
|
||||
}
|
||||
|
||||
public void setJoinTable(String joinTable) {
|
||||
this.joinTable = joinTable;
|
||||
}
|
||||
|
||||
public String getJoinTableField() {
|
||||
return joinTableField == null ? "" : joinTableField.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableField(String joinTableField) {
|
||||
this.joinTableField = joinTableField;
|
||||
}
|
||||
|
||||
public Integer getJoinTableSort() {
|
||||
return joinTableSort;
|
||||
}
|
||||
|
||||
public void setJoinTableSort(Integer joinTableSort) {
|
||||
this.joinTableSort = joinTableSort;
|
||||
}
|
||||
|
||||
public String getJoinTableListShow() {
|
||||
return joinTableListShow == null ? "" : joinTableListShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableListShow(String joinTableListShow) {
|
||||
this.joinTableListShow = joinTableListShow;
|
||||
}
|
||||
|
||||
public String getJoinTableFormShow() {
|
||||
return joinTableFormShow == null ? "" : joinTableFormShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableFormShow(String joinTableFormShow) {
|
||||
this.joinTableFormShow = joinTableFormShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"id\":\"")
|
||||
.append(id).append('\"');
|
||||
sb.append(",\"tableName\":\"")
|
||||
.append(tableName).append('\"');
|
||||
sb.append(",\"fieldName\":\"")
|
||||
.append(fieldName).append('\"');
|
||||
sb.append(",\"fieldExplain\":\"")
|
||||
.append(fieldExplain).append('\"');
|
||||
sb.append(",\"fieldType\":\"")
|
||||
.append(fieldType).append('\"');
|
||||
sb.append(",\"fieldDefault\":\"")
|
||||
.append(fieldDefault).append('\"');
|
||||
sb.append(",\"dictionaryId\":\"")
|
||||
.append(dictionaryId).append('\"');
|
||||
sb.append(",\"verifyType\":\"")
|
||||
.append(verifyType).append('\"');
|
||||
sb.append(",\"verifyRegular\":\"")
|
||||
.append(verifyRegular).append('\"');
|
||||
sb.append("\"id\":")
|
||||
.append("\"").append(id).append("\"");
|
||||
sb.append(",\"tableName\":")
|
||||
.append("\"").append(tableName).append("\"");
|
||||
sb.append(",\"fieldName\":")
|
||||
.append("\"").append(fieldName).append("\"");
|
||||
sb.append(",\"fieldExplain\":")
|
||||
.append("\"").append(fieldExplain).append("\"");
|
||||
sb.append(",\"fieldType\":")
|
||||
.append("\"").append(fieldType).append("\"");
|
||||
sb.append(",\"fieldDefault\":")
|
||||
.append("\"").append(fieldDefault).append("\"");
|
||||
sb.append(",\"dictionaryId\":")
|
||||
.append("\"").append(dictionaryId).append("\"");
|
||||
sb.append(",\"verifyType\":")
|
||||
.append("\"").append(verifyType).append("\"");
|
||||
sb.append(",\"verifyRegular\":")
|
||||
.append("\"").append(verifyRegular).append("\"");
|
||||
sb.append(",\"fieldSort\":")
|
||||
.append(fieldSort);
|
||||
sb.append(",\"listShow\":")
|
||||
.append(listShow);
|
||||
sb.append(",\"formShow\":")
|
||||
.append(formShow);
|
||||
sb.append(",\"joinTable\":")
|
||||
.append("\"").append(joinTable).append("\"");
|
||||
sb.append(",\"joinTableField\":")
|
||||
.append("\"").append(joinTableField).append("\"");
|
||||
sb.append(",\"joinTableSort\":")
|
||||
.append(joinTableSort);
|
||||
sb.append(",\"joinTableListShow\":")
|
||||
.append("\"").append(joinTableListShow).append("\"");
|
||||
sb.append(",\"joinTableFormShow\":")
|
||||
.append("\"").append(joinTableFormShow).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -44,6 +44,16 @@ public class DynamicConfigFormDTO {
|
||||
private Integer listShow;
|
||||
@ApiModelProperty(name = "formShow", value = "表单显示")
|
||||
private Integer formShow;
|
||||
@ApiModelProperty(name = "joinTable", value = "连接表")
|
||||
private String joinTable;
|
||||
@ApiModelProperty(name = "joinTableField", value = "连表字段")
|
||||
private String joinTableField;
|
||||
@ApiModelProperty(name = "joinTableSort", value = "连表顺序")
|
||||
private Integer joinTableSort;
|
||||
@ApiModelProperty(name = "joinTableListShow", value = "连表列表显示")
|
||||
private String joinTableListShow;
|
||||
@ApiModelProperty(name = "joinTableFormShow", value = "连表表单显示")
|
||||
private String joinTableFormShow;
|
||||
|
||||
public String getId() {
|
||||
return id == null ? "" : id.trim();
|
||||
@ -149,6 +159,46 @@ public class DynamicConfigFormDTO {
|
||||
this.formShow = formShow;
|
||||
}
|
||||
|
||||
public String getJoinTable() {
|
||||
return joinTable == null ? "" : joinTable.trim();
|
||||
}
|
||||
|
||||
public void setJoinTable(String joinTable) {
|
||||
this.joinTable = joinTable;
|
||||
}
|
||||
|
||||
public String getJoinTableField() {
|
||||
return joinTableField == null ? "" : joinTableField.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableField(String joinTableField) {
|
||||
this.joinTableField = joinTableField;
|
||||
}
|
||||
|
||||
public Integer getJoinTableSort() {
|
||||
return joinTableSort;
|
||||
}
|
||||
|
||||
public void setJoinTableSort(Integer joinTableSort) {
|
||||
this.joinTableSort = joinTableSort;
|
||||
}
|
||||
|
||||
public String getJoinTableListShow() {
|
||||
return joinTableListShow == null ? "" : joinTableListShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableListShow(String joinTableListShow) {
|
||||
this.joinTableListShow = joinTableListShow;
|
||||
}
|
||||
|
||||
public String getJoinTableFormShow() {
|
||||
return joinTableFormShow == null ? "" : joinTableFormShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableFormShow(String joinTableFormShow) {
|
||||
this.joinTableFormShow = joinTableFormShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -178,6 +228,16 @@ public class DynamicConfigFormDTO {
|
||||
.append(listShow);
|
||||
sb.append(",\"formShow\":")
|
||||
.append(formShow);
|
||||
sb.append(",\"joinTable\":")
|
||||
.append("\"").append(joinTable).append("\"");
|
||||
sb.append(",\"joinTableField\":")
|
||||
.append("\"").append(joinTableField).append("\"");
|
||||
sb.append(",\"joinTableSort\":")
|
||||
.append(joinTableSort);
|
||||
sb.append(",\"joinTableListShow\":")
|
||||
.append("\"").append(joinTableListShow).append("\"");
|
||||
sb.append(",\"joinTableFormShow\":")
|
||||
.append("\"").append(joinTableFormShow).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -28,7 +28,11 @@ public class DynamicConfigFormVO {
|
||||
@CheckEmptyAnnotation(name = "字段说明")
|
||||
private String fieldExplain;
|
||||
@ApiModelProperty(name = "fieldType", value = "字段类型")
|
||||
@CheckEmptyAnnotation(name = "字段类型", types = {"string", "datetime", "date", "number", "double", "textarea", "richText", "select", "checkbox", "radio", "selectUser", "selectDepartment", "file", "join"})
|
||||
@CheckEmptyAnnotation(name = "字段类型", types = {
|
||||
"string", "datetime", "date", "number", "double", "textarea", "richText",
|
||||
"select", "checkbox", "radio", "selectUser", "selectDepartment", "file",
|
||||
"join", "currentUser", "currentDepartment", "currentRole", "currentGroup", "currentPosition",
|
||||
"leftJoin", "innerJoin", "rightJoin"})
|
||||
private String fieldType;
|
||||
@ApiModelProperty(name = "fieldDefault", value = "字段默认值")
|
||||
private String fieldDefault;
|
||||
@ -47,6 +51,16 @@ public class DynamicConfigFormVO {
|
||||
@ApiModelProperty(name = "formShow", value = "表单显示")
|
||||
@CheckNumberAnnotation(name = "表单显示", types = {"0", "1"})
|
||||
private Integer formShow;
|
||||
@ApiModelProperty(name = "joinTable", value = "连接表")
|
||||
private String joinTable;
|
||||
@ApiModelProperty(name = "joinTableField", value = "连表字段")
|
||||
private String joinTableField;
|
||||
@ApiModelProperty(name = "joinTableSort", value = "连表顺序")
|
||||
private Integer joinTableSort;
|
||||
@ApiModelProperty(name = "joinTableListShow", value = "连表列表显示")
|
||||
private String joinTableListShow;
|
||||
@ApiModelProperty(name = "joinTableFormShow", value = "连表表单显示")
|
||||
private String joinTableFormShow;
|
||||
|
||||
public String getTableName() {
|
||||
return tableName == null ? "" : tableName.trim();
|
||||
@ -136,6 +150,46 @@ public class DynamicConfigFormVO {
|
||||
this.formShow = formShow;
|
||||
}
|
||||
|
||||
public String getJoinTable() {
|
||||
return joinTable == null ? "" : joinTable.trim();
|
||||
}
|
||||
|
||||
public void setJoinTable(String joinTable) {
|
||||
this.joinTable = joinTable;
|
||||
}
|
||||
|
||||
public String getJoinTableField() {
|
||||
return joinTableField == null ? "" : joinTableField.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableField(String joinTableField) {
|
||||
this.joinTableField = joinTableField;
|
||||
}
|
||||
|
||||
public Integer getJoinTableSort() {
|
||||
return joinTableSort;
|
||||
}
|
||||
|
||||
public void setJoinTableSort(Integer joinTableSort) {
|
||||
this.joinTableSort = joinTableSort;
|
||||
}
|
||||
|
||||
public String getJoinTableListShow() {
|
||||
return joinTableListShow == null ? "" : joinTableListShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableListShow(String joinTableListShow) {
|
||||
this.joinTableListShow = joinTableListShow;
|
||||
}
|
||||
|
||||
public String getJoinTableFormShow() {
|
||||
return joinTableFormShow == null ? "" : joinTableFormShow.trim();
|
||||
}
|
||||
|
||||
public void setJoinTableFormShow(String joinTableFormShow) {
|
||||
this.joinTableFormShow = joinTableFormShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -161,6 +215,16 @@ public class DynamicConfigFormVO {
|
||||
.append(listShow);
|
||||
sb.append(",\"formShow\":")
|
||||
.append(formShow);
|
||||
sb.append(",\"joinTable\":")
|
||||
.append("\"").append(joinTable).append("\"");
|
||||
sb.append(",\"joinTableField\":")
|
||||
.append("\"").append(joinTableField).append("\"");
|
||||
sb.append(",\"joinTableSort\":")
|
||||
.append(joinTableSort);
|
||||
sb.append(",\"joinTableListShow\":")
|
||||
.append("\"").append(joinTableListShow).append("\"");
|
||||
sb.append(",\"joinTableFormShow\":")
|
||||
.append("\"").append(joinTableFormShow).append("\"");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -57,6 +57,15 @@ public interface IDynamicFormService {
|
||||
*/
|
||||
List<Map<String, Object>> listListShowField(String tableName) throws SearchException;
|
||||
|
||||
/**
|
||||
* 获取列表显示的字段
|
||||
*
|
||||
* @param dynamicFormDTOs
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<Map<String, Object>> listListShowField(List<DynamicFormDTO> dynamicFormDTOs) throws SearchException;
|
||||
|
||||
/**
|
||||
* 获取表单显示的字段
|
||||
*
|
||||
@ -86,4 +95,12 @@ public interface IDynamicFormService {
|
||||
*/
|
||||
List<DynamicFormFormShowFieldDTO> listFormShowFieldOfPage(String tableName) throws SearchException;
|
||||
|
||||
/**
|
||||
* 连表字段列表
|
||||
*
|
||||
* @param dynamicFormDTOs
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<Map<String, Object>> listJoinTableField(List<DynamicFormDTO> dynamicFormDTOs) throws SearchException;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.cm.common.plugin.service.dynamic.IDynamicTableService;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.RegexUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.common.utils.WStringUtil;
|
||||
@ -156,7 +157,7 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
||||
params.put("joinId", joinId);
|
||||
Map<String, Object> dynamicData = dynamicDataDao.getDynamicJoinData(params);
|
||||
if (Objects.isNull(dynamicData)) {
|
||||
dynamicData = new HashMap<>();
|
||||
dynamicData = getHashMap(0);
|
||||
}
|
||||
resetDynamicDataKey2LowerUpper(dynamicData);
|
||||
return dynamicData;
|
||||
@ -169,8 +170,16 @@ public class DynamicDataServiceImpl extends AbstractService implements IDynamicD
|
||||
* @param params
|
||||
*/
|
||||
private void setSearchBaseListInfo(String tableName, Map<String, Object> params) {
|
||||
List<Map<String, Object>> listShowFieldList = dynamicFormService.listListShowField(tableName);
|
||||
List<DynamicFormDTO> dynamicFormDTOs = dynamicFormService.listDynamicForm(tableName);
|
||||
// 列表显示字段
|
||||
List<Map<String, Object>> listShowFieldList = dynamicFormService.listListShowField(dynamicFormDTOs);
|
||||
params.put("listShowFieldList", listShowFieldList);
|
||||
// 联表字段列表
|
||||
List<Map<String, Object>> listJoinTableField = dynamicFormService.listJoinTableField(dynamicFormDTOs);
|
||||
if (!listJoinTableField.isEmpty()) {
|
||||
HashMapUtil.bubbleSort(listJoinTableField, "joinTableSort", true, true);
|
||||
params.put("listJoinTableField", listJoinTableField);
|
||||
}
|
||||
setSearchBaseInfo(tableName, params);
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,9 @@ import com.cm.common.utils.WStringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.tools.jconsole.JConsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -56,12 +54,19 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
||||
|
||||
@Override
|
||||
public List<DynamicFormDTO> listDynamicForm(String tableName) throws SearchException {
|
||||
return dynamicFormDao.listDynamicForm(tableName);
|
||||
Map<String, Object> params = getHashMap(1);
|
||||
params.put("tableName", tableName);
|
||||
return dynamicFormDao.listDynamicForm(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listListShowField(String tableName) throws SearchException {
|
||||
List<DynamicFormDTO> dynamicFormDTOs = listDynamicForm(tableName);
|
||||
return listListShowField(dynamicFormDTOs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listListShowField(List<DynamicFormDTO> dynamicFormDTOs) throws SearchException {
|
||||
List<Map<String, Object>> listShowField = new ArrayList<>();
|
||||
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
||||
if (dynamicFormDTO.getListShow() == 1) {
|
||||
@ -90,13 +95,15 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
||||
public List<DynamicFormListShowFieldDTO> listListShowFieldOfPage(String tableName) throws SearchException {
|
||||
List<DynamicFormDTO> dynamicFormDTOs = listDynamicForm(tableName);
|
||||
List<DynamicFormListShowFieldDTO> dynamicFormListShowFieldDTOList = new ArrayList<>();
|
||||
Integer joinIndex = 0;
|
||||
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
||||
// 显示字段
|
||||
if (dynamicFormDTO.getListShow() == 1) {
|
||||
DynamicFormListShowFieldDTO dynamicFormListShowFieldDTO = new DynamicFormListShowFieldDTO();
|
||||
dynamicFormListShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName());
|
||||
dynamicFormListShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain());
|
||||
dynamicFormListShowFieldDTO.setFieldType(dynamicFormDTO.getFieldType());
|
||||
dynamicFormListShowFieldDTOList.add(dynamicFormListShowFieldDTO);
|
||||
dynamicFormListShowFieldDTOList.add(getDynamicFormListShowFieldDTOByDynamicFormDTO(dynamicFormDTO));
|
||||
}
|
||||
// 联表字段
|
||||
if (isJoinDynamicField(dynamicFormDTO)) {
|
||||
dynamicFormListShowFieldDTOList.addAll(listJoinDynamicFormListShowField(dynamicFormDTO, ++joinIndex));
|
||||
}
|
||||
}
|
||||
return dynamicFormListShowFieldDTOList;
|
||||
@ -106,22 +113,135 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
||||
public List<DynamicFormFormShowFieldDTO> listFormShowFieldOfPage(String tableName) throws SearchException {
|
||||
List<DynamicFormDTO> dynamicFormDTOs = listDynamicForm(tableName);
|
||||
List<DynamicFormFormShowFieldDTO> dynamicFormFormShowFieldDTOList = new ArrayList<>();
|
||||
int joinIndex = 0;
|
||||
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
||||
// 显示字段
|
||||
if (dynamicFormDTO.getFormShow() == 1) {
|
||||
DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO = new DynamicFormFormShowFieldDTO();
|
||||
dynamicFormFormShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName());
|
||||
dynamicFormFormShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain());
|
||||
dynamicFormFormShowFieldDTO.setFieldDefault(dynamicFormDTO.getFieldDefault());
|
||||
dynamicFormFormShowFieldDTO.setDictionaryId(dynamicFormDTO.getDictionaryId());
|
||||
dynamicFormFormShowFieldDTO.setFieldType(dynamicFormDTO.getFieldType());
|
||||
dynamicFormFormShowFieldDTO.setVerifyType(dynamicFormDTO.getVerifyType());
|
||||
dynamicFormFormShowFieldDTO.setVerifyRegular(dynamicFormDTO.getVerifyRegular());
|
||||
dynamicFormFormShowFieldDTOList.add(dynamicFormFormShowFieldDTO);
|
||||
dynamicFormFormShowFieldDTOList.add(getDynamicFormFormShowFieldDTOByDynamicFormDTO(dynamicFormDTO));
|
||||
}
|
||||
// 联表字段
|
||||
if (isJoinDynamicField(dynamicFormDTO)) {
|
||||
dynamicFormFormShowFieldDTOList.addAll(listJoinDynamicFormFormShowField(dynamicFormDTO, ++joinIndex));
|
||||
}
|
||||
}
|
||||
return dynamicFormFormShowFieldDTOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置动态表单列表 联表 列表显示字段
|
||||
*
|
||||
* @param dynamicFormDTO
|
||||
* @param index 下标
|
||||
* @return
|
||||
*/
|
||||
private List<DynamicFormListShowFieldDTO> listJoinDynamicFormListShowField(DynamicFormDTO dynamicFormDTO, int index) {
|
||||
List<DynamicFormListShowFieldDTO> dynamicFormListShowFieldDTOList = new ArrayList<>();
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("tableName", WStringUtil.firstToLower(dynamicFormDTO.getJoinTable().replaceFirst("dynamic", "")));
|
||||
params.put("fieldNameList", Arrays.asList(dynamicFormDTO.getJoinTableListShow().split(",")));
|
||||
List<DynamicFormDTO> joinDynamicFormDTOs = dynamicFormDao.listDynamicForm(params);
|
||||
for (DynamicFormDTO joinDynamicFormDTO : joinDynamicFormDTOs) {
|
||||
DynamicFormListShowFieldDTO dynamicFormListShowFieldDTO = getDynamicFormListShowFieldDTOByDynamicFormDTO(joinDynamicFormDTO);
|
||||
dynamicFormListShowFieldDTO.setFieldName(String.format("%sJt%d", dynamicFormListShowFieldDTO.getFieldName(), index));
|
||||
dynamicFormListShowFieldDTOList.add(dynamicFormListShowFieldDTO);
|
||||
}
|
||||
return dynamicFormListShowFieldDTOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置动态表单列表 联表 表单显示字段
|
||||
*
|
||||
* @param dynamicFormDTO
|
||||
* @param index 下标
|
||||
* @return
|
||||
*/
|
||||
private List<DynamicFormFormShowFieldDTO> listJoinDynamicFormFormShowField(DynamicFormDTO dynamicFormDTO, int index) {
|
||||
List<DynamicFormFormShowFieldDTO> dynamicFormFormShowFieldDTOList = new ArrayList<>();
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("tableName", WStringUtil.firstToLower(dynamicFormDTO.getJoinTable().replaceFirst("dynamic", "")));
|
||||
params.put("fieldNameList", Arrays.asList(dynamicFormDTO.getJoinTableListShow().split(",")));
|
||||
List<DynamicFormDTO> joinDynamicFormDTOs = dynamicFormDao.listDynamicForm(params);
|
||||
for (DynamicFormDTO joinDynamicFormDTO : joinDynamicFormDTOs) {
|
||||
DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO = getDynamicFormFormShowFieldDTOByDynamicFormDTO(joinDynamicFormDTO);
|
||||
dynamicFormFormShowFieldDTO.setFieldName(String.format("%sJt%d", dynamicFormFormShowFieldDTO.getFieldName(), index));
|
||||
dynamicFormFormShowFieldDTOList.add(dynamicFormFormShowFieldDTO);
|
||||
}
|
||||
return dynamicFormFormShowFieldDTOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置动态表单的列表字段
|
||||
*
|
||||
* @param dynamicFormDTO
|
||||
* @return
|
||||
*/
|
||||
private DynamicFormListShowFieldDTO getDynamicFormListShowFieldDTOByDynamicFormDTO(DynamicFormDTO dynamicFormDTO) {
|
||||
DynamicFormListShowFieldDTO dynamicFormListShowFieldDTO = new DynamicFormListShowFieldDTO();
|
||||
dynamicFormListShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName());
|
||||
dynamicFormListShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain());
|
||||
dynamicFormListShowFieldDTO.setFieldType(dynamicFormDTO.getFieldType());
|
||||
return dynamicFormListShowFieldDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置动态表单的表单字段
|
||||
*
|
||||
* @param dynamicFormDTO
|
||||
* @return
|
||||
*/
|
||||
private DynamicFormFormShowFieldDTO getDynamicFormFormShowFieldDTOByDynamicFormDTO(DynamicFormDTO dynamicFormDTO) {
|
||||
DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO = new DynamicFormFormShowFieldDTO();
|
||||
dynamicFormFormShowFieldDTO.setFieldName(dynamicFormDTO.getFieldName());
|
||||
dynamicFormFormShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain());
|
||||
dynamicFormFormShowFieldDTO.setFieldDefault(dynamicFormDTO.getFieldDefault());
|
||||
dynamicFormFormShowFieldDTO.setDictionaryId(dynamicFormDTO.getDictionaryId());
|
||||
dynamicFormFormShowFieldDTO.setFieldType(dynamicFormDTO.getFieldType());
|
||||
dynamicFormFormShowFieldDTO.setVerifyType(dynamicFormDTO.getVerifyType());
|
||||
dynamicFormFormShowFieldDTO.setVerifyRegular(dynamicFormDTO.getVerifyRegular());
|
||||
return dynamicFormFormShowFieldDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listJoinTableField(List<DynamicFormDTO> dynamicFormDTOs) throws SearchException {
|
||||
List<Map<String, Object>> listShowField = new ArrayList<>();
|
||||
for (DynamicFormDTO dynamicFormDTO : dynamicFormDTOs) {
|
||||
boolean isJoin = isJoinDynamicField(dynamicFormDTO);
|
||||
if (isJoin) {
|
||||
Map<String, Object> listShow = new HashMap<>(2);
|
||||
listShow.put("fieldType", dynamicFormDTO.getFieldType());
|
||||
listShow.put("fieldName", WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName()));
|
||||
listShow.put("joinTable", WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getJoinTable()));
|
||||
listShow.put("joinTableField", WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getJoinTableField()));
|
||||
listShow.put("joinTableSort", dynamicFormDTO.getJoinTableSort());
|
||||
// 构建连表显示字段
|
||||
List<String> listJoinTableListShow = new ArrayList<>();
|
||||
if (!StringUtils.isBlank(dynamicFormDTO.getJoinTableListShow())) {
|
||||
String[] joinTableListShowArray = dynamicFormDTO.getJoinTableListShow().split(",");
|
||||
for (String joinTableListShow : joinTableListShowArray) {
|
||||
listJoinTableListShow.add(WStringUtil.lowerUpper2UnderLine(joinTableListShow));
|
||||
}
|
||||
} else {
|
||||
listJoinTableListShow.add(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getJoinTableListShow()));
|
||||
}
|
||||
listShow.put("joinTableListShow", listJoinTableListShow);
|
||||
listShowField.add(listShow);
|
||||
}
|
||||
}
|
||||
return listShowField;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是动态字段
|
||||
*
|
||||
* @param dynamicFormDTO
|
||||
* @return
|
||||
*/
|
||||
private boolean isJoinDynamicField(DynamicFormDTO dynamicFormDTO) {
|
||||
return (StringUtils.equals(FieldTypeEnum.INNER_JOIN.getValue(), dynamicFormDTO.getFieldType())
|
||||
|| StringUtils.equals(FieldTypeEnum.LEFT_JOIN.getValue(), dynamicFormDTO.getFieldType())
|
||||
|| StringUtils.equals(FieldTypeEnum.RIGHT_JOIN.getValue(), dynamicFormDTO.getFieldType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存动态表单信息
|
||||
*
|
||||
@ -314,6 +434,15 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF
|
||||
} else if (StringUtils.equals(FieldTypeEnum.JOIN.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||
tableColumnVO.setDataType(ColumnDataTypeEnum.CHAR.getDataType());
|
||||
tableColumnVO.setColumnLength(36);
|
||||
} else if (StringUtils.equals(FieldTypeEnum.LEFT_JOIN.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||
tableColumnVO.setDataType(ColumnDataTypeEnum.VARCHAR.getDataType());
|
||||
tableColumnVO.setColumnLength(255);
|
||||
} else if (StringUtils.equals(FieldTypeEnum.INNER_JOIN.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||
tableColumnVO.setDataType(ColumnDataTypeEnum.VARCHAR.getDataType());
|
||||
tableColumnVO.setColumnLength(255);
|
||||
} else if (StringUtils.equals(FieldTypeEnum.RIGHT_JOIN.getValue(), dynamicFormFieldVO.getFieldType())) {
|
||||
tableColumnVO.setDataType(ColumnDataTypeEnum.VARCHAR.getDataType());
|
||||
tableColumnVO.setColumnLength(255);
|
||||
}
|
||||
return tableColumnVO;
|
||||
}
|
||||
|
@ -16,6 +16,11 @@
|
||||
<result property="fieldSort" column="field_sort"/>
|
||||
<result property="listShow" column="list_show"/>
|
||||
<result property="formShow" column="form_show"/>
|
||||
<result property="joinTable" column="join_table"/>
|
||||
<result property="joinTableField" column="join_table_field"/>
|
||||
<result property="joinTableSort" column="join_table_sort"/>
|
||||
<result property="joinTableListShow" column="join_table_list_show"/>
|
||||
<result property="joinTableFormShow" column="join_table_form_show"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表单新增 -->
|
||||
@ -33,6 +38,11 @@
|
||||
field_sort,
|
||||
list_show,
|
||||
form_show,
|
||||
join_table,
|
||||
join_table_field,
|
||||
join_table_sort,
|
||||
join_table_list_show,
|
||||
join_table_form_show,
|
||||
gmt_create,
|
||||
creator,
|
||||
gmt_modified,
|
||||
@ -51,6 +61,11 @@
|
||||
#{fieldSort},
|
||||
#{listShow},
|
||||
#{formShow},
|
||||
#{joinTable},
|
||||
#{joinTableField},
|
||||
#{joinTableSort},
|
||||
#{joinTableListShow},
|
||||
#{joinTableFormShow},
|
||||
#{gmtCreate},
|
||||
#{creator},
|
||||
#{gmtModified},
|
||||
@ -111,6 +126,21 @@
|
||||
</if>
|
||||
<if test="formShow != null">
|
||||
form_show = #{formShow},
|
||||
</if>
|
||||
<if test="joinTable != null">
|
||||
join_table = #{joinTable},
|
||||
</if>
|
||||
<if test="joinTableField != null">
|
||||
join_table_field = #{joinTableField},
|
||||
</if>
|
||||
<if test="joinTableSort != null">
|
||||
join_table_sort = #{joinTableSort},
|
||||
</if>
|
||||
<if test="joinTableListShow != null">
|
||||
join_table_list_show = #{joinTableListShow},
|
||||
</if>
|
||||
<if test="joinTableFormShow != null">
|
||||
join_table_form_show = #{joinTableFormShow},
|
||||
</if>
|
||||
modifier = #{modifier},
|
||||
gmt_modified = #{gmtModified}
|
||||
|
@ -82,22 +82,49 @@
|
||||
</foreach>
|
||||
<foreach collection="listShowFieldList" index="index" item="item" open="," separator="" close="">
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'checkbox' or item.fieldType == 'select'">
|
||||
GROUP_CONCAT(t${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name,
|
||||
GROUP_CONCAT(dt${index + 1}.dictionary_name) ${item.fieldName}_dictionary_name,
|
||||
</if>
|
||||
</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} ${item}_jt${index + 1},
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
t1.${uuidField}
|
||||
FROM
|
||||
${tableName} t1
|
||||
<foreach collection="listShowFieldList" index="index" item="item" open="" separator="" close="">
|
||||
<if test="item.fieldType == 'radio' or item.fieldType == 'checkbox' or item.fieldType == 'select'">
|
||||
LEFT JOIN
|
||||
data_dictionary t${index + 1}
|
||||
data_dictionary dt${index + 1}
|
||||
ON
|
||||
FIND_IN_SET(t${index + 1}.dictionary_id, t1.${item.fieldName})
|
||||
FIND_IN_SET(dt${index + 1}.dictionary_id, t1.${item.fieldName})
|
||||
AND
|
||||
t${index + 1}.is_delete = 0
|
||||
dt${index + 1}.is_delete = 0
|
||||
</if>
|
||||
</foreach>
|
||||
<if test="listJoinTableField != null and listJoinTableField.size > 0">
|
||||
<foreach collection="listJoinTableField" index="index" item="item" open="" separator="" close="">
|
||||
<if test="item.fieldType == 'leftJoin'">
|
||||
LEFT JOIN
|
||||
</if>
|
||||
<if test="item.fieldType == 'innerJoin'">
|
||||
INNER JOIN
|
||||
</if>
|
||||
<if test="item.fieldType == 'rightJoin'">
|
||||
RIGHT JOIN
|
||||
</if>
|
||||
${item.joinTable} jt${index + 1}
|
||||
ON
|
||||
t1.${item.fieldName} = jt${index + 1}.${item.joinTableField}
|
||||
AND
|
||||
jt${index + 1}.is_delete = 0
|
||||
</foreach>
|
||||
</if>
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
GROUP BY
|
||||
@ -105,6 +132,15 @@
|
||||
<foreach collection="listShowFieldList" item="item" open="," separator="," close="">
|
||||
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>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 动态数据详情 -->
|
||||
|
@ -15,6 +15,11 @@
|
||||
<result property="fieldSort" column="field_sort"/>
|
||||
<result property="listShow" column="list_show"/>
|
||||
<result property="formShow" column="form_show"/>
|
||||
<result property="joinTable" column="join_table"/>
|
||||
<result property="joinTableField" column="join_table_field"/>
|
||||
<result property="joinTableSort" column="join_table_sort"/>
|
||||
<result property="joinTableListShow" column="join_table_list_show"/>
|
||||
<result property="joinTableFormShow" column="join_table_form_show"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 保存动态表单 -->
|
||||
@ -70,7 +75,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 动态表单详情 -->
|
||||
<select id="listDynamicForm" parameterType="string" resultMap="dynamicFormDTO">
|
||||
<select id="listDynamicForm" parameterType="map" resultMap="dynamicFormDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@ -78,7 +83,14 @@
|
||||
WHERE
|
||||
is_delete = 0
|
||||
AND
|
||||
table_name = #{_parameter}
|
||||
table_name = #{tableName}
|
||||
<if test="fieldNameList != null and fieldNameList.size > 0">
|
||||
AND
|
||||
field_name IN
|
||||
<foreach collection="fieldNameList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY
|
||||
field_sort
|
||||
</select>
|
||||
|
@ -134,6 +134,30 @@
|
||||
case 'join':
|
||||
value = '主联字段';
|
||||
break;
|
||||
case 'currentUser':
|
||||
value = '当前用户';
|
||||
break;
|
||||
case 'currentDepartment':
|
||||
value = '当前组织';
|
||||
break;
|
||||
case 'currentRole':
|
||||
value = '当前角色';
|
||||
break;
|
||||
case 'currentGroup':
|
||||
value = '当前组';
|
||||
break;
|
||||
case 'currentPosition':
|
||||
value = '当前职位';
|
||||
break;
|
||||
case 'leftJoin':
|
||||
value = '左联表';
|
||||
break;
|
||||
case 'innerJoin':
|
||||
value = '内联表';
|
||||
break;
|
||||
case 'rightJoin':
|
||||
value = '右联表';
|
||||
break;
|
||||
default:
|
||||
value = '文本';
|
||||
}
|
||||
|
@ -9,6 +9,11 @@
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
.layui-form-select dl {
|
||||
max-height: 150px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
@ -42,7 +47,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="fieldType" lay-verify="required">
|
||||
<select name="fieldType" lay-verify="required" lay-filter="fieldType">
|
||||
<option value="string">文本</option>
|
||||
<option value="datetime">时间戳</option>
|
||||
<option value="date">日期</option>
|
||||
@ -62,64 +67,99 @@
|
||||
<option value="currentRole">当前角色</option>
|
||||
<option value="currentGroup">当前组</option>
|
||||
<option value="currentPosition">当前职位</option>
|
||||
<option value="currentPosition">外联表</option>
|
||||
<option value="currentPosition">内联表</option>
|
||||
<option value="leftJoin">左联表</option>
|
||||
<option value="innerJoin">内联表</option>
|
||||
<option value="rightJoin">右联表</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段默认值</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="fieldDefault" placeholder="请输入字段默认值" class="layui-input">
|
||||
<div id="joinFieldBox" style="display: none;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联表</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTable" placeholder="请选择关联表" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联字段</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableField" placeholder="请输入关联字段" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="joinTableSort" placeholder="请输入关联顺序" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">连表列表</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableListShow" placeholder="请输入连表列表显示" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">连表表单</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableFormShow" placeholder="请输入连表表单显示" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段字典</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||
<div id="normalFieldBox">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段默认值</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="fieldDefault" placeholder="请输入字段默认值" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="verifyType" lay-verify="required">
|
||||
<option value="none">无</option>
|
||||
<option value="required">不为空</option>
|
||||
<option value="phone">手机号</option>
|
||||
<option value="email">邮件</option>
|
||||
<option value="url">链接</option>
|
||||
<option value="number">数字</option>
|
||||
<option value="date">日期</option>
|
||||
<option value="identity">身份证</option>
|
||||
<option value="custom">自定义</option>
|
||||
</select>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段字典</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验正则</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="verifyRegular" placeholder="请输入校验正则" class="layui-input">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="verifyType" lay-verify="required">
|
||||
<option value="none">无</option>
|
||||
<option value="required">不为空</option>
|
||||
<option value="phone">手机号</option>
|
||||
<option value="email">邮件</option>
|
||||
<option value="url">链接</option>
|
||||
<option value="number">数字</option>
|
||||
<option value="date">日期</option>
|
||||
<option value="identity">身份证</option>
|
||||
<option value="custom">自定义</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验正则</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="verifyRegular" placeholder="请输入校验正则" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">列表显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="listShow" value="0" title="关闭">
|
||||
<input type="radio" name="listShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">表单显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="formShow" value="0" title="关闭">
|
||||
<input type="radio" name="formShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="fieldSort" lay-verify="number" placeholder="请输入排序" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">列表显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="listShow" value="0" title="关闭">
|
||||
<input type="radio" name="listShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">表单显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="formShow" value="0" title="关闭">
|
||||
<input type="radio" name="formShow" value="1" title="开启" checked>
|
||||
<input type="number" name="fieldSort" lay-verify="number" placeholder="请输入排序" class="layui-input" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
@ -185,6 +225,15 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('select(fieldType)', function(data) {
|
||||
if(data.value === 'leftJoin' || data.value === 'innerJoin' || data.value === 'rightJoin') {
|
||||
$('#normalFieldBox').hide();
|
||||
$('#joinFieldBox').show();
|
||||
} else {
|
||||
$('#joinFieldBox').hide();
|
||||
$('#normalFieldBox').show();
|
||||
}
|
||||
});
|
||||
$(document.body).on('click', '#dictionaryName', function() {
|
||||
top.dialog.tree({
|
||||
title: '绑定数据字典',
|
||||
|
@ -9,6 +9,11 @@
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
.layui-form-select dl {
|
||||
max-height: 150px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
@ -42,7 +47,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="fieldType" lay-verify="required">
|
||||
<select name="fieldType" lay-verify="required" lay-filter="fieldType">
|
||||
<option value="string">文本</option>
|
||||
<option value="datetime">时间戳</option>
|
||||
<option value="date">日期</option>
|
||||
@ -57,42 +62,98 @@
|
||||
<option value="selectDepartment">选择部门</option>
|
||||
<option value="file">文件</option>
|
||||
<option value="join">主联字段</option>
|
||||
<option value="currentUser">当前用户</option>
|
||||
<option value="currentDepartment">当前组织</option>
|
||||
<option value="currentRole">当前角色</option>
|
||||
<option value="currentGroup">当前组</option>
|
||||
<option value="currentPosition">当前职位</option>
|
||||
<option value="leftJoin">左联表</option>
|
||||
<option value="innerJoin">内联表</option>
|
||||
<option value="rightJoin">右联表</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段默认值</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="fieldDefault" placeholder="请输入字段默认值" class="layui-input">
|
||||
<div id="joinFieldBox" style="display: none;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联表</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTable" placeholder="请选择关联表" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联字段</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableField" placeholder="请输入关联字段" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="joinTableSort" placeholder="请输入关联顺序" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">连表列表</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableListShow" placeholder="请输入连表列表显示" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">连表表单</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="joinTableFormShow" placeholder="请输入连表表单显示" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段字典ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||
<div id="normalFieldBox">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段默认值</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="fieldDefault" placeholder="请输入字段默认值" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="verifyType" lay-verify="required">
|
||||
<option value="none">无</option>
|
||||
<option value="required">不为空</option>
|
||||
<option value="phone">手机号</option>
|
||||
<option value="email">邮件</option>
|
||||
<option value="url">链接</option>
|
||||
<option value="number">数字</option>
|
||||
<option value="date">日期</option>
|
||||
<option value="identity">身份证</option>
|
||||
<option value="custom">自定义</option>
|
||||
</select>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">字段字典ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验正则</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="verifyRegular" placeholder="请输入校验正则" class="layui-input">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验类型 *</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="verifyType" lay-verify="required">
|
||||
<option value="none">无</option>
|
||||
<option value="required">不为空</option>
|
||||
<option value="phone">手机号</option>
|
||||
<option value="email">邮件</option>
|
||||
<option value="url">链接</option>
|
||||
<option value="number">数字</option>
|
||||
<option value="date">日期</option>
|
||||
<option value="identity">身份证</option>
|
||||
<option value="custom">自定义</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">校验正则</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="verifyRegular" placeholder="请输入校验正则" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">列表显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="listShow" value="0" title="关闭">
|
||||
<input type="radio" name="listShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">表单显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="formShow" value="0" title="关闭">
|
||||
<input type="radio" name="formShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
@ -101,20 +162,6 @@
|
||||
<input type="number" name="fieldSort" lay-verify="number" placeholder="请输入排序" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">列表显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="listShow" value="0" title="关闭">
|
||||
<input type="radio" name="listShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">表单显示 *</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="formShow" value="0" title="关闭">
|
||||
<input type="radio" name="formShow" value="1" title="开启" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
@ -157,9 +204,21 @@
|
||||
verifyRegular: data.verifyRegular,
|
||||
fieldSort: data.fieldSort,
|
||||
listShow: data.listShow,
|
||||
formShow: data.formShow
|
||||
formShow: data.formShow,
|
||||
joinTable: data.joinTable,
|
||||
joinTableField: data.joinTableField,
|
||||
joinTableSort: data.joinTableSort,
|
||||
joinTableListShow: data.joinTableListShow,
|
||||
joinTableFormShow: data.joinTableFormShow
|
||||
});
|
||||
form.render(null, 'dataForm');
|
||||
if(data.fieldType === 'leftJoin' || data.fieldType === 'innerJoin' || data.fieldType === 'rightJoin') {
|
||||
$('#normalFieldBox').hide();
|
||||
$('#joinFieldBox').show();
|
||||
} else {
|
||||
$('#joinFieldBox').hide();
|
||||
$('#normalFieldBox').show();
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.DialogBox.msg(data.msg);
|
||||
}, function() {
|
||||
@ -205,6 +264,15 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
form.on('select(fieldType)', function(data) {
|
||||
if(data.value === 'leftJoin' || data.value === 'innerJoin' || data.value === 'rightJoin') {
|
||||
$('#normalFieldBox').hide();
|
||||
$('#joinFieldBox').show();
|
||||
} else {
|
||||
$('#joinFieldBox').hide();
|
||||
$('#normalFieldBox').show();
|
||||
}
|
||||
});
|
||||
$(document.body).on('click', '#dictionaryName', function() {
|
||||
top.dialog.tree({
|
||||
title: '绑定数据字典',
|
||||
|
@ -20,4 +20,5 @@ public @interface CheckEmptyAnnotation {
|
||||
String name();
|
||||
|
||||
String[] types() default {};
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.cm.common.utils;
|
||||
|
||||
import com.cm.common.pojo.vos.push.PushMessageVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.beans.BeanInfo;
|
||||
@ -13,7 +11,6 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@ -237,4 +234,56 @@ public class HashMapUtil {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 冒泡排序
|
||||
*
|
||||
* @param sortMapList 待排序列表
|
||||
* @param sortKey 排序Key
|
||||
* @param isAsc 是否正向
|
||||
* @param isNumber 是否数字
|
||||
*/
|
||||
public static void bubbleSort(List<Map<String, Object>> sortMapList, String sortKey, boolean isAsc, boolean isNumber) {
|
||||
Map<String, Object> tempMap;
|
||||
Map<String, Object> prevMap;
|
||||
Map<String, Object> nextMap;
|
||||
for (Map<String, Object> map : sortMapList) {
|
||||
for (int i = 0; i < sortMapList.size() - 1; i++) {
|
||||
int nextIndex = i + 1;
|
||||
prevMap = sortMapList.get(i);
|
||||
String prevSortKey = prevMap.get(sortKey) == null ? "" : prevMap.get(sortKey).toString();
|
||||
nextMap = sortMapList.get(nextIndex);
|
||||
String nextSortKey = nextMap.get(sortKey) == null ? "" : nextMap.get(sortKey).toString();
|
||||
if (isAsc) {
|
||||
if (isNumber) {
|
||||
if (NumberUtils.toDouble(prevSortKey, 0D) > NumberUtils.toDouble(nextSortKey, 0D)) {
|
||||
tempMap = prevMap;
|
||||
sortMapList.set(i, nextMap);
|
||||
sortMapList.set(nextIndex, tempMap);
|
||||
}
|
||||
} else {
|
||||
if (prevSortKey.compareTo(nextSortKey) > 0) {
|
||||
tempMap = prevMap;
|
||||
sortMapList.set(i, nextMap);
|
||||
sortMapList.set(nextIndex, tempMap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isNumber) {
|
||||
if (NumberUtils.toDouble(prevSortKey, 0D) < NumberUtils.toDouble(nextSortKey, 0D)) {
|
||||
tempMap = prevMap;
|
||||
sortMapList.set(i, nextMap);
|
||||
sortMapList.set(nextIndex, tempMap);
|
||||
}
|
||||
} else {
|
||||
if (prevSortKey.compareTo(nextSortKey) < 0) {
|
||||
tempMap = prevMap;
|
||||
sortMapList.set(i, nextMap);
|
||||
sortMapList.set(nextIndex, tempMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user