|
@@ -2,6 +2,7 @@ package com.boman.system.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
|
+import com.boman.system.common.FormDataConstant;
|
|
|
import com.boman.system.common.MainTableRecord;
|
|
|
import com.boman.system.common.RowResult;
|
|
|
import com.boman.system.mapper.StandardlyMapper;
|
|
@@ -12,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
|
|
|
/**
|
|
|
* @author shiqian
|
|
@@ -29,18 +32,26 @@ public class BaseSaveServiceImpl implements IBaseSaveService {
|
|
|
/**
|
|
|
* 功能描述: 保存一行
|
|
|
*
|
|
|
- * @param tableName tableName
|
|
|
- * @param pkName 主键名称
|
|
|
- * @param maxId 最大的SEQ
|
|
|
- * @param row 要保存的数据
|
|
|
+ * @param tableName tableName
|
|
|
+ * @param pkName 主键名称
|
|
|
+ * @param maxId 最大的SEQ
|
|
|
+ * @param row 要保存的数据
|
|
|
+ * @param allColumnNameList 这是此表的所有字段属性名称,用来判断是否所有UPDATE_BY和UPDATE_TIME
|
|
|
* @return com.boman.system.common.RowResult
|
|
|
*/
|
|
|
@Override
|
|
|
- public RowResult insertRow(String tableName, String pkName, Long maxId, MainTableRecord row) {
|
|
|
+ public RowResult insertRow(String tableName, String pkName, Long maxId, MainTableRecord row, List<String> allColumnNameList) {
|
|
|
JSONObject commitData = row.getMainData().getCommitData();
|
|
|
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
|
|
|
- commitData.put("UPDATE_BY", SecurityUtils.getUserId());
|
|
|
- commitData.put("UPDATE_TIME", currentTime);
|
|
|
+ if (allColumnNameList.contains(FormDataConstant.UPDATE_BY)
|
|
|
+ || allColumnNameList.contains(FormDataConstant.UPDATE_BY.toLowerCase())) {
|
|
|
+ commitData.put(FormDataConstant.UPDATE_BY, SecurityUtils.getUserId());
|
|
|
+ }
|
|
|
+ if (allColumnNameList.contains(FormDataConstant.UPDATE_TIME)
|
|
|
+ || allColumnNameList.contains(FormDataConstant.UPDATE_TIME.toLowerCase())) {
|
|
|
+ commitData.put(FormDataConstant.UPDATE_TIME, SecurityUtils.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
// 新增
|
|
|
if (row.getId() > 0) {
|
|
|
commitData.put("CREATE_TIME", currentTime);
|