c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
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
|
package com.objecteye.controller;
import com.objecteye.common.CommonResult;
import com.objecteye.entity.PageResult;
import com.objecteye.entity.UploadVehicleDbResult;
import com.objecteye.service.VehicleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/vehicle")
@Api(tags = "VehicleController", description = "车辆库车辆管理")
@CrossOrigin
public class VehicleController {
@Autowired
private VehicleService vehicleService;
@ApiOperation("车辆库上传多条数据")
@RequestMapping(value = "/uploadfiles", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
28
|
public CommonResult uploadfiles(MultipartFile[] uploadFiles, String vehicleId) {
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
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
|
if (uploadFiles != null && uploadFiles.length > 0) {
String msg = vehicleService.uploadFiles(uploadFiles, vehicleId);
if (null != msg) {
return CommonResult.success("操作成功", msg);
} else {
return null;
}
}
return CommonResult.failed("上传文件不能为空");
}
@ApiOperation("根据车库、车辆名进行分页查询车辆底库数据")
@RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findPage(@RequestParam int vehicleId, @RequestParam String picName, @RequestParam int currentpage, @RequestParam int pagevolume) {
PageResult page = vehicleService.findPage(vehicleId, picName, currentpage, pagevolume);
if (page.gettotal() == 0) {
return CommonResult.failed("车库无数据");
}
return CommonResult.success(page);
}
/**
* 批量删除
*
* @param map
* @return
*/
@ApiOperation("批量删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
68a67f36
Liu Haoyu
接口问题处理;
|
60
|
public CommonResult delete(@RequestBody Map<String, Object> map) {
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
61
|
try {
|
68a67f36
Liu Haoyu
接口问题处理;
|
62
|
List<String> ids = (List<String>) map.get("ids");
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
vehicleService.delete(ids);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 修改车辆名
*
* @param uploadVehicleDbResult
* @return
*/
@ApiOperation("修改车辆名")
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult update(@RequestBody UploadVehicleDbResult uploadVehicleDbResult) {
try {
vehicleService.update(uploadVehicleDbResult);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 根据车名检索
*
* @param uploadVehicleDbResult
* @return
*/
@ApiOperation("根据车名检索")
@RequestMapping(value = "/findByPicName", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findByPicName(@RequestBody UploadVehicleDbResult uploadVehicleDbResult) {
try {
List<UploadVehicleDbResult> uploadVehicleResultList = vehicleService.findByPicName(uploadVehicleDbResult);
return CommonResult.success(uploadVehicleResultList);
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
}
|