Browse Source

5/5 XIEXIANG

xiexiang 2 years ago
parent
commit
434fe46cab

+ 13 - 3
PAS/src/main/java/cn/cslg/pas/service/ScratchWordsService.java

@@ -46,6 +46,9 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
     public void add(ScratchWordsDTO scratchWordsDTO){
         //判断传入列表不为空
         if(scratchWordsDTO != null){
+            if(scratchWordsDTO.getCreateFrom() == null){
+                scratchWordsDTO.setCreateFrom(0);
+            }
             ScratchWords scratchWords = new ScratchWords();
             BeanUtils.copyProperties(scratchWordsDTO, scratchWords);
             //获取当前登陆人信息
@@ -82,7 +85,7 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
      * @return
      */
     public List<ScratchWordsVO> queryAll(SWQueryDTO swQueryDTO){
-        if(swQueryDTO.getPatentNo() != null && swQueryDTO.getId() != null && swQueryDTO.getCreateFrom() != null) {
+        if(swQueryDTO.getPatentNo() != null) {
             //获取当前登陆人信息
             PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
             Integer tenantId = personnelVO.getTenantId();
@@ -95,12 +98,19 @@ public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, Scratch
                 return scratchWords;
             }
             //创建来源(默认0/专题库1/报告2)
-            if(swQueryDTO.getCreateFrom().equals(2)){
+           else if(swQueryDTO.getCreateFrom().equals(2)){
                 Integer reportId = swQueryDTO.getId();
                 Integer projectId = -1;
                 List<ScratchWordsVO> scratchWords = scratchWordsMapper.querySW(swQueryDTO.getPatentNo(), tenantId, createId, projectId, reportId);
                 return scratchWords;
-            } else {
+            }
+            //创建来源(默认0/专题库1/报告2)
+           else if(swQueryDTO.getCreateFrom().equals(0)){
+                Integer reportId = -1;
+                Integer projectId = -1;
+                List<ScratchWordsVO> scratchWords = scratchWordsMapper.querySW(swQueryDTO.getPatentNo(), tenantId, createId, projectId, reportId);
+                return scratchWords;
+            }else {
                 throw new XiaoShiException("暂无该情况");
             }
         } else {

+ 12 - 5
PAS/src/main/resources/mapper/ScratchWordsMapper.xml

@@ -8,12 +8,19 @@
             patent_no = #{patentNo}
             and(
             <if test="projectId != null and reportId != null and createId != null and tenantId != null">
-                      (range_type = "false" and permission_type = 1 and tenant_id = #{tenantId})
+--                 所有地方可见/公开
+                    (range_type = "false" and permission_type = 1 and tenant_id = #{tenantId})
+--                 所有地方可见/私有
                     or(range_type = "false" and permission_type = 0 and create_id = #{createId})
-                    or(range_type = "true" and create_from = 2 and range_id = #{reportId} and permission_type = 1 and tenant_id = #{tenantId})
-                    or(range_type = "true" and create_from = 2 and range_id = #{reportId} and permission_type = 0 and create_id = #{createId})
-                    or(range_type = "true" and create_from = 1 and range_id = #{projectId} and permission_type = 1 and tenant_id = #{tenantId})
-                    or(range_type = "true" and create_from = 1 and range_id = #{projectId} and permission_type = 0 and create_id = #{createId})
+--                 只在来源出可见/公开
+                    or(range_type = "true" and create_from = 2   and range_id = #{reportId}  and permission_type = 1 and tenant_id = #{tenantId})
+                    or(range_type = "true" and create_from = 1   and range_id = #{projectId} and permission_type = 1 and tenant_id = #{tenantId})
+                    or(create_from = 0  and permission_type = 1  and tenant_id = #{tenantId})
+--                 只在来源出可见/私有
+                    or(range_type = "true" and create_from = 2   and range_id = #{reportId}  and permission_type = 0 and create_id = #{createId})
+                    or(range_type = "true" and create_from = 1   and range_id = #{projectId} and permission_type = 0 and create_id = #{createId})
+                    or(create_from = 0  and permission_type = 0  and create_id = #{createId})
+
             </if>
                 )
         </where>