package com.ruoyi.web.controller.api;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.system.model.TPhysicalGoods;
|
import com.ruoyi.system.model.TPhysicalGoodsOrder;
|
import com.ruoyi.system.query.BigGiftPackageQuery;
|
import com.ruoyi.system.service.TPhysicalGoodsOrderService;
|
import com.ruoyi.system.service.TPhysicalGoodsService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.apache.poi.ss.formula.functions.T;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 实物商品订单 前端控制器
|
* </p>
|
*
|
* @author xiaochen
|
* @since 2025-12-08
|
*/
|
@RestController
|
@RequestMapping("/t-physical-goods-order")
|
@Api(tags = "(嘉视达)实物商品订单")
|
public class TPhysicalGoodsOrderController {
|
private final TPhysicalGoodsOrderService tPhysicalGoodsOrderService;
|
private final TPhysicalGoodsService tPhysicalGoodsService;
|
|
public TPhysicalGoodsOrderController(TPhysicalGoodsOrderService tPhysicalGoodsOrderService, TPhysicalGoodsService tPhysicalGoodsService) {
|
this.tPhysicalGoodsOrderService = tPhysicalGoodsOrderService;
|
this.tPhysicalGoodsService = tPhysicalGoodsService;
|
}
|
|
|
@ApiOperation(value = "实物商品订单列表")
|
@PostMapping(value = "/pageList")
|
public R<Page<TPhysicalGoodsOrder>> pageList(@RequestBody BigGiftPackageQuery query) {
|
Page<TPhysicalGoodsOrder> page = tPhysicalGoodsOrderService.pageList(query);
|
return R.ok(page);
|
}
|
|
|
@ApiOperation(value = "实物商品订单详情")
|
@GetMapping(value = "/detail/{id}")
|
public R<TPhysicalGoodsOrder> detail(@PathVariable("id") Long id) {
|
TPhysicalGoodsOrder order = tPhysicalGoodsOrderService.getById(id);
|
TPhysicalGoods goods = tPhysicalGoodsService.getById(order.getPhysicalGoodsId());
|
order.setPhysicalGoodsName(goods.getName());
|
order.setPhysicalGoodsCover(goods.getCoverImage());
|
order.setPhysicalGoodsPrice(goods.getTotalPrice());
|
order.setPhysicalGoodsIntro(goods.getIntroduction());
|
return R.ok(order);
|
}
|
|
|
@ApiOperation(value = "实物商品订单编辑")
|
@PostMapping(value = "/edit")
|
@Log(title = "实物商品订单-编辑", businessType = BusinessType.UPDATE)
|
public R<String> edit(@RequestBody TPhysicalGoodsOrder order) {
|
TPhysicalGoodsOrder goodsOrder = tPhysicalGoodsOrderService.getById(order.getId());
|
if(goodsOrder.getStatus()!=1){
|
return R.fail("待付款状态才可以编辑");
|
}
|
goodsOrder.setOrderPrice(order.getOrderPrice());
|
|
boolean b = tPhysicalGoodsOrderService.updateById(goodsOrder);
|
return R.ok("操作成功");
|
}
|
|
|
@ApiOperation(value = "实物商品订单删除")
|
@DeleteMapping(value = "/delete/{id}")
|
@Log(title = "实物商品订单-删除", businessType = BusinessType.DELETE)
|
public R<String> delete(@PathVariable("id") Integer id) {
|
TPhysicalGoodsOrder order = tPhysicalGoodsOrderService.getById(id);
|
order.setDelFlag(1);
|
boolean b = tPhysicalGoodsOrderService.updateById(order);
|
return R.ok("操作成功");
|
}
|
|
|
|
}
|