退料报错处理暂用
This commit is contained in:
parent
ac85168a4c
commit
13e3f0768c
|
|
@ -172,4 +172,10 @@ public interface BackApplyMapper {
|
||||||
List<LeaseApplyDetails> getLeaseApplyDetailsTypeCount(BackApplyInfo bean);
|
List<LeaseApplyDetails> getLeaseApplyDetailsTypeCount(BackApplyInfo bean);
|
||||||
|
|
||||||
String getTypeName(String typeId);
|
String getTypeName(String typeId);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL4(BackApplyInfo bean);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL3(List<Long> list4ParentIds);
|
||||||
|
|
||||||
|
List<TypeTreeNode> getUseTypeTreeL21(List<Long> list3ParentIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -350,8 +350,24 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
|
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
|
||||||
List<TypeTreeNode> groupList = new ArrayList<>();
|
List<TypeTreeNode> groupList = new ArrayList<>();
|
||||||
List<TypeTreeNode> list = new ArrayList<>();
|
List<TypeTreeNode> list = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL4 = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL3 = new ArrayList<>();
|
||||||
|
List<TypeTreeNode> listL21 = new ArrayList<>();
|
||||||
|
List<com.bonus.sgzb.base.api.domain.BackApplyInfo> infoList = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
list = backApplyMapper.getUseTypeTree(bean);
|
// 先查第四层类型
|
||||||
|
listL4 = backApplyMapper.getUseTypeTreeL4(bean);
|
||||||
|
if (CollectionUtils.isNotEmpty(listL4)) {
|
||||||
|
List<Long> list4ParentIds = listL4.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||||
|
// 根据第四层parentId 查第三层类型
|
||||||
|
listL3 = backApplyMapper.getUseTypeTreeL3(list4ParentIds);
|
||||||
|
List<Long> list3ParentIds = listL3.stream().map(o -> o.getParentId()).collect(Collectors.toList());
|
||||||
|
// 根据第三层parentId 查第1.2层类型
|
||||||
|
listL21 = backApplyMapper.getUseTypeTreeL21(list3ParentIds);
|
||||||
|
list.addAll(listL4);
|
||||||
|
list.addAll(listL3);
|
||||||
|
list.addAll(listL21);
|
||||||
|
}
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
// 创建树形结构(数据集合作为参数)
|
// 创建树形结构(数据集合作为参数)
|
||||||
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
||||||
|
|
|
||||||
|
|
@ -1095,4 +1095,81 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join ma_type mt2 on mt2.type_id = mt.parent_id
|
left join ma_type mt2 on mt2.type_id = mt.parent_id
|
||||||
where mt.type_id = #{typeId}
|
where mt.type_id = #{typeId}
|
||||||
</select>
|
</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 sai2.num > 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
|
||||||
|
mt2.type_id,
|
||||||
|
mt2.type_name,
|
||||||
|
mt2.parent_id,
|
||||||
|
mt2.unit_name,
|
||||||
|
mt2.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt2.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt2 where type_id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
union
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
mt1.type_id,
|
||||||
|
mt1.type_name,
|
||||||
|
mt1.parent_id,
|
||||||
|
mt1.unit_name,
|
||||||
|
mt1.company_id,
|
||||||
|
0 AS num,
|
||||||
|
mt1.LEVEL
|
||||||
|
FROM
|
||||||
|
ma_type mt1 left join (
|
||||||
|
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) mt2 on mt2.parent_id=mt1.type_id where mt2.type_id in
|
||||||
|
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue