|
@@ -1,10 +1,15 @@
|
|
|
package com.miaxis.feed.service.impl;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.miaxis.common.utils.DateUtils;
|
|
|
+import com.miaxis.file.domain.FileInfo;
|
|
|
+import com.miaxis.file.mapper.FileInfoMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -23,6 +28,9 @@ public class FeedBackServiceImpl extends ServiceImpl<FeedBackMapper, FeedBack> i
|
|
|
@Autowired
|
|
|
private FeedBackMapper feedBackMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FileInfoMapper fileInfoMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询意见反馈列表
|
|
|
*
|
|
@@ -30,7 +38,31 @@ public class FeedBackServiceImpl extends ServiceImpl<FeedBackMapper, FeedBack> i
|
|
|
* @return 意见反馈
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<FeedBack> selectFeedBackList(FeedBack feedBack){
|
|
|
+ public List<FeedBack> selectFeedBackList(FeedBack feedBack) {
|
|
|
return feedBackMapper.selectFeedBackList(feedBack);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean delByIds(Long[] ids) {
|
|
|
+ List<FeedBack> feedBackList = feedBackMapper.getFeedBackByIds(ids);
|
|
|
+ for (FeedBack feedBack : feedBackList) {
|
|
|
+ String imgIds = feedBack.getImgIds();
|
|
|
+ //转成Long[]
|
|
|
+ String[] stringArray = imgIds.split(",");
|
|
|
+ Long[] imgIdArray = new Long[stringArray.length];
|
|
|
+ for (int i = 0; i < stringArray.length; i++) {
|
|
|
+ imgIdArray[i] = Long.parseLong(stringArray[i]);
|
|
|
+ }
|
|
|
+ List<FileInfo> fileList = fileInfoMapper.getFileInfoByIds(imgIdArray);
|
|
|
+ //删除文件
|
|
|
+ for (FileInfo fileInfo : fileList) {
|
|
|
+ File file = new File(fileInfo.getFilePath());
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ //删除DB文件数据
|
|
|
+ fileInfoMapper.deleteBatchIds(Arrays.asList(imgIdArray));
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|