c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
package com.objecteye.controller;
import com.objecteye.common.CommonResult;
import com.objecteye.entity.PageResult;
import com.objecteye.entity.SyPersonnel;
import com.objecteye.service.PersonnelService;
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;
|
68a67f36
Liu Haoyu
接口问题处理;
|
14
|
import java.util.List;
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
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
|
import java.util.Map;
/**
* controller
*
* @author Administrator
*/
@RestController
@RequestMapping("/personnel")
@Api(tags = "PersonnelController", description = "人像库人像管理")
@CrossOrigin
public class PersonnelController {
@Autowired
private PersonnelService personnelService;
/**
* 上传图片
*
* @param uploadFiles
* @param featureId
* @return
*/
@ApiOperation("人像库上传多条数据")
@RequestMapping(value = "/uploadfiles", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
|
40c853a1
Liu Haoyu
去掉MySQL相关内容, 去掉my...
|
42
|
public CommonResult uploadfiles(MultipartFile[] uploadFiles, @RequestParam(name = "featureId") String featureId) {
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
String msg = personnelService.uploadFiles(uploadFiles, featureId);
if (uploadFiles != null && uploadFiles.length > 0) {
if (null != msg) {
return CommonResult.success("操作成功", msg);
} else {
return null;
}
}
return CommonResult.failed("上传文件不能为空");
}
/**
* 修改
*
* @param personnel
* @return
*/
@ApiOperation("更新单条人像信息")
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult update(@RequestBody SyPersonnel personnel) {
try {
personnelService.update(personnel);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 获取实体
*
* @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
|
SyPersonnel one = personnelService.findOne(id);
if (one != null) {
return CommonResult.success(one);
}
return CommonResult.success("", "id无效");
}
/**
* 批量删除
*
* @param map
* @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
119
120
121
122
|
personnelService.delete(ids);
return CommonResult.success("操作成功");
} catch (Exception e) {
e.printStackTrace();
return CommonResult.failed();
}
}
/**
* 查询+分页
*
* @param
* @return
*/
@ApiOperation("根据人像库、人像名、人像创建时间进行分页查询人像底库数据")
@RequestMapping(value = "/search", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public CommonResult search(@RequestParam int currentpage, @RequestParam int pagevolume, @RequestParam int fid, @RequestParam String name) {//@RequestBody PagePara<SyPersonnel> pagePara
PageResult page = personnelService.findPage(fid, name, currentpage, pagevolume);
|
c83b5b39
Liu Haoyu
项目创建, 集成spring-se...
|
123
124
125
126
127
128
129
130
|
if (page.gettotal() == 0) {
return CommonResult.failed("无符合条件的数据");
}
return CommonResult.success(page);
}
}
|