其他分享
首页 > 其他分享> > 批量删除

批量删除

作者:互联网

1、Controller:

//批量删除区域树
@PostMapping("/deletBeatch")
public Result delete(@RequestBody IdsForm idsForm) {
try {
stationRegionTreeService.deleteBatch(idsForm);
return Result.ok(idsForm.getIds());
} catch (Exception e) {
return Result.error(idsForm.getIds(), Constant.EXISTS_RELATION_NOT_DELETE_MSG);
}
}

2、Service:

void deleteBatch(IdsForm idsForm);

3、ServiceImpl:

@Transactional
@Override
public void deleteBatch(IdsForm idsForm) {
List<String> ids = idsForm.getIds();
if (ids == null || ids.size() == 0) {
return;
}
stationRegionTreeDao.deleteBatch(ids);
}

4、dao:

@Modifying
@javax.transaction.Transactional
@Query("delete from StationRegionTree s where s.id in ( :ids )")
void deleteBatch(@Param("ids") List<String> ids);

标签:return,批量,删除,void,ids,idsForm,getIds,deleteBatch
来源: https://www.cnblogs.com/sensenh/p/16370981.html