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
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
|
package com.objecteye.controller;
import com.objecteye.common.CommonResult;
import com.objecteye.entity.PageResult;
import com.objecteye.entity.SyVehicleDb;
import com.objecteye.service.DeployService;
import com.objecteye.service.VehicleDbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* controller
*
* @author Administrator
*/
@RestController
@Api(tags = "VehicleDbController", description = "车辆库管理")
@RequestMapping("/vehicleDb")
@CrossOrigin
public class VehicleDbController {
@Autowired
private VehicleDbService vehicleDbService;
@Autowired
private DeployService deployService;
/**
* 返回全部列表
*
* @return
*/
@ApiOperation("分页返回全部车库")
@RequestMapping(value = "/findPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findPage(@RequestParam int currentpage, @RequestParam int pagevolume) {
PageResult page = vehicleDbService.findPage(currentpage, pagevolume);
if (page.gettotal() == 0) {
return CommonResult.failed("无符合条件的数据");
}
return CommonResult.success(page);
}
/**
* 增加
*
* @param vehicel
* @return
*/
@ApiOperation("添加车库")
@RequestMapping(value = "/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult add(@RequestBody SyVehicleDb vehicel) {
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
57
58
59
|
String id = vehicleDbService.add(vehicel);
if (id != null) {
return CommonResult.success(id);
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
60
61
62
63
64
65
66
67
68
69
70
|
}
return CommonResult.failed();
}
/**
* @param feature
* @return
*/
@ApiOperation("更新车库")
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult update(@RequestBody SyVehicleDb feature) {
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
71
72
|
vehicleDbService.update(feature);
return CommonResult.success(null);
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
73
74
75
76
77
78
79
80
81
82
|
}
/**
* 获取实体
*
* @param
* @return
*/
@ApiOperation("查找车库")
@RequestMapping(value = "/findOne", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
83
84
|
public CommonResult findOne(@RequestBody Map<String, Object> map) {
String id = (String) map.get("id");
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
SyVehicleDb feature = vehicleDbService.findOne(id);
if (feature != null) {
return CommonResult.success(feature);
}
return CommonResult.success("", "id无效");
}
/**
* 批量删除
*
* @param
* @return
*/
@ApiOperation("删除车库")
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
100
|
public CommonResult delete(@RequestBody Map<String, Object> map) {
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
101
|
try {
|
68a67f36
Liu Haoyu
接口问题处理;
|
102
|
List<String> ids = (List<String>) map.get("ids");
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
vehicleDbService.delete(ids);
return CommonResult.success("");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed(e.getMessage());
}
}
/**
* 判断车辆库是否被使用
*
* @param map 请求参数
* @return 操作状态
*/
@ApiOperation("判断车辆库是否被使用")
@RequestMapping(value = "/checkDelete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
119
120
|
public CommonResult checkDeleteByLibIdDeployType(@RequestBody Map<String, Object> map) {
List<String> deploys = deployService.getDeployListByLibAndDeployType((String) map.get("id"), 1);
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
if (deploys != null && deploys.size() > 0) {
return CommonResult.success(201, "存在布控任务使用该车辆库", "");
} else {
return CommonResult.success(200, "不存在布控任务使用该车辆库", "");
}
}
/**
* 人像库下拉框
*
* @return
*/
@ApiOperation("车库下拉框")
@RequestMapping(value = "/findAllName", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult findAllName() {
List<Map<String, String>> all = vehicleDbService.findAllName();
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
137
|
if (all.size() > 0) {
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
138
139
140
141
142
143
|
return CommonResult.success(all);
}
return CommonResult.success("", "车库为空");
}
}
|