|
@@ -1,12 +1,16 @@
|
1
|
1
|
package com.yunzhi.marketing.xlk.controller;
|
2
|
2
|
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
3
|
4
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
5
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
6
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
7
|
import com.yunzhi.marketing.base.BaseController;
|
7
|
8
|
import com.yunzhi.marketing.base.ResponseBean;
|
|
9
|
+import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
|
8
|
10
|
import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
|
9
|
11
|
import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
|
|
12
|
+import io.swagger.annotations.Api;
|
|
13
|
+import io.swagger.annotations.ApiOperation;
|
10
|
14
|
import org.slf4j.Logger;
|
11
|
15
|
import org.slf4j.LoggerFactory;
|
12
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,7 +25,8 @@ import org.springframework.web.bind.annotation.*;
|
21
|
25
|
* @since 2021-07-19
|
22
|
26
|
*/
|
23
|
27
|
@RestController
|
24
|
|
-@RequestMapping("/")
|
|
28
|
+@RequestMapping("/api")
|
|
29
|
+@Api(value = "渠道报备客户表", tags = "xlk-渠道报备客户表")
|
25
|
30
|
public class ChannelCustomerController extends BaseController {
|
26
|
31
|
|
27
|
32
|
private final Logger logger = LoggerFactory.getLogger(ChannelCustomerController.class);
|
|
@@ -36,15 +41,17 @@ public class ChannelCustomerController extends BaseController {
|
36
|
41
|
* @param pageSize
|
37
|
42
|
* @return
|
38
|
43
|
*/
|
39
|
|
- @RequestMapping(value="/channelCustomer",method= RequestMethod.GET)
|
|
44
|
+ @ApiOperation(value = "admin-渠道报备客户表", notes = "admin-渠道报备客户表")
|
|
45
|
+ @RequestMapping(value="/admin/channelCustomer",method= RequestMethod.GET)
|
40
|
46
|
public ResponseBean channelCustomerList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
41
|
47
|
@RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
42
|
48
|
ResponseBean responseBean = new ResponseBean();
|
43
|
49
|
try {
|
44
|
50
|
//使用分页插件
|
45
|
51
|
IPage<ChannelCustomer> pg = new Page<>(pageNum, pageSize);
|
46
|
|
- QueryWrapper<ChannelCustomer> queryWrapper = new QueryWrapper<>();
|
47
|
|
- queryWrapper.orderByDesc("create_date");
|
|
52
|
+ LambdaQueryWrapper<ChannelCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
|
53
|
+ queryWrapper.eq(ChannelCustomer::getStatus,"1");
|
|
54
|
+ queryWrapper.orderByDesc(ChannelCustomer::getCreateDate);
|
48
|
55
|
|
49
|
56
|
IPage<ChannelCustomer> result = iChannelCustomerService.page(pg, queryWrapper);
|
50
|
57
|
responseBean.addSuccess(result);
|
|
@@ -57,78 +64,23 @@ public class ChannelCustomerController extends BaseController {
|
57
|
64
|
}
|
58
|
65
|
|
59
|
66
|
/**
|
60
|
|
- * 保存对象
|
61
|
|
- * @param channelCustomer 实体对象
|
62
|
|
- * @return
|
63
|
|
- */
|
64
|
|
- @RequestMapping(value="/channelCustomer",method= RequestMethod.POST)
|
65
|
|
- public ResponseBean channelCustomerAdd(@RequestBody ChannelCustomer channelCustomer){
|
66
|
|
- ResponseBean responseBean = new ResponseBean();
|
67
|
|
- try {
|
68
|
|
- if (iChannelCustomerService.save(channelCustomer)){
|
69
|
|
- responseBean.addSuccess(channelCustomer);
|
70
|
|
- }else {
|
71
|
|
- responseBean.addError("fail");
|
72
|
|
- }
|
73
|
|
- }catch (Exception e){
|
74
|
|
- e.printStackTrace();
|
75
|
|
- logger.error("channelCustomerAdd -=- {}",e.toString());
|
76
|
|
- responseBean.addError(e.getMessage());
|
77
|
|
- }
|
78
|
|
- return responseBean;
|
79
|
|
- }
|
80
|
|
-
|
81
|
|
- /**
|
82
|
|
- * 根据id删除对象
|
83
|
|
- * @param id 实体ID
|
84
|
|
- */
|
85
|
|
- @ResponseBody
|
86
|
|
- @RequestMapping(value="/channelCustomer/{id}", method= RequestMethod.DELETE)
|
87
|
|
- public ResponseBean channelCustomerDelete(@PathVariable Integer id){
|
88
|
|
- ResponseBean responseBean = new ResponseBean();
|
89
|
|
- try {
|
90
|
|
- if(iChannelCustomerService.removeById(id)){
|
91
|
|
- responseBean.addSuccess("success");
|
92
|
|
- }else {
|
93
|
|
- responseBean.addError("fail");
|
94
|
|
- }
|
95
|
|
- }catch (Exception e){
|
96
|
|
- e.printStackTrace();
|
97
|
|
- logger.error("channelCustomerDelete -=- {}",e.toString());
|
98
|
|
- responseBean.addError(e.getMessage());
|
99
|
|
- }
|
100
|
|
- return responseBean;
|
101
|
|
- }
|
102
|
|
-
|
103
|
|
- /**
|
104
|
|
- * 修改对象
|
|
67
|
+ * 审核
|
105
|
68
|
* @param id 实体ID
|
106
|
|
- * @param channelCustomer 实体对象
|
|
69
|
+ * @param channelCustomerDTO 实体对象
|
107
|
70
|
* @return
|
108
|
71
|
*/
|
109
|
|
- @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.PUT)
|
|
72
|
+ @ApiOperation(value = "admin-渠道报备客户审核", notes = "admin-渠道报备客户审核")
|
|
73
|
+ @RequestMapping(value="/admin/channelCustomer/{id}",method= RequestMethod.PUT)
|
110
|
74
|
public ResponseBean channelCustomerUpdate(@PathVariable Integer id,
|
111
|
|
- @RequestBody ChannelCustomer channelCustomer){
|
112
|
|
- ResponseBean responseBean = new ResponseBean();
|
113
|
|
- try {
|
114
|
|
- if (iChannelCustomerService.updateById(channelCustomer)){
|
115
|
|
- responseBean.addSuccess(channelCustomer);
|
116
|
|
- }else {
|
117
|
|
- responseBean.addError("fail");
|
118
|
|
- }
|
119
|
|
- }catch (Exception e){
|
120
|
|
- e.printStackTrace();
|
121
|
|
- logger.error("channelCustomerUpdate -=- {}",e.toString());
|
122
|
|
- responseBean.addError(e.getMessage());
|
123
|
|
- }
|
124
|
|
- return responseBean;
|
|
75
|
+ @RequestBody ChannelCustomerDTO channelCustomerDTO){
|
|
76
|
+ return iChannelCustomerService.auditCustomer(id,channelCustomerDTO);
|
125
|
77
|
}
|
126
|
78
|
|
127
|
79
|
/**
|
128
|
80
|
* 根据id查询对象
|
129
|
81
|
* @param id 实体ID
|
130
|
82
|
*/
|
131
|
|
- @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.GET)
|
|
83
|
+ @RequestMapping(value="/admin/channelCustomer/{id}",method= RequestMethod.GET)
|
132
|
84
|
public ResponseBean channelCustomerGet(@PathVariable Integer id){
|
133
|
85
|
ResponseBean responseBean = new ResponseBean();
|
134
|
86
|
try {
|