24282 2 лет назад
Родитель
Сommit
bc460b6efa

+ 3 - 2
hx-file/src/main/java/com/fjhx/file/controller/FileInfoController.java

@@ -8,6 +8,7 @@ import com.fjhx.file.entity.SingVo;
 import com.fjhx.file.service.FileInfoService;
 import com.ruoyi.common.constant.DatasourceConstant;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -35,7 +36,7 @@ public class FileInfoController {
      * 获取前端直传签名
      */
     @PostMapping("/getSing")
-    public SingVo getSing(@RequestBody SingDto dto) {
+    public SingVo getSing(@Validated @RequestBody SingDto dto) {
         return fileInfoService.getSing(dto);
     }
 
@@ -43,7 +44,7 @@ public class FileInfoController {
      * 文件表列表
      */
     @PostMapping("/getList")
-    public List<FileInfoVo> getList(@RequestBody FileInfoSelectDto dto) {
+    public List<FileInfoVo> getList(@Validated @RequestBody FileInfoSelectDto dto) {
         return fileInfoService.getList(dto);
     }
 

+ 3 - 1
hx-file/src/main/java/com/fjhx/file/entity/FileInfoSelectDto.java

@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.BaseSelectDto;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotEmpty;
 import java.util.List;
 
 /**
@@ -19,7 +20,8 @@ public class FileInfoSelectDto extends BaseSelectDto {
     /**
      * 文件id列表
      */
-    private List<Long> fileIdList;
+    @NotEmpty(message = "文件id列表不能为空")
+    private List<Long> businessIdList;
 
     /**
      * 文件类型

+ 3 - 0
hx-file/src/main/java/com/fjhx/file/entity/SingDto.java

@@ -3,6 +3,8 @@ package com.fjhx.file.entity;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+
 @Getter
 @Setter
 public class SingDto {
@@ -10,6 +12,7 @@ public class SingDto {
     /**
      * 文件名
      */
+    @NotBlank(message = "文件名称不能为空")
     private String fileName;
 
 }

+ 2 - 2
hx-file/src/main/java/com/fjhx/file/service/impl/FileInfoServiceImpl.java

@@ -114,12 +114,12 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     @Override
     public List<FileInfoVo> getList(FileInfoSelectDto dto) {
 
-        if (ObjectUtil.isEmpty(dto.getFileIdList())) {
+        if (ObjectUtil.isEmpty(dto.getBusinessIdList())) {
             return new ArrayList<>();
         }
 
         IWrapper<Object> wrapper = IWrapper.getWrapper();
-        wrapper.in("fi", FileInfo::getId, dto.getFileIdList());
+        wrapper.in("fi", FileInfo::getBusinessId, dto.getBusinessIdList());
         wrapper.eq("fi", FileInfo::getBusinessType, dto.getFileType());
         List<FileInfoVo> list = this.baseMapper.getList(wrapper);