Commit 62e84d11 by huangfusuper

修改查询全部工作流为懒加载的方式

parent ff7ec73b
package com.byit.view;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowVersionDetailedVo;
import com.byit.model.vo.FlowVersionVo;
import com.byit.service.FlowVersionService;
import com.byit.model.vo.FlowVersionVoDep;
......@@ -31,4 +33,8 @@ public class FlowVersionViewController {
public List<FlowVersionVo> findAllVersion(){
return flowVersionService.findAllVersion();
}
@RequestMapping("findAllByFlowId")
public List<FlowVersionDetailedVo> findAllByFlowId(Integer flowId) {
return flowVersionService.findAllByFlowId(flowId);
}
}
package com.byit.view;
import com.byit.model.Flow;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowViewVo;
import com.byit.service.FlowService;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -31,4 +32,13 @@ public class FlowViewController {
public List<FlowViewVo> findAllFlowViewVo(){
return flowService.findAllFlowViewVo();
}
/**
* 查询工作流摘要
* @return
*/
@PostMapping("findAllFlowImportant")
public List<FlowImportantAllVo> findAllFlowImportant() {
return flowService.findAllFlowImportant();
}
}
......@@ -7,6 +7,7 @@ import java.util.List;
@Repository
public interface FlowVersionMapper {
List<FlowVersion> findAllByFlowId(Integer flowId);
/**
* 查询全部的工作流
* @return
......
package com.byit.model.vo;
import lombok.Data;
/**
* 版本管理 使用的vo
* @author huangfu
*/
@Data
public class FlowImportantAllVo {
private String rowKey;
private String flowName;
private Integer flowId;
private boolean hasChildren;
}
package com.byit.model.vo;
import com.byit.model.FlowVersion;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
* @author huangfu
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class FlowVersionDetailedVo extends FlowVersion {
private String rowKey;
}
package com.byit.service;
import com.byit.model.Flow;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowViewVo;
import com.byit.model.vo.FlowVo;
import com.byit.model.vo.NodeVo;
......@@ -20,6 +21,8 @@ public interface FlowService {
* @return
*/
List<FlowViewVo> findAllFlowViewVo();
List<FlowImportantAllVo> findAllFlowImportant();
/**
* 查询全部的任务流数据
* @return
......
package com.byit.service;
import com.byit.model.FlowVersion;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowVersionDetailedVo;
import com.byit.model.vo.FlowVersionVo;
import com.byit.model.vo.FlowVersionVoDep;
......@@ -21,4 +23,6 @@ public interface FlowVersionService {
* @return
*/
List<FlowVersionVo> findAllVersion();
List<FlowVersionDetailedVo> findAllByFlowId(Integer flowId);
}
......@@ -10,6 +10,7 @@ import com.byit.enums.NodePropertyEnum;
import com.byit.job.utils.CronExpression;
import com.byit.mapper.*;
import com.byit.model.*;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowViewVo;
import com.byit.model.vo.FlowVo;
import com.byit.model.vo.NodeVo;
......@@ -67,6 +68,19 @@ public class FlowServiceImpl implements FlowService {
}
@Override
public List<FlowImportantAllVo> findAllFlowImportant() {
List<Flow> all = flowMapper.findAll();
return all.stream().map(flow -> {
FlowImportantAllVo flowImportantAllVo = new FlowImportantAllVo();
flowImportantAllVo.setRowKey(UUID.randomUUID().toString().replace("-",""));
flowImportantAllVo.setHasChildren(true);
flowImportantAllVo.setFlowName(flow.getFlowName());
flowImportantAllVo.setFlowId(flow.getFlowId());
return flowImportantAllVo;
}).collect(Collectors.toList());
}
@Override
public List<Flow> findAllFlow() {
return flowMapper.findAll();
}
......
package com.byit.service.impl;
import cn.hutool.core.util.IdcardUtil;
import com.byit.mapper.FlowVersionMapper;
import com.byit.model.FlowVersion;
import com.byit.model.vo.FlowImportantAllVo;
import com.byit.model.vo.FlowVersionDetailedVo;
import com.byit.model.vo.FlowVersionVo;
import com.byit.service.FlowVersionService;
import com.byit.model.vo.FlowVersionVoDep;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -40,6 +41,8 @@ public class FlowVersionServiceImpl implements FlowVersionService {
return flowVersionVoDeps;
}
@Override
public List<FlowVersionVo> findAllVersion() {
List<FlowVersion> allFlow = flowVersionMapper.findAllFlow();
......@@ -53,4 +56,15 @@ public class FlowVersionServiceImpl implements FlowVersionService {
return flowVersionVo;
}).collect(Collectors.toList());
}
@Override
public List<FlowVersionDetailedVo> findAllByFlowId(Integer flowId) {
List<FlowVersion> allByFlowId = flowVersionMapper.findAllByFlowId(flowId);
return allByFlowId.stream().map(e ->{
FlowVersionDetailedVo flowVersionDetailedVo = new FlowVersionDetailedVo();
flowVersionDetailedVo.setRowKey(UUID.randomUUID().toString().replace("-",""));
BeanUtils.copyProperties(e,flowVersionDetailedVo);
return flowVersionDetailedVo;
}).collect(Collectors.toList());
}
}
......@@ -31,6 +31,11 @@
repeat_count, version_mark, workspace_id, author, principal, version_name, is_inner
</sql>
<select id="findAllByFlowId" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from flow_version where flow_id=#{flowId,jdbcType=INTEGER} and remove_mark = '1'
</select>
<select id="findAllFlow" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from flow_version where remove_mark = '1'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment