SysFileController.java
2.03 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
61
62
63
64
package cn.com.glsx.smart.modules.controller;
import java.util.List;
import java.util.Map;
import cn.com.glsx.smart.modules.model.request.SmartSysFileReq;
import cn.com.glsx.smart.modules.service.SmartSysFileService;
import com.glsx.plat.core.web.R;
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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <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;
@GetMapping("/getList")
@ApiOperation(value = "查询图片")
public R findAll(@RequestParam("type") Byte type) {
return R.ok().data(sysFileService.findByType(type));
}
@PostMapping("/batchSaveFile")
@ApiOperation(value = "批量保存图片")
public R saveFile(@RequestBody List<SmartSysFileReq> reqList) {
List<Map<String, Object>> mapList = null;
try {
mapList = sysFileService.saveFile(reqList);
} catch (Exception e) {
log.error("批量保存图片失败:", e);
return R.error();
}
return R.ok().data(mapList);
}
@PostMapping("/saveFile")
@ApiOperation(value = "保存更新图片")
public R updateFile(@RequestBody SmartSysFileReq req) {
try {
return R.ok().data(sysFileService.updateFile(req));
} catch (Exception e) {
log.error("保存更新图片失败:", e);
return R.error();
}
}
}