文档库--分页判空

This commit is contained in:
zhn
2022-02-14 18:13:09 +08:00
parent 3d570c0d8c
commit 4749ff99ca
2 changed files with 32 additions and 7 deletions
@@ -220,7 +220,7 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
@AutoLog(value = "新增数据")
@ApiOperation(value="新增数据", notes="新增数据")
@PostMapping(value = "/addInfo")
public Result<?> addInfo(Map<String,Object> map) {
public Result<?> addInfo(@RequestBody Map<String,Object> map) {
try {
bussDocumentLibraryEOService.addInfo(map);
} catch (Exception e) {
@@ -335,6 +335,22 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
valuesBuilder.append(value + ",");
} else {
//处理文件类型
List<OnlCgformField> fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) {
String valueTemp = UUID.randomUUID().toString().replace("-", "");
value = valueTemp;
//修改文件表关联信息connect_id
List<OSSFile> oSSFileList = new ArrayList<>();
for (String fileId : value.toString().split(",")) {
OSSFile ossFile = new OSSFile();
ossFile.setId(fileId);
ossFile.setConnectId(valueTemp);
oSSFileList.add(ossFile);
}
iOSSFileService.updateFileInfo(oSSFileList);
}
valuesBuilder.append("'" + value + "'" + ",");
}
fieldsBuilder.append(key + ",");
@@ -352,6 +368,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1);
//先删除在新增.
// bussDocumentLibraryEOMapper.deleteById((String)dateList.get(0).get("id"));
//删除文件
//删除文档库数据
bussDocumentLibraryEOMapper.deleteById((String) map.get("id"));
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
@@ -367,8 +386,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
public IPage getInfoPage(Map<String, Object> parameter) {
//过滤查询条件字段类型使用
List<Map<String, Object>> mapList = queryCondition("1");
//需要查询的字段
@@ -380,18 +398,26 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<String> fieldListTemp = fieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
List<String> fieldListNew = new ArrayList<>();
fieldListNew.add("id");
//转时间格式
//转时间格式 case when region is null then "" else region end region
for (String field : fieldListTemp) {
String fieldTemp = null;
if ("issue_time".equals(field) || "implement_time".equals(field)) {
fieldListNew.add("date_format(" + field + ", '%Y-%m-%d %H:%i:%s')");
String fieldNew = "date_format(" + field + ", '%Y-%m-%d %H:%i:%s')";
fieldTemp = "case when "+fieldNew+" is null then \"\" else "+fieldNew+" end "+ field;
fieldListNew.add(fieldTemp);
} else {
fieldListNew.add(field);
fieldTemp = "case when "+field+" is null then \"\" else "+field+" end "+ field;
fieldListNew.add(fieldTemp);
}
}
//查询条件
StringBuilder conditionSb = new StringBuilder("where 1 = 1");
//过滤查询条件字段类型使用
List<Map<String, Object>> mapList = queryCondition("1");
//查询条件处理
if (ObjectUtils.isNotEmpty(parameter)) {
for (Map.Entry<String, Object> entry : parameter.entrySet()) {
String key = entry.getKey();
@@ -418,7 +444,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
conditionSb.append(" and " + key + " in(" + substring + ")");
} else if (FieldTypeEnum.DATE.getValue().equals(fieldType)) {
value = "2022-01-24";
//日期(区分单日期还时间范围)
if (value.contains(",")) {
conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'"