Эх сурвалжийг харах

资料查询 重置文件题名

chenr 2 сар өмнө
parent
commit
7f4f2d9464

+ 37 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.google.common.collect.Lists;
 import io.swagger.annotations.*;
@@ -188,6 +189,42 @@ public class InformationWriteQueryController extends BladeController {
         return R.data(300, null, "未找到文件题名");
     }
 
+    @PostMapping("/flushQueryName")
+    @ApiModelProperty(value = "刷新文件题名")
+    @ApiOperationSupport(order = 28)
+    public R<Boolean> flushQueryName(@RequestParam String ids){
+        if(ids==null){
+            throw new ServiceException("请选择要刷新的文件");
+        }
+        List<Long> idList = Arrays.stream(ids.split(","))
+            .map(Long::valueOf)
+            .collect(Collectors.toList());
+        List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery()
+            .select(InformationQuery::getId, InformationQuery::getName,InformationQuery::getProjectId,InformationQuery::getClassify).in(InformationQuery::getId, idList));
+        String sgSuffix="";
+        String jlSuffix="";
+        if(queryList.size()>0){
+            String sql1="Select sg_suffix,jl_suffix from m_project_info where id="+queryList.get(0).getProjectId()+" and is_deleted=0";
+            List<ProjectInfo> projectInfos = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
+            if(projectInfos.size()>0){
+                sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
+                jlSuffix=projectInfos.get(0).getJlSuffix()==null?"":projectInfos.get(0).getJlSuffix();
+            }
+            for (InformationQuery query : queryList) {
+                if(query.getClassify()!=null&&query.getClassify()==1&&StringUtils.isNotEmpty(sgSuffix)){
+                   if(!query.getName().endsWith(sgSuffix)){
+                       query.setName(query.getName()+sgSuffix);
+                   }
+                }else if(query.getClassify()!=null&&query.getClassify()==2&&StringUtils.isNotEmpty(jlSuffix)){
+                    if(!query.getName().endsWith(jlSuffix)){
+                        query.setName(query.getName()+jlSuffix);
+                    }
+                }
+            }
+        }
+        return R.status(this.informationQueryService.updateBatchById(queryList));
+    }
+
     /**
      * 初始化合同段导图树
      */