@Override
public String deleteAlbum(String[] ids) {
StringBuilder deleteNames = new StringBuilder();
if (ids == null || ids.length == 0) {
return deleteNames.toString();
}
for (String id : ids) {
PhotoAlbum bean = this.loadAlbum(id);
//删除相册
this.photoAlbumDao.delete(bean);
// 删除图片
// 获取相册下的图片附件
List<SysAttach> attaches = this.attachService.selectAttachList("com.operate.entity.PhotoAlbum", id);
// 获取附件ids
String[] attachIds = new String[attaches.size()];
int i = 0;
for(SysAttach arr: attaches) {
attachIds[i++] = arr.getAttachId();
}
// 删除图片附件
this.attachService.deleteAttach(attachIds);
//返回删除的相册名称
deleteNames.append(bean.getTitle()).append(" 、");
}
if (deleteNames.length() > 0) {
deleteNames.deleteCharAt(deleteNames.length() - 1);
}
return deleteNames.toString();
}