Prechádzať zdrojové kódy

fix:审批表审核记录查询

caozixuan 3 rokov pred
rodič
commit
5828ad0c27

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/TFFlowLogMapper.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.distributed.print.business.bean.dto.approvalForm.ApprovalInfo;
 import com.qmth.distributed.print.business.bean.result.TFFlowLogResult;
 import com.qmth.distributed.print.business.entity.TFFlowLog;
 import org.apache.ibatis.annotations.Param;
@@ -43,4 +44,12 @@ public interface TFFlowLogMapper extends BaseMapper<TFFlowLog> {
      * @return
      */
     TFFlowLog findByLast(@Param("flowId") Long flowId, @Param("schoolId") Long schoolId, @Param("approveOperation") String approveOperation);
+
+    /**
+     * 根据流程id查询审批表
+     *
+     * @param flowId 流程id
+     * @return 审批表
+     */
+    List<ApprovalInfo> findApprovalInfoByFlowId(@Param("flowId") Long flowId);
 }

+ 1 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TFFlowLogServiceImpl.java

@@ -73,20 +73,6 @@ public class TFFlowLogServiceImpl extends ServiceImpl<TFFlowLogMapper, TFFlowLog
 
     @Override
     public List<ApprovalInfo> findApprovalInfoByFlowId(Long flowId) {
-        List<ApprovalInfo> approvalInfoList = new ArrayList<>();
-        List<TFFlowLog> tfFlowLogList = this.list(new QueryWrapper<TFFlowLog>().lambda()
-                .eq(TFFlowLog::getFlowId,flowId));
-        for (TFFlowLog tfFlowLog : tfFlowLogList) {
-            ApprovalInfo approvalInfo = new ApprovalInfo();
-            Long approveId = tfFlowLog.getApproveId();
-            approvalInfo.setApproveId(approveId);
-            approvalInfo.setApproveName(sysUserService.getById(approveId).getRealName());
-            approvalInfo.setTime(tfFlowLog.getUpdateTime());
-            approvalInfo.setRemark(tfFlowLog.getApproveRemark());
-            approvalInfo.setApproveOrgName(sysOrgService.getById(sysUserService.getById(approveId).getOrgId()).getName());
-            approvalInfo.setApproveType(tfFlowLog.getApproveOperation());
-            approvalInfoList.add(approvalInfo);
-        }
-        return approvalInfoList;
+        return this.baseMapper.findApprovalInfoByFlowId(flowId);
     }
 }

+ 22 - 0
distributed-print-business/src/main/resources/mapper/TFFlowLogMapper.xml

@@ -63,5 +63,27 @@
         order by tffl.create_time desc
         limit 1
     </select>
+    <select id="findApprovalInfoByFlowId"
+            resultType="com.qmth.distributed.print.business.bean.dto.approvalForm.ApprovalInfo">
+        SELECT
+            tffl.approve_id AS approveId,
+            su.real_name AS approveName,
+            tffl.update_time AS time,
+            tffl.approve_remark AS remark,
+            so.name AS approveOrgName,
+            tffl.approve_operation AS approveType
+        FROM
+            t_f_flow_log tffl
+                LEFT JOIN
+            sys_user su ON tffl.approve_id = su.id
+                LEFT JOIN
+            sys_org so ON su.org_id = so.id
+        <where>
+            <if test="flowId != null and flowId != ''">
+                AND tffl.flow_id = #{flowId}
+            </if>
+        </where>
+        ORDER BY tffl.update_time
+    </select>
 
 </mapper>