SysFileController.java
1.79 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.glsx.smart.controller;
import com.glsx.plat.core.web.R;
import com.glsx.smart.pojo.FileDTO;
import com.glsx.smart.service.SmartSysFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
@Slf4j
@RestController
@RequestMapping("/sysFile")
@Api(value = "图片管理", tags = {"图片管理"})
public class SysFileController {
@Autowired
private SmartSysFileService sysFileService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET})
@ApiOperation(value = "查询图片")
public R findAll(@RequestParam("type") Byte type) {
return R.ok().data(sysFileService.findByType(type));
}
@RequestMapping(value = "/batchSaveFile", method = {RequestMethod.POST})
@ApiOperation(value = "批量保存图片")
public R saveFile(@RequestBody List<FileDTO> files) {
List<Map<String, Object>> mapList = null;
try {
mapList = sysFileService.saveFile(files);
} catch (Exception e) {
log.error("批量保存图片失败:", e);
return R.error();
}
return R.ok().data(mapList);
}
@RequestMapping(value = "/saveFile", method = {RequestMethod.POST})
@ApiOperation(value = "保存更新图片")
public R updateFile(@RequestBody FileDTO fileDTO) {
try {
return R.ok().data(sysFileService.updateFile(fileDTO));
} catch (Exception e) {
log.error("保存更新图片失败:", e);
return R.error();
}
}
}