소스 검색

提交文件删除。

小么熊🐻 1 년 전
부모
커밋
784e184414

+ 1 - 14
nbjk-admin/src/main/java/com/miaxis/app/controller/feed/FeedBackController.java

@@ -61,7 +61,6 @@ public class FeedBackController extends BaseController{
     /**
      * 新增意见反馈
      */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.INSERT)
     @PostMapping
     @ApiOperation("新增意见反馈")
     public Response<Integer> add(@RequestBody FeedBack feedBack){
@@ -71,23 +70,11 @@ public class FeedBackController extends BaseController{
     /**
      * 修改意见反馈
      */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.UPDATE)
     @PutMapping
     @ApiOperation("修改意见反馈")
     public Response<Integer> edit(@RequestBody FeedBack feedBack){
         return toResponse(feedBackService.updateById(feedBack) ? 1 : 0);
     }
 
-    /**
-     * 删除意见反馈
-     */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.DELETE)
-	@DeleteMapping("/{ids}")
-    @ApiOperation("删除意见反馈")
-    public  Response<Integer> remove(
-            @ApiParam(name = "ids", value = "意见反馈ids参数", required = true)
-            @PathVariable Long[] ids
-    ){
-        return toResponse(feedBackService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
-    }
+
 }

+ 2 - 0
nbjk-admin/src/main/java/com/miaxis/app/controller/file/FileInfoController.java

@@ -76,4 +76,6 @@ public class FileInfoController extends BaseController{
         return fileInfoService.fileUp(businessType,coverFiles);
     }
 
+
+
 }

+ 15 - 4
nbjk-admin/src/main/java/com/miaxis/pc/controller/PcFeedBackController.java

@@ -58,7 +58,6 @@ public class PcFeedBackController extends BaseController{
     /**
      * 新增意见反馈
      */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.INSERT)
     @PostMapping
     @ApiOperation("新增意见反馈")
     public Response<Integer> add(@RequestBody FeedBack feedBack){
@@ -68,7 +67,6 @@ public class PcFeedBackController extends BaseController{
     /**
      * 修改意见反馈
      */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.UPDATE)
     @PutMapping
     @ApiOperation("修改意见反馈")
     public Response<Integer> edit(@RequestBody FeedBack feedBack){
@@ -77,8 +75,7 @@ public class PcFeedBackController extends BaseController{
 
     /**
      * 删除意见反馈
-     */
-    @Log(title = "意见反馈", businessType = BusinessTypeEnum.DELETE)
+
 	@DeleteMapping("/{ids}")
     @ApiOperation("删除意见反馈")
     public  Response<Integer> remove(
@@ -87,4 +84,18 @@ public class PcFeedBackController extends BaseController{
     ){
         return toResponse(feedBackService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
     }
+     */
+    /**
+     * 删除意见反馈
+     */
+    @DeleteMapping("/{ids}")
+    @ApiOperation("删除意见反馈")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "意见反馈ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(feedBackService.delByIds(ids) ? 1 : 0);
+        //return toResponse(feedBackService.delByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+
 }

+ 4 - 1
nbjk-service/src/main/java/com/miaxis/feed/mapper/FeedBackMapper.java

@@ -17,6 +17,9 @@ public interface FeedBackMapper extends BaseMapper<FeedBack> {
      * @param feedBack 意见反馈
      * @return 意见反馈集合
      */
-    public List<FeedBack> selectFeedBackList(FeedBack feedBack);
+    List<FeedBack> selectFeedBackList(FeedBack feedBack);
+
+
+    List<FeedBack> getFeedBackByIds(Long[] ids);
 
 }

+ 3 - 1
nbjk-service/src/main/java/com/miaxis/feed/service/IFeedBackService.java

@@ -17,5 +17,7 @@ public interface IFeedBackService extends IService<FeedBack>{
      * @param feedBack 意见反馈
      * @return 意见反馈集合
      */
-    public List<FeedBack> selectFeedBackList(FeedBack feedBack);
+    List<FeedBack> selectFeedBackList(FeedBack feedBack);
+
+    boolean delByIds(Long[] ids);
 }

+ 33 - 1
nbjk-service/src/main/java/com/miaxis/feed/service/impl/FeedBackServiceImpl.java

@@ -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;
+    }
 }

+ 11 - 0
nbjk-service/src/main/resources/mapper/feed/FeedBackMapper.xml

@@ -30,4 +30,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+
+    <select id="getFeedBackByIds"  parameterType="Long" resultType="com.miaxis.feed.domain.FeedBack">
+        <include refid="selectFeedBackVo"/>
+        <where>
+            and id in
+            <foreach collection="array" item="id" index="index" open="(" close=")" separator=",">
+                #{id}
+            </foreach>
+        </where>
+    </select>
+
 </mapper>