update 日志更新操作
This commit is contained in:
@@ -39,6 +39,15 @@ public class FieldCommon {
|
||||
LawsFieldTypeEnum.TREE_BOX_SINGLE.getValue() // 树型单选
|
||||
);
|
||||
|
||||
// 特殊更新记录字段
|
||||
public static final List<String> SPECIFIC_UPDATE_FIELD = Arrays.asList(
|
||||
"standard_system",
|
||||
"substitute_standard_number",
|
||||
"replaced_by_standard_number",
|
||||
"reference_standard",
|
||||
"referenced_standard"
|
||||
);
|
||||
|
||||
public static final String MODULE = "module"; // 表名标识
|
||||
public static final String ORDER_BY = "orderBy"; // 升序还是倒序标识
|
||||
public static final String ORDER_BY_FIELD = "orderByField"; // 排序字段
|
||||
|
||||
+11
-4
@@ -457,7 +457,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(tableName);
|
||||
// 筛选出表单显示的
|
||||
fieldList = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getInteger()
|
||||
.equals(lawsTag.getIsShowForm())).collect(Collectors.toList());
|
||||
.equals(lawsTag.getIsShowFormCreate())).collect(Collectors.toList());
|
||||
// 更新语句
|
||||
StringBuilder updateBuilder = new StringBuilder();
|
||||
// 拼接默认的更新语句
|
||||
@@ -529,13 +529,20 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
**/
|
||||
private void addUpdateRecord(List<LawsTag> fieldList, Map<String, Object> oldDataMap,
|
||||
StringBuilder recordBuffer, String key, String value) {
|
||||
if (FieldCommon.SPECIFIC_UPDATE_FIELD.contains(key)) {
|
||||
// 特殊更新字段处理
|
||||
return;
|
||||
}
|
||||
String oldValue = "";
|
||||
if (!Objects.isNull(oldDataMap.get(key))) oldValue = oldDataMap.get(key).toString();
|
||||
// 如果新旧值不一样
|
||||
if (!oldValue.equals(value)) {
|
||||
String name = fieldList.stream().filter(lawsTag -> key.equals(lawsTag.getDbFieldName()))
|
||||
.map(LawsTag::getDbFieldTxt).collect(Collectors.toList()).get(0);
|
||||
recordBuffer.append(FieldCommon.QUOTE + name + FieldCommon.QUOTE + "由");
|
||||
List<String> nameList = fieldList.stream().filter(lawsTag -> key.equals(lawsTag.getDbFieldName()))
|
||||
.map(LawsTag::getDbFieldTxt).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(nameList)) {
|
||||
return;
|
||||
}
|
||||
recordBuffer.append(FieldCommon.QUOTE + nameList.get(0) + FieldCommon.QUOTE + "由");
|
||||
recordBuffer.append(FieldCommon.QUOTE + oldValue + FieldCommon.QUOTE + "改为");
|
||||
recordBuffer.append(FieldCommon.QUOTE + value + FieldCommon.QUOTE + ";");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user