fix(功能用例): 修复功能用例取消关联需求导致数据不对问题

--bug=1041347 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001041347
This commit is contained in:
guoyuqi 2024-05-28 18:01:40 +08:00 committed by 刘瑞斌
parent 7ce58c3137
commit 1e6e21039e
1 changed files with 13 additions and 0 deletions

View File

@ -210,6 +210,19 @@ public class FunctionalCaseDemandService {
* @param id 需求关系ID
*/
public void deleteDemand(String id) {
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
functionalCaseDemandExample.createCriteria().andParentEqualTo(id);
List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
if (CollectionUtils.isNotEmpty(functionalCaseDemands)) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
FunctionalCaseDemandMapper updateMapper = sqlSession.getMapper(FunctionalCaseDemandMapper.class);
for (FunctionalCaseDemand functionalCaseDemand : functionalCaseDemands) {
functionalCaseDemand.setWithParent(false);
updateMapper.updateByPrimaryKey(functionalCaseDemand);
}
sqlSession.flushStatements();
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
functionalCaseDemandMapper.deleteByPrimaryKey(id);
}