cloudroam
2024-12-04 6c823dd44dbde79f008001a2a11e7bf9bc6bf8cc
src/main/java/com/mzl/flower/web/flower/FlowerMarkupPlController.java
@@ -4,8 +4,11 @@
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;
@@ -17,7 +20,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
@RestController
@RequestMapping("/api/flower/markup/pl")
@@ -30,19 +32,26 @@
    private FlowerMarkupPlService plService;
    @PostMapping("/list/new")
    @OperationLog(value = "新增平台区间加价", type = "markup_p_i")
    @ApiOperation(value = "新增平台区间加价")
    public ResponseEntity<ReturnDataDTO> addMarkupPl(@RequestBody FlowerMarkupPlCreateDTO dto) {
        Long id = plService.addMarkupPl(dto);
        plService.updateCache();
        return returnData(R.SUCCESS.getCode(), id);
        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<ReturnDataDTO> updateMarkupPl(@RequestBody FlowerMarkupPlUpdateDTO dto) {
        Long id = plService.updateMarkupPl(dto);
        plService.updateCache();
        return returnData(R.SUCCESS.getCode(), id);
        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")
@@ -61,14 +70,18 @@
    }
    @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<ReturnDataDTO<?>> deleteMarkupPl(Long id){
        FlowerMarkupPl flowerMarkupPl = plService.selectMarkupPlById(id);
        plService.deleteMarkupPl(id);
        plService.updateCache();
        return returnData(R.SUCCESS.getCode(), null);
        String content = "删除平台区间加价:id:【" + id + "】,价格区间:【" + flowerMarkupPl.getLowerPrice() + "】~【" + flowerMarkupPl.getUpperPrice() + "】,加价:【" + flowerMarkupPl.getFee() + "】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null, operationRecord);
    }
}