退料申请只显示领料的机具类型层级
This commit is contained in:
parent
9b67c44fe4
commit
a88b682939
|
|
@ -120,6 +120,12 @@ public interface BackApplyMapper {
|
|||
*/
|
||||
List<TypeTreeNode> getUseTypeTree(BackApplyInfo bean);
|
||||
|
||||
List<TypeTreeNode> getUseTypeTreeL4(BackApplyInfo bean);
|
||||
|
||||
List<TypeTreeNode> getUseTypeTreeL3(List<Long> list);
|
||||
|
||||
List<TypeTreeNode> getUseTypeTreeL21(List<Long> list);
|
||||
|
||||
/**
|
||||
* 退料申请导出
|
||||
* @param bean
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hay
|
||||
|
|
@ -364,8 +365,19 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
|
||||
List<TypeTreeNode> groupList = new ArrayList<>();
|
||||
List<TypeTreeNode> list = new ArrayList<>();
|
||||
List<TypeTreeNode> listL4 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL3 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||
try {
|
||||
list = backApplyMapper.getUseTypeTree(bean);
|
||||
//list = backApplyMapper.getUseTypeTree(bean);
|
||||
listL4 = backApplyMapper.getUseTypeTreeL4(bean);
|
||||
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||
listL3 = backApplyMapper.getUseTypeTreeL3(list4ParentIds);
|
||||
List<Long> list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||
listL21 = backApplyMapper.getUseTypeTreeL21(list3ParentIds);
|
||||
list.addAll(listL4);
|
||||
list.addAll(listL3);
|
||||
list.addAll(listL21);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
||||
|
|
|
|||
|
|
@ -690,6 +690,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEVEL ASC, type_id;
|
||||
</select>
|
||||
|
||||
<select id="getUseTypeTreeL4" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt.type_name,
|
||||
mt.parent_id,
|
||||
mt.unit_name as unitNames,
|
||||
mt.company_id,
|
||||
SUM( CASE WHEN sai.agreement_id = #{agreementId} AND sai.STATUS = '0' THEN sai.num ELSE 0 END ) AS num,
|
||||
mt.LEVEL
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
|
||||
WHERE
|
||||
EXISTS ( SELECT 1 FROM slt_agreement_info sai2 WHERE sai2.type_id = mt.type_id AND sai2.agreement_id = #{agreementId} AND sai2.STATUS = '0' and sai.lease_type = 0)
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
</select>
|
||||
|
||||
<select id="getUseTypeTreeL3" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||
SELECT
|
||||
mt3.type_id,
|
||||
mt3.type_name,
|
||||
mt3.parent_id,
|
||||
mt3.unit_name,
|
||||
mt3.company_id,
|
||||
0 AS num,
|
||||
mt3.LEVEL
|
||||
FROM
|
||||
ma_type mt3 where type_id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getUseTypeTreeL21" resultType="com.bonus.sgzb.material.domain.TypeTreeNode">
|
||||
SELECT
|
||||
mt3.type_id,
|
||||
mt3.type_name,
|
||||
mt3.parent_id,
|
||||
mt3.unit_name,
|
||||
mt3.company_id,
|
||||
0 AS num,
|
||||
mt3.LEVEL
|
||||
FROM
|
||||
ma_type mt3 where type_id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
union
|
||||
|
||||
SELECT
|
||||
mt2.type_id,
|
||||
mt2.type_name,
|
||||
mt2.parent_id,
|
||||
mt2.unit_name,
|
||||
mt2.company_id,
|
||||
0 AS num,
|
||||
mt2.LEVEL
|
||||
FROM
|
||||
ma_type mt2 left join (
|
||||
SELECT
|
||||
mt3.type_id,
|
||||
mt3.type_name,
|
||||
mt3.parent_id,
|
||||
mt3.unit_name,
|
||||
mt3.company_id,
|
||||
0 AS num,
|
||||
mt3.LEVEL
|
||||
FROM
|
||||
ma_type mt3) mt3 on mt3.parent_id=mt2.type_id where mt3.type_id in
|
||||
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="exportList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
|
||||
SELECT
|
||||
bai.`code`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue