1、BUG修复

This commit is contained in:
大米 2024-04-13 16:01:35 +08:00
parent a5e5dd1827
commit 840de12bfe
3 changed files with 68 additions and 28 deletions

View File

@ -54,7 +54,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList ,@Param("dataType") Integer dataType);
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("materialNo") String materialNo,@Param("dataType") Integer dataType );
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("bomRowIds") Collection<Long> bomRowIds );
void updateRootState();

View File

@ -131,7 +131,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
materialNos.addAll(parentMaterialByMaterialNo);
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType());
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, materialNo, query.getDataType());
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, parents.stream().map(u->u.getRowId()).collect(Collectors.toSet()));
List<BomNewEbomParentVO> data = new ArrayList<>();
data.addAll(parents);
data.addAll(childs);

View File

@ -98,40 +98,80 @@
<!--物料编码搜索-父级-->
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT if(status=4 and #{dataType}!=1, 99,status) status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_ebom_parent a where a.last_version_is=1
<!-- <if test="dataType!=1 and !hasParentIs" >-->
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_ebom_parent a
join (select material_no,max(current_version) current_version from t_bom_new_ebom_parent where
<if test="dataType==1" >
a.status = 4
</if>
<if test="dataType==0" >
and a.status &lt; 4
</if>
and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by material_no ) b on a.material_no=b.material_no and a.current_version=b.current_version
</select>
<!-- &lt;!&ndash;物料编码搜索-父级&ndash;&gt;-->
<!-- <select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- SELECT if(status=4 and #{dataType}!=1, 99,status) status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*-->
<!-- FROM t_bom_new_ebom_parent a where a.last_version_is=1-->
<!--&lt;!&ndash; <if test="dataType!=1 and !hasParentIs" >&ndash;&gt;-->
<!--&lt;!&ndash; and a.status &lt; 4&ndash;&gt;-->
<!--&lt;!&ndash; </if>&ndash;&gt;-->
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- and material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </select>-->
<!--物料编码搜索-子级-->
<!-- <select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy-->
<!-- ,c.devise_name,c.devise_user_code,c.dept_name ,-->
<!-- c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*-->
<!-- from t_bom_new_ebom_parent a-->
<!-- join t_bom_new_ebom_child b on a.row_id =b.parent_row_id-->
<!-- left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1-->
<!-- where a.last_version_is=1-->
<!-- <if test="dataType!=1">-->
<!-- and a.status &lt; 4-->
<!-- </if>-->
<if test="dataType==1">
and a.status = 4
</if>
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- and ( b.material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- or b.material_no=#{materialNo})-->
<!-- </select>-->
and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!--物料编码搜索-子级-->
<select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy
,c.devise_name,c.devise_user_code,c.dept_name ,
c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*
from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id =b.parent_row_id
left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1
where a.last_version_is=1
<if test="dataType!=1">
and a.status &lt; 4
</if>
<if test="dataType==1">
and a.status = 4
</if>
and ( b.material_no in
select a.status ,a.current_version , a.created_by as bomCreatedBy,
a.devise_name ,a.devise_user_code
,a.dept_name,a.source,ifnull( a.row_id,0) as bomRowId
,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_ebom_child b
left join t_bom_new_ebom_parent a on a.material_no=b.material_no and a.row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
where b.parent_row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and b.material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or b.material_no=#{materialNo})
</select>
<!--BOM-正式工作表-->