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));
|
}
|
|
|
}
|