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.BatchDTO;
|
import com.mzl.flower.dto.request.point.PointGoodDTO;
|
import com.mzl.flower.dto.request.point.PointGoodQueryDTO;
|
import com.mzl.flower.dto.response.point.PointGoodVO;
|
import com.mzl.flower.service.point.PointGoodService;
|
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/point")
|
@Api(value = "积分商品管理", tags = "积分商品管理")
|
@Validated
|
@Slf4j
|
@RequiredArgsConstructor
|
public class PointGoodController extends BaseController {
|
|
|
private final PointGoodService pointGoodService;
|
|
|
|
@PostMapping("/good/save")
|
@ApiOperation(value = "新增", notes = "新增")
|
public ResponseEntity<ReturnDataDTO> save(@Validated @RequestBody PointGoodDTO pointGoodDTO) {
|
pointGoodService.save(pointGoodDTO);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
@PostMapping("/good/update")
|
@ApiOperation(value = "修改", notes = "修改")
|
public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody PointGoodDTO pointGoodDTO) {
|
pointGoodService.update(pointGoodDTO);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
@PostMapping("/good/delete/batch")
|
@ApiOperation(value = "批量删除", notes = "批量删除")
|
public ResponseEntity<ReturnDataDTO> batchDelete(@Validated @RequestBody BatchDTO dto) {
|
pointGoodService.batchDelete(dto);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
@PostMapping("/good/publish/batch")
|
@ApiOperation(value = "批量上架", notes = "批量上架")
|
public ResponseEntity<ReturnDataDTO> batchPublish(@Validated @RequestBody BatchDTO dto) {
|
pointGoodService.batchPublish(dto);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
@PostMapping("/good/off/batch")
|
@ApiOperation(value = "批量下架", notes = "批量下架")
|
public ResponseEntity<ReturnDataDTO> batchoff(@Validated @RequestBody BatchDTO dto) {
|
pointGoodService.batchOff(dto);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
|
@GetMapping("/good/delete")
|
@ApiOperation(value = "删除", notes = "删除")
|
public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) {
|
pointGoodService.delete(id);
|
return returnData(R.SUCCESS.getCode(),null);
|
}
|
|
|
@GetMapping("/good/copy")
|
@ApiOperation(value = "复制", notes = "复制")
|
public ResponseEntity<ReturnDataDTO> copy(@NotNull(message = "id不能为空") Long id) {
|
pointGoodService.delete(id);
|
return returnData(R.SUCCESS.getCode(), null);
|
}
|
|
@GetMapping("/good/view")
|
@ApiOperation(value = "详情", notes = "详情")
|
public ResponseEntity<ReturnDataDTO<PointGoodVO>> detail(@NotNull(message = "id不能为空") Long id) {
|
return returnData(R.SUCCESS.getCode(),pointGoodService.detail(id));
|
}
|
|
@GetMapping("/good/page")
|
@ApiOperation(value = "查询-分页", notes = "查询-分页")
|
public ResponseEntity<ReturnDataDTO<Page<PointGoodVO>>> queryPage(PointGoodQueryDTO dto, Page page) {
|
return returnData(R.SUCCESS.getCode(), pointGoodService.queryPage(dto,page));
|
}
|
|
@GetMapping("/good/changeStatus")
|
@ApiOperation(value = "修改上架下架状态", notes = "修改上架下架状态")
|
public ResponseEntity<ReturnDataDTO> changeStatus(@NotNull(message = "id不能为空") Long id) {
|
pointGoodService.changeStatus(id);
|
return returnData(R.SUCCESS.getCode(), null);
|
}
|
}
|