请问一下,这个怎么打印批量删除文件的日志呀,麻烦各位大佬了。(膜拜)
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public ReturnHandler delMediaFile(int[] id) {
Upload upload = fileManageMapper.get(id.length);
String[] loginUser =userService.getUserToToken();
String time = DateUtil.formatDate(new Date(),DateUtil.YMDHMS_SIMPLE);
if (id.length > 1) {
mediaWarehouseMapper.deleteBatch(id);
int[] uploadIds = new int[id.length];
for(int i=0;i<id.length;i++){
MediaWarehouse mw = new MediaWarehouse();
mw.setId(id[i]);
List<MediaWarehouse> temps = mediaWarehouseMapper.findById(mw);
if (temps.size() > 0) uploadIds[i] = temps.get(0).getUploadId();
}
fileManageMapper.delete(uploadIds);
}else{
List<Integer> uploadIds = new ArrayList<>();
List<Integer> mws = new ArrayList<>();
mws.add(id[0]);
delParentId(id[0],uploadIds,mws);
if(uploadIds.size() > 0) fileManageMapper.delete(Arrays.stream(uploadIds.toArray(new Integer[0])).mapToInt(Integer::valueOf).toArray());
if(mws.size() > 0) mediaWarehouseMapper.deleteBatch(Arrays.stream(mws.toArray(new Integer[0])).mapToInt(Integer::valueOf).toArray());
}
String remark = loginUser[0] + "用户: 在" +time+ "删除了媒体库文件,名为: 【" +upload.getFileName()+ "】的操作";
logService.save(loginUser,"删除媒体库文件",this.getClass().getName()+".delete",remark);
return ReturnUtil.OK();
}