update 通用增删查改基础
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ public class LawsCommonController {
|
|||||||
@AutoLog(value = "通用操作-获取表单模型")
|
@AutoLog(value = "通用操作-获取表单模型")
|
||||||
@ApiOperation(value="通用操作-获取表单模型", notes="通用操作-获取表单模型")
|
@ApiOperation(value="通用操作-获取表单模型", notes="通用操作-获取表单模型")
|
||||||
@GetMapping(value = "getFormModel")
|
@GetMapping(value = "getFormModel")
|
||||||
public Result<List<Map<String,Object>>> getFormModel(@RequestParam(name="module") String module) {
|
public Result<Map<String,Object>> getFormModel(@RequestParam(name="module") String module) {
|
||||||
return Result.OK(lawsCommonService.getFormModel(module));
|
return Result.OK(lawsCommonService.getFormModel(module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ public interface ILawsCommonService {
|
|||||||
* @Date: 2023/8/24 10:53
|
* @Date: 2023/8/24 10:53
|
||||||
* @Description: 获取表单模型
|
* @Description: 获取表单模型
|
||||||
**/
|
**/
|
||||||
List<Map<String, Object>> getFormModel(String module);
|
Map<String, Object> getFormModel(String module);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
|
|||||||
+12
-12
@@ -200,7 +200,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
map.put("db_field_txt", lawsTag.getDbFieldEnName());//字段英文名
|
map.put("db_field_txt", lawsTag.getDbFieldEnName());//字段英文名
|
||||||
}
|
}
|
||||||
// 树型结构的集合
|
// 树型结构的集合
|
||||||
if (FieldTypeEnum.TREE.equals(lawsTag.getFieldShowType())) {
|
if (FieldTypeEnum.TREE.getValue().equals(lawsTag.getFieldShowType())) {
|
||||||
// 对树型结构做处理
|
// 对树型结构做处理
|
||||||
map.put("tree", new java.util.ArrayList<>());
|
map.put("tree", new java.util.ArrayList<>());
|
||||||
} else {
|
} else {
|
||||||
@@ -217,7 +217,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
* @Description: 获取表单模型
|
* @Description: 获取表单模型
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getFormModel(String module) {
|
public Map<String, Object> getFormModel(String module) {
|
||||||
// 获取操作语言
|
// 获取操作语言
|
||||||
LanguageEnum language = MessageUtils.getLanguage();
|
LanguageEnum language = MessageUtils.getLanguage();
|
||||||
// 获取要操作的表名
|
// 获取要操作的表名
|
||||||
@@ -231,10 +231,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
LawsArea lawsArea = new LawsArea();
|
LawsArea lawsArea = new LawsArea();
|
||||||
lawsArea.setIsModel(module);
|
lawsArea.setIsModel(module);
|
||||||
List<LawsArea> areaList = lawsAreaService.queryList(lawsArea);
|
List<LawsArea> areaList = lawsAreaService.queryList(lawsArea);
|
||||||
// 用于返回的集合
|
// 用于返回的区域集合
|
||||||
List<Map<String, Object>> resultList = new java.util.ArrayList<>();
|
Map<String, Object> areaMap = new LinkedHashMap<>();
|
||||||
// 区域集合
|
|
||||||
Map<String, Object> areaMap = new HashMap<>();
|
|
||||||
// 遍历每个区域做处理
|
// 遍历每个区域做处理
|
||||||
for (LawsArea area : areaList) {
|
for (LawsArea area : areaList) {
|
||||||
// 获取该区域的所有字段
|
// 获取该区域的所有字段
|
||||||
@@ -260,13 +258,16 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
fieldMap.put("db_field_txt", lawsTag.getDbFieldEnName());//字段英文名
|
fieldMap.put("db_field_txt", lawsTag.getDbFieldEnName());//字段英文名
|
||||||
}
|
}
|
||||||
fieldMap.put("field_show_type", lawsTag.getFieldShowType()); // 字段类型
|
fieldMap.put("field_show_type", lawsTag.getFieldShowType()); // 字段类型
|
||||||
fieldMap.put("dict_field", lawsTag.getDictField()); // 字典编码
|
fieldMap.put("dict_field", ""); // 字典编码
|
||||||
|
if (StringUtils.isNotBlank(lawsTag.getDictField())) {
|
||||||
|
fieldMap.put("dict_field", lawsTag.getDictField()); // 字典编码
|
||||||
|
}
|
||||||
fieldMap.put("show_area", lawsTag.getShowArea()); // 显示区域
|
fieldMap.put("show_area", lawsTag.getShowArea()); // 显示区域
|
||||||
fieldMap.put("field_must_input", lawsTag.getFieldMustInput()); // 是否必填
|
fieldMap.put("field_must_input", lawsTag.getFieldMustInput()); // 是否必填
|
||||||
fieldMap.put("db_length", lawsTag.getDbLength()); // 字段长度
|
fieldMap.put("db_length", lawsTag.getDbLength()); // 字段长度
|
||||||
fieldMap.put("isReadOnly", lawsTag.getIsReadOnly()); // 是否只读
|
fieldMap.put("isReadOnly", lawsTag.getIsReadOnly()); // 是否只读
|
||||||
// 树型结构做处理
|
// 树型结构做处理
|
||||||
if (FieldTypeEnum.TREE.equals(lawsTag.getFieldShowType())) {
|
if (FieldTypeEnum.TREE.getValue().equals(lawsTag.getFieldShowType())) {
|
||||||
fieldMap.put("tree", new java.util.ArrayList<>());
|
fieldMap.put("tree", new java.util.ArrayList<>());
|
||||||
} else {
|
} else {
|
||||||
fieldMap.put("tree", new java.util.ArrayList<>());
|
fieldMap.put("tree", new java.util.ArrayList<>());
|
||||||
@@ -275,8 +276,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
}
|
}
|
||||||
areaMap.put(areaName, fieldMapList);
|
areaMap.put(areaName, fieldMapList);
|
||||||
}
|
}
|
||||||
resultList.add(areaMap);
|
return areaMap;
|
||||||
return resultList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -357,7 +357,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
* @Description: 对数据值做格式处理
|
* @Description: 对数据值做格式处理
|
||||||
**/
|
**/
|
||||||
private String setValue(String fieldShowType, String value) {
|
private String setValue(String fieldShowType, String value) {
|
||||||
if (FieldTypeEnum.DATE_SINGLE.equals(fieldShowType)) {
|
if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) {
|
||||||
// 如果是单日期格式,做格式处理
|
// 如果是单日期格式,做格式处理
|
||||||
value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')";
|
value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')";
|
||||||
} else {
|
} else {
|
||||||
@@ -401,7 +401,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
.equals(lawsTag.getIsShowForm().toString())).collect(Collectors.toList());
|
.equals(lawsTag.getIsShowForm().toString())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
// 筛选获取日期类型字段
|
// 筛选获取日期类型字段
|
||||||
List<String> dateFieldList = fieldList.stream().filter(lawsTag -> FieldTypeEnum.DATE_SINGLE
|
List<String> dateFieldList = fieldList.stream().filter(lawsTag -> FieldTypeEnum.DATE_SINGLE.getValue()
|
||||||
.equals(lawsTag.getFieldShowType())).collect(Collectors.toList())
|
.equals(lawsTag.getFieldShowType())).collect(Collectors.toList())
|
||||||
.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||||
// 获取全部的字段列表
|
// 获取全部的字段列表
|
||||||
|
|||||||
Reference in New Issue
Block a user