package com.mzl.flower.web.flower; 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.base.annotation.OperationLog; import com.mzl.flower.dto.request.flower.*; import com.mzl.flower.dto.response.flower.FlowerMarkupPlDTO; import com.mzl.flower.entity.flower.FlowerMarkupPl; import com.mzl.flower.entity.log.OperationRecord; import com.mzl.flower.service.flower.FlowerMarkupPlService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/flower/markup/pl") @Api(value = "平台区间加价管理", tags = "平台区间加价管理") @Validated @Slf4j public class FlowerMarkupPlController extends BaseController { @Autowired private FlowerMarkupPlService plService; @PostMapping("/list/new") @OperationLog(value = "新增平台区间加价", type = "markup_p_i") @ApiOperation(value = "新增平台区间加价") public ResponseEntity addMarkupPl(@RequestBody FlowerMarkupPlCreateDTO dto) { Long id = plService.addMarkupPl(dto); plService.updateCache(); String content = "新增平台区间加价价格区间:【" + dto.getLowerPrice() + "】~【"+dto.getUpperPrice()+"】,加价:【" + dto.getFee() + "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), id, operationRecord); } @PostMapping("/list/edit") @OperationLog(value = "编辑平台区间加价", type = "markup_p_i") @ApiOperation(value = "编辑平台区间加价") public ResponseEntity updateMarkupPl(@RequestBody FlowerMarkupPlUpdateDTO dto) { Long id = plService.updateMarkupPl(dto); plService.updateCache(); String content = "编辑平台区间加价id:【"+dto.getId()+"】,价格区间:【" + dto.getLowerPrice() + "】~【"+dto.getUpperPrice()+"】,加价:【" + dto.getFee() + "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), id, operationRecord); } @GetMapping("/list/view") @ApiOperation(value = "查询平台区间加价详情") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "平台区间加价id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity> getMarkupPl(Long id){ return returnData(R.SUCCESS.getCode(), plService.getMarkupPl(id)); } @GetMapping("/list") @ApiOperation(value = "获取平台区间加价列表") public ResponseEntity>> selectMarkupPlList(){ return returnData(R.SUCCESS.getCode(), plService.selectMarkupPlList()); } @GetMapping("/list/delete") @OperationLog(value = "删除平台区间加价", type = "markup_p_i") @ApiOperation(value = "删除平台区间加价") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "平台区间加价id", required = true, dataType = "String", paramType = "query") }) public ResponseEntity> deleteMarkupPl(Long id){ FlowerMarkupPl flowerMarkupPl = plService.selectMarkupPlById(id); plService.deleteMarkupPl(id); plService.updateCache(); String content = "删除平台区间加价:id:【" + id + "】,价格区间:【" + flowerMarkupPl.getLowerPrice() + "】~【" + flowerMarkupPl.getUpperPrice() + "】,加价:【" + flowerMarkupPl.getFee() + "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), null, operationRecord); } }