SjUserController.java
2.09 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
package com.server.web.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.server.web.common.model.PageModel;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用户管理
*/
@RestController
@RequestMapping(BaseController.OSS_NAMESPACE + "/sjuser")
public class SjUserController extends BaseController {
/**
* 用户列表
* @param fullName
* @param nickName
* @param department
* @param phone
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping(path = "/list", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map list(@RequestParam(defaultValue = "") String fullName,@RequestParam(defaultValue = "") String nickName,
@RequestParam(defaultValue = "") String department,@RequestParam(defaultValue = "") String phone
,@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize) {
try {
Map paramMap = new HashMap<>();
if(!("").equals(fullName)){
paramMap.put("fullName","%"+fullName+"%");
}
if(!("").equals(nickName)){
paramMap.put("nickName","%"+nickName+"%");
}
if(!("").equals(department)){
paramMap.put("department","%"+department+"%");
}
if(!("").equals(phone)){
paramMap.put("phone",phone);
}
PageHelper.startPage(pageNo,pageSize,true,false);
List list = openSqlRingsService.selectList_Rings("com.mapping.queryModel.queryUser",paramMap);
PageInfo pageInfo = new PageInfo(list);
PageModel model = new PageModel();
model.setTotal(pageInfo.getTotal());
model.setList(list);
return success(model);
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
}