MyBatis-Plus(十一)Service的CRUD接口3:增删改操作_mybatisplus的savebatch方法在什么接口-CSDN博客
mybatisPlus的CURD
/**
*
* @Description: 修改合同执行的时候是真实删除
* @param ids
* @return boolean
* @throws:异常描述
*
*/
public boolean trueDeleteFileByfileIds(List<Integer> fielIds) {
if(CollectionUtils.isEmpty(fielIds)) return true;
LambdaQueryWrapper<ContractWorkFile> wrapperFile = Wrappers.lambdaQuery();
wrapperFile.in(ContractWorkFile::getId, fielIds)
.eq(ContractWorkFile::getDeleted,DeleteStateEnum.NO_DELETE.getValue());
List<ContractWorkFile> list = this.list(wrapperFile);
if(CollectionUtils.isEmpty(list)) return true;
for (ContractWorkFile file : list) {
String url = file.getUrl(); //文件链接
if(StringUtils.hasLength(url)) oSSUtil.delete(url);
}
return this.remove(wrapperFile);
//return this.removeByIds(list);
}
如果用下面的语句,会报错:Type handler was null on parameter mapping for property '__frch_item_0'。
总结。物理删除只能通过主键Id,或者条件语句删除,无法像updateById操作一样直接放实体类进去
标签:return,list,wrapperFile,CURD,ContractWorkFile,fielIds,MybatisPlus From: https://www.cnblogs.com/zheng-s/p/17692923.html