shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.iplatform.file.controller;
 
import com.iplatform.base.SystemController;
import com.iplatform.file.service.FileServiceImpl;
import com.iplatform.model.po.S_file;
import com.walker.db.page.GenericPager;
import com.walker.file.DefaultFileInfo;
import com.walker.web.ResponseValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
//@RestController
//@RequestMapping("/system/file")
@Deprecated
public class FileController extends SystemController {
 
    private FileServiceImpl fileService = null;
 
    @Autowired
    public FileController(FileServiceImpl fileService){
        this.fileService = fileService;
    }
 
    @GetMapping("/list")
    public ResponseValue list(DefaultFileInfo fileInfo){
        if(fileInfo == null){
            return ResponseValue.error("无法查询文件:没有条件");
        }
        GenericPager<S_file> pager = this.fileService.queryPageFileList(fileInfo.getFileName(), fileInfo.getFileExt(), fileInfo.getGroupId());
        return this.acquireTablePage(pager.getDatas(), pager.getTotalRows());
    }
 
    @RequestMapping("/remove/{fileId}")
    public ResponseValue remove(@PathVariable Long fileId){
        if(fileId == null || fileId.longValue() <= 0){
            return ResponseValue.error("文件id错误");
        }
        this.fileService.delete(new S_file(fileId));
        return ResponseValue.success();
    }
}