AdministerController.java
2.87 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
65
66
67
68
69
70
71
package com.zhongzhi.controller;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.administer.AdministerPageDTO;
import com.zhongzhi.dto.administer.LoginDTO;
import com.zhongzhi.model.AdministerDO;
import com.zhongzhi.service.AdministerService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
/**
* <p>
* 中心管理账户表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-04-28
*/
@RestController
@Api(tags = "中心管理账户")
@RequestMapping("/administer")
public class AdministerController {
@Autowired
private AdministerService administerService;
@PostMapping(value = "/login")
@ApiOperation("中心端 --- 登录:手机号/telephone, code/验证码")
public ResponseVO login(@RequestBody LoginDTO loginDTO) {
return ResponseData.generateCreatedResponse(0, administerService.login(loginDTO));
}
@PostMapping(value = "/getAdministerPage")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 成员管理分页查询:listItem/角色、 username/搜索名称、pageNo/当前页数、pageSize/每页显示条数")
public ResponseVO getAdministerPage(@RequestBody AdministerPageDTO administerPageDTO) {
return ResponseData.generateCreatedResponse(0, administerService.getAdministerPage(administerPageDTO));
}
@PostMapping(value = "/createAdminister")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 新增成员:username/名称、telephone/手机号、avatar/头像、role/角色")
public ResponseVO createAdminister(@RequestBody AdministerDO administerDO) {
administerService.save(administerDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/updateAdminister")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 编辑成员:id/成员ID、username/名称、telephone/手机号、avatar/头像、role/角色")
public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO) {
administerService.updateById(administerDO);
return ResponseData.generateCreatedResponse(0);
}
@PostMapping(value = "/deleteById")
@LoginRequired({Platform.center})
@ApiOperation("中心端 --- 删除成员:id/成员ID")
public ResponseVO delete(@RequestBody AdministerDO administerDO) {
administerService.removeById(administerDO.getId());
return ResponseData.generateCreatedResponse(0);
}
}