CustomerMgrController.java
2.63 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
72
73
74
75
76
77
78
79
80
81
82
package com.glsx.controller;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.com.glsx.openplatform.service.CustomerMgrService;
import cn.com.glsx.openplatform.vo.R;
import cn.hutool.db.Page;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
//@Api
@RestController
@RequestMapping(value = "/customermgr")
public class CustomerMgrController {
/**
* 日志
*/
private final static Logger LOGGER = LoggerFactory.getLogger(CustomerMgrController.class);
@Autowired
private CustomerMgrService customerMgrService;
@RequestMapping(value = "/getCustomerMgrList", method = RequestMethod.GET)
@ResponseBody
public R getCustomerMgrList(Page page) {
return customerMgrService.getCustomerMgrList(page);
}
@RequestMapping(value = "/reset", method = RequestMethod.GET)
@ResponseBody
public R reset(int id) {
int num = customerMgrService.reset(id);
if (num == 0) {
return R.error("重置密码失败");
}
return R.ok("重置的密码成功");
}
@RequestMapping(value = "/startandstop", method = RequestMethod.GET)
@ResponseBody
public R startAndStop(int id, int status) {
int num = customerMgrService.startAndStop(id, status);
if (num == 0) {
return R.error("账号状态修改失败");
}
return R.ok("账号状态修改成功");
}
@RequestMapping(value = "/getAddressOptions", method = RequestMethod.GET)
@ResponseBody
public R getAddressOptions(int id) {
List<String> addressOptionList = customerMgrService.getAddressOptionList(id);
return R.ok().data(addressOptionList);
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
public R register(PlatformCustomer customer) {
int num = customerMgrService.register(customer);
if (num == 0) {
return R.error("注册失败");
}
return R.ok("注册成功");
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public R login(PlatformCustomer customer) {
int num = customerMgrService.login(customer);
if (num == 0) {
return R.error("登陆失败");
}
return R.ok("登陆成功");
}
}