Sfoglia il codice sorgente

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
5 anni fa
parent
commit
8e984ce2ed

+ 25 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldOperationDynamicsController.java

@@ -2,9 +2,11 @@ package com.hssx.cloudmodel.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.cloudmodel.entity.Mould;
 import com.hssx.cloudmodel.entity.MouldOperationDynamics;
 import com.hssx.cloudmodel.entity.ProjectOperationDynamics;
 import com.hssx.cloudmodel.service.MouldOperationDynamicsService;
+import com.hssx.cloudmodel.service.MouldService;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author 吴涛涛
  * @since 2019-08-08
@@ -23,6 +28,8 @@ public class MouldOperationDynamicsController {
 
     @Autowired
     private MouldOperationDynamicsService mDynamicsService;
+    @Autowired
+    private MouldService mouldService;
     /**
      *
      * 项目操作记录列表
@@ -34,8 +41,25 @@ public class MouldOperationDynamicsController {
     @ResponseBody
     public HttpRespMsg list(MouldOperationDynamics mouldOperationDynamics){
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = mDynamicsService.list(new QueryWrapper<MouldOperationDynamics>().eq("mould_id",mouldOperationDynamics.getMouldId()).eq("belong_type",mouldOperationDynamics.getBelongType()).orderByDesc("id"));
+        if(4 == mouldOperationDynamics.getBelongType()){
+            List<Integer> list = new ArrayList<>();
+            list = recursion(mouldOperationDynamics.getMouldId(),list);
+            msg.data = mDynamicsService.list(new QueryWrapper<MouldOperationDynamics>().in("mould_id",list).eq("belong_type",mouldOperationDynamics.getBelongType()).orderByDesc("id"));
+        }else{
+            msg.data = mDynamicsService.list(new QueryWrapper<MouldOperationDynamics>().eq("mould_id",mouldOperationDynamics.getMouldId()).eq("belong_type",mouldOperationDynamics.getBelongType()).orderByDesc("id"));
+        }
         return msg;
     }
+    public List<Integer> recursion(int mouldId, List<Integer> list){
+        Mould mould = null;
+        mould = mouldService.getById(mouldId);
+        if(mould != null){
+            list.add(mould.getId());
+            if(mould.getPreUpdateId() != 0){
+                recursion(mould.getPreUpdateId(),list);
+            }
+        }
+        return list;
+    }
 }
 

+ 5 - 17
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -430,28 +430,16 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
         List<MouldFile> list = new ArrayList<>();
         List<Integer> ids = new ArrayList<>();
-        if(blongType == 4){
-            List<Integer> recursion = recursion(mouldId, ids);
-            list = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().in("model_id", recursion).orderByDesc("id"));
-        }else{
+//        if(blongType == 4){
+//            List<Integer> recursion = recursion(mouldId, ids);
+//            list = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().in("model_id", recursion).orderByDesc("id"));
+//        }else{
             list = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", mouldId).eq("blong_type", blongType).orderByDesc("id"));
-        }
+//        }
         msg.data = list;
         return msg;
     }
 
-    public List<Integer> recursion(int mouldId,List<Integer> list){
-        Mould mould = null;
-        mould = mouldMapper.selectById(mouldId);
-        if(mould != null){
-            list.add(mould.getId());
-            if(mould.getPreUpdateId() != 0){
-                recursion(mould.getPreUpdateId(),list);
-            }
-        }
-        return list;
-    }
-
     @Override
     public HttpRespMsg delFile(MouldFile mouldFile) {
         HttpRespMsg msg = new HttpRespMsg();

+ 19 - 15
cloud-model/src/main/resources/mapper/MouldOperationDynamicsMapper.xml

@@ -4,18 +4,18 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.MouldOperationDynamics">
-        <id column="id" property="id" />
-        <result column="file_id" property="fileId" />
-        <result column="operator_id" property="operatorId" />
-        <result column="operator_name" property="operatorName" />
-        <result column="indate" property="indate" />
-        <result column="file_name" property="fileName" />
-        <result column="belong_type" property="belongType" />
-        <result column="content" property="content" />
-        <result column="mould_id" property="mouldId" />
-        <result column="is_pass" property="isPass" />
-        <result column="applicant_id" property="applicantId" />
-        <result column="applicant_name" property="applicantName" />
+        <id column="id" property="id"/>
+        <result column="file_id" property="fileId"/>
+        <result column="operator_id" property="operatorId"/>
+        <result column="operator_name" property="operatorName"/>
+        <result column="indate" property="indate"/>
+        <result column="file_name" property="fileName"/>
+        <result column="belong_type" property="belongType"/>
+        <result column="content" property="content"/>
+        <result column="mould_id" property="mouldId"/>
+        <result column="is_pass" property="isPass"/>
+        <result column="applicant_id" property="applicantId"/>
+        <result column="applicant_name" property="applicantName"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -27,8 +27,12 @@
         <include refid="Base_Column_List"/>
         from
         tb_mould_operation_dynamics
-        where
-        mould_id = #{userVO.mouldId}
-        and indate between #{startTime} and #{endTime}
+        <where>
+            mould_id = #{userVO.mouldId}
+            and content = '下载'
+            <if test="startDate != null and endDate != null">
+                and indate between #{startDate} and #{endDate}
+            </if>
+        </where>
     </select>
 </mapper>