xiexiang преди 2 години
родител
ревизия
09047ec089

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/dto/SWQueryDTO.java

@@ -21,7 +21,7 @@ public class SWQueryDTO {
     private Integer id;
 
     /**
-     * 创建来源
+     * 创建来源(默认0/专题库1/报告2)
      */
     private Integer createFrom;
 }

+ 17 - 6
PAS/src/main/java/cn/cslg/pas/controller/ScratchWordsController.java

@@ -37,21 +37,32 @@ public class ScratchWordsController {
     @Operation(summary = "查询划词高亮")
     @PostMapping("/query")
     public String query(@RequestBody SWQueryDTO swQueryDTO) {
-        List<ScratchWordsVO> scratchWordsVOS = scratchWordsService.queryAll(swQueryDTO);
-        return Response.success(scratchWordsVOS);
+        if (swQueryDTO != null) {
+            return Response.success(scratchWordsService.queryAll(swQueryDTO));
+        } else {
+            return Response.error("查询失败");
+        }
     }
 
     @Operation(summary = "更新划词高亮")
     @PostMapping("/update")
     public String update(@RequestBody ScratchWordsUpdateDTO scratchWordsUpdateDTO){
-        scratchWordsService.update(scratchWordsUpdateDTO);
-        return Response.success("更新成功");
+        if (scratchWordsUpdateDTO != null) {
+            scratchWordsService.update(scratchWordsUpdateDTO);
+            return Response.success("更新成功");
+        } else {
+            return Response.error("更新失败");
+        }
     }
 
     @Operation(summary = "删除划词高亮")
     @PostMapping("/delete")
     public String delete(@RequestBody List<Integer> ids){
-        scratchWordsService.delete(ids);
-        return Response.success("删除成功");
+        if (ids != null && ids.size() != 0) {
+            scratchWordsService.delete(ids);
+            return Response.success("删除成功");
+        } else {
+            return Response.error("删除失败");
+        }
     }
 }

+ 9 - 20
PAS/src/main/java/cn/cslg/pas/service/ScratchWordsService.java

@@ -41,13 +41,12 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
 
     /**
      * 新增划词高亮
-     *
      * @param scratchWordsDTO
      */
     public void add(ScratchWordsDTO scratchWordsDTO){
-        ScratchWords scratchWords = new ScratchWords();
         //判断传入列表不为空
         if(scratchWordsDTO != null){
+            ScratchWords scratchWords = new ScratchWords();
             BeanUtils.copyProperties(scratchWordsDTO, scratchWords);
             //获取当前登陆人信息
             PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
@@ -67,9 +66,9 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
      * @param scratchWordsUpdateDTO
      */
     public void update(ScratchWordsUpdateDTO scratchWordsUpdateDTO){
-        ScratchWords scratchWords = new ScratchWords();
         //判断传入列表不为空
         if(scratchWordsUpdateDTO != null){
+            ScratchWords scratchWords = this.getById(scratchWordsUpdateDTO.getId());
             BeanUtils.copyProperties(scratchWordsUpdateDTO, scratchWords);
             scratchWords.updateById();
         } else {
@@ -77,21 +76,25 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
         }
     }
 
-
+    /**
+     * 查询划词高亮
+     * @param swQueryDTO
+     * @return
+     */
     public List<ScratchWordsVO> queryAll(SWQueryDTO swQueryDTO){
         if(swQueryDTO.getPatentNo() != null && swQueryDTO.getId() != null && swQueryDTO.getCreateFrom() != null) {
             //获取当前登陆人信息
             PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
             Integer tenantId = personnelVO.getTenantId();
             Integer createId = personnelVO.getId();
-//            Integer tenantId = 10;
-//            Integer createId = 10;
+            //创建来源(默认0/专题库1/报告2)
             if(swQueryDTO.getCreateFrom().equals(1)){
                 Integer projectId = swQueryDTO.getId();
                 Integer reportId = -1;
                 List<ScratchWordsVO> scratchWords = scratchWordsMapper.querySW(swQueryDTO.getPatentNo(), tenantId, createId, projectId, reportId);
                 return scratchWords;
             }
+            //创建来源(默认0/专题库1/报告2)
             if(swQueryDTO.getCreateFrom().equals(2)){
                 Integer reportId = swQueryDTO.getId();
                 Integer projectId = -1;
@@ -117,18 +120,4 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
             scratchWords.deleteById();
         }
     }
-//
-//    public List<ScratchWordsVO> querySW(String patentNo, Integer id, Integer type){
-//        //多重情况考虑
-//        //根据tenantId(公司)、patentNo(专利号),
-//        //   permissionType为1,全公司人都可见的批注;
-//        //        查询rangeType为F的(全部地方可见);
-//        //        查询rangeType为T的(只在来源处可见),但是要判断传入type=createFrom创建来源,传入id=rangeId;
-//        //   permissionType为0,只有自己可见的批注,需要满足登陆人信息=createId;
-//        //        查询rangeType为F的(全部地方可见);
-//        //        查询rangeType为T的(只在来源处可见),但是要判断传入type=createFrom创建来源,传入id=rangeId;
-//        List<ScratchWordsVO> swVOS = new ArrayList<>();
-//        List<ScratchWordsVO> swvos = new ArrayList<>();
-//        swVOS.add(swvos);
-//    }
 }