goupan
2024-04-03 5506e9a45e717ffcb67ec313b5a4e8206d9b3a39
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package cn.stylefeng.roses.kernel.customer.modular.controller;
 
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
import cn.stylefeng.roses.kernel.customer.modular.request.CustomerRequest;
import cn.stylefeng.roses.kernel.customer.modular.service.CustomerService;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * C端用户表控制器
 *
 * @author fengshuonan
 * @date 2021/06/07 11:40
 */
//@Api(tags = "C端用户管理")
@RestController
@ApiResource(name = "C端用户管理")
public class CustomerManageController {
 
    @Resource
    private CustomerService customerService;
 
    /**
     * 添加
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    @PostResource(name = "添加", path = "/customer/add")
    @BusinessLog
    public ResponseData<?> add(@RequestBody @Validated(CustomerRequest.add.class) CustomerRequest customerRequest) {
        customerService.add(customerRequest);
        return new SuccessResponseData<>();
    }
 
    /**
     * 删除
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    @PostResource(name = "删除", path = "/customer/delete")
    @BusinessLog
    public ResponseData<?> delete(@RequestBody @Validated(CustomerRequest.delete.class) CustomerRequest customerRequest) {
        customerService.del(customerRequest);
        return new SuccessResponseData<>();
    }
 
    /**
     * 编辑
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    @PostResource(name = "编辑", path = "/customer/edit")
    @BusinessLog
    public ResponseData<?> edit(@RequestBody @Validated(CustomerRequest.edit.class) CustomerRequest customerRequest) {
        customerService.edit(customerRequest);
        return new SuccessResponseData<>();
    }
 
    /**
     * 查看详情
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    //@ApiOperation(value = "查看详情")
    @GetResource(name = "查看详情", path = "/customer/detail")
    public ResponseData<Customer> detail(@Validated(CustomerRequest.detail.class) CustomerRequest customerRequest) {
        return new SuccessResponseData<>(customerService.detail(customerRequest));
    }
 
    /**
     * 获取列表
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    //@ApiOperation(value = "获取列表")
    @GetResource(name = "获取列表", path = "/customer/list")
    public ResponseData<List<Customer>> list(CustomerRequest customerRequest) {
        return new SuccessResponseData<>(customerService.findList(customerRequest));
    }
 
    /**
     * 获取列表(带分页)
     *
     * @author fengshuonan
     * @date 2021/06/07 11:40
     */
    //@ApiOperation(value = "分页查询")
    @GetResource(name = "分页查询", path = "/customer/page")
    public ResponseData<PageResult<Customer>> page(CustomerRequest customerRequest) {
        return new SuccessResponseData<>(customerService.findPage(customerRequest));
    }
 
}