|
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.system.entity.CommonEntity;
|
|
|
import com.ruoyi.system.entity.TableSql;
|
|
|
import com.ruoyi.system.mapper.CommonMapper;
|
|
@@ -21,8 +22,7 @@ import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.*;
|
|
|
|
|
|
-import static com.ruoyi.common.utils.StringUtils.convertToCamelCase;
|
|
|
-import static com.ruoyi.common.utils.StringUtils.toUnderScoreCase;
|
|
|
+import static com.ruoyi.common.utils.StringUtils.*;
|
|
|
|
|
|
|
|
|
@Service
|
|
@@ -59,9 +59,14 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
fieldNames.add(toUnderScoreCase(key));
|
|
|
});
|
|
|
});
|
|
|
+ fieldNames.add("create_by");
|
|
|
+ fieldNames.add("create_time");
|
|
|
+ Map<String, Object> objectMap = new HashMap<>();
|
|
|
+ objectMap.put("create_by", SecurityUtils.getUsername());
|
|
|
+ objectMap.put("create_time", DateUtils.getTime());
|
|
|
+ mapList.add(objectMap);
|
|
|
return commonMapper.batchInsert(fieldNames, tableName, mapList);
|
|
|
|
|
|
-
|
|
|
// String tableName = (String) commonEntity.getBasicMap().get("tableName");
|
|
|
// List<Map<String, String>> list = commonEntity.getAddListMap();
|
|
|
// List<Map<String, Object>> mapList = new ArrayList<>();
|
|
@@ -87,10 +92,10 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
Map<String, Object> fields = JSONObject.parseObject(JSON.toJSONString(commonEntity.getCommMap()));
|
|
|
Map<String, Object> endfields = new HashMap<>();
|
|
|
fields.keySet().forEach(item -> {
|
|
|
-// Map<String, Object> asd = JSONObject.parseObject("{ \"" + toUnderScoreCase(item) + "\":\"" + fields.get(item) + "\"}", new TypeReference<Map<String, Object>>() {
|
|
|
-// });
|
|
|
endfields.put(toUnderScoreCase(item), fields.get(item));
|
|
|
});
|
|
|
+ endfields.put("update_by", SecurityUtils.getUsername());
|
|
|
+ endfields.put("update_time", DateUtils.getTime());
|
|
|
return commonMapper.edit(endfields, tableName, conditions);
|
|
|
}
|
|
|
|
|
@@ -188,7 +193,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
for (int w = 0; w < mapList.size(); w++) {
|
|
|
XSSFRow row = sheet.createRow(rowIndex++);
|
|
|
for (int e = 0; e < fieldList.size(); e++) {
|
|
|
- Object val = mapList.get(w).get(toUnderScoreCase(fieldList.get(e)));
|
|
|
+ Object val = mapList.get(w).get(toCamelCase(fieldList.get(e)));
|
|
|
row.createCell(e).setCellValue((val == null ? "" : val).toString());
|
|
|
}
|
|
|
}
|