optimize: 两条sql分开执行

This commit is contained in:
曹鹏飞 2024-08-09 18:10:28 +08:00
parent 0663529f27
commit 611a5eeb53
3 changed files with 9 additions and 4 deletions

View File

@ -34,6 +34,8 @@ public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity>
void deleteAllChildren(Long rowId); void deleteAllChildren(Long rowId);
void updateBomExist0(Long rowId);
void delBomChild(@Param("bomRowIds") List<Long> bomRowIds); void delBomChild(@Param("bomRowIds") List<Long> bomRowIds);
List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo); List<BomNewPbomParentVO> getBomByMaterialNo(String materialNo);

View File

@ -28,6 +28,7 @@ public class BomNewEbomChildService extends ServiceImpl<BomNewEbomChildMapper, B
public void deleteAllChildren(Long parentRowId) { public void deleteAllChildren(Long parentRowId) {
baseMapper.deleteAllChildren(parentRowId); baseMapper.deleteAllChildren(parentRowId);
baseMapper.updateBomExist0(parentRowId);
} }
public CompletableFuture<Void> updateEBomMaterialUse(Collection<String> materialNos) { public CompletableFuture<Void> updateEBomMaterialUse(Collection<String> materialNos) {

View File

@ -73,6 +73,11 @@
</foreach> </foreach>
group by b.material_no; group by b.material_no;
</update> </update>
<update id="updateBomExist0">
UPDATE t_bom_new_ebom_parent
SET bom_exist=0
WHERE row_id = #{rowId};
</update>
<select id="getChildMaxExceptionState" resultType="com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO"> <select id="getChildMaxExceptionState" resultType="com.nflg.product.bomnew.pojo.vo.ChildMaxExceptionStateVO">
select max(exception_status) maxExceptionState, parent_row_id from t_bom_new_ebom_child select max(exception_status) maxExceptionState, parent_row_id from t_bom_new_ebom_child
@ -112,10 +117,7 @@
<delete id="deleteAllChildren"> <delete id="deleteAllChildren">
DELETE DELETE
FROM t_bom_new_ebom_child FROM t_bom_new_ebom_child
WHERE parent_row_id = #{parentRowId}; WHERE parent_row_id = #{rowId};
UPDATE t_bom_new_ebom_parent
SET bom_exist=0
WHERE row_id = #{parentRowId};
</delete> </delete>
<delete id="delBomChild"> <delete id="delBomChild">