Cui Zhi Feng
2024-08-29 9f1412bc3afa8f16d13d9948b547c8748e02869a
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.mzl.flower.web.point;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.request.point.CustomerPointDetailDTO;
import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO;
import com.mzl.flower.dto.response.point.CustomerPointDetailVO;
import com.mzl.flower.service.point.CustomerPointDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotNull;
 
@RestController
@RequestMapping("/api/customer")
@Api(value = "用户积分记录", tags = "用户积分记录")
@Validated
@Slf4j
@RequiredArgsConstructor
public class CustomerPointDetailController extends BaseController {
 
    private final CustomerPointDetailService customerPointDetailService;
 
 
    @PostMapping("/point/save")
    @ApiOperation(value = "新增", notes = "新增")
    public ResponseEntity<ReturnDataDTO> save(@Validated @RequestBody CustomerPointDetailDTO customerPointDetailDTO) {
        customerPointDetailService.save(customerPointDetailDTO);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
    @PostMapping("/point/update")
    @ApiOperation(value = "修改", notes = "修改")
    public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CustomerPointDetailDTO customerPointDetailDTO) {
        customerPointDetailService.update(customerPointDetailDTO);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
 
    @GetMapping("/point/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) {
        customerPointDetailService.delete(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
 
    @GetMapping("/point/page")
    @ApiOperation(value = "查询-分页", notes = "查询-分页")
    public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailVO>>> queryPage(CustomerPointDetailQueryDTO dto, Page page) {
        return returnData(R.SUCCESS.getCode(), customerPointDetailService.queryPage(dto, page));
    }
 
 
}