mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
修改为jdk21可以使用虚拟线程
This commit is contained in:
parent
c7e5094a6b
commit
c6859d0ee9
@ -56,7 +56,7 @@ spring:
|
|||||||
threads:
|
threads:
|
||||||
# 开启虚拟线程 仅jdk21可用
|
# 开启虚拟线程 仅jdk21可用
|
||||||
virtual:
|
virtual:
|
||||||
enabled: false
|
enabled: true
|
||||||
# 资源信息
|
# 资源信息
|
||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
|
|||||||
@ -0,0 +1,105 @@
|
|||||||
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.system.service.IOrderService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/order")
|
||||||
|
public class OrderController extends BaseController {
|
||||||
|
|
||||||
|
private final IOrderService orderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<OrderVo> list(OrderBo bo, PageQuery pageQuery) {
|
||||||
|
return orderService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出订单明细列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:export")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(OrderBo bo, HttpServletResponse response) {
|
||||||
|
List<OrderVo> list = orderService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "订单明细", OrderVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取订单明细详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<OrderVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(orderService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:add")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody OrderBo bo) {
|
||||||
|
return toAjax(orderService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:edit")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OrderBo bo) {
|
||||||
|
return toAjax(orderService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除订单明细
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:order:remove")
|
||||||
|
@Log(title = "订单明细", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(orderService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("b_order")
|
||||||
|
public class Order extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
private String productImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
private Long sellingPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费
|
||||||
|
*/
|
||||||
|
private Long mailPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
private Long actualPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
private Long totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private Long refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
private String buyData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
private Date shipmentTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标志(0代表存在 1代表删除)
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细业务对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = Order.class, reverseConvertGenerate = false)
|
||||||
|
public class OrderBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "顾客姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "顾客电话不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "顾客id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "产品名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "产品图片不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String productImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
@NotNull(message = "销售价格不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long sellingPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费
|
||||||
|
*/
|
||||||
|
@NotNull(message = "邮费不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long mailPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
@NotNull(message = "实收价格不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long actualPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
@NotNull(message = "订单总额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
@NotNull(message = "退款金额不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "购买日期不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String buyData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "支付时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "发货时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Date shipmentTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "发货图片不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "快递单号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细视图对象 b_order
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = Order.class)
|
||||||
|
public class OrderVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "顾客姓名")
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客电话
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "顾客电话")
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顾客id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "顾客id")
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品名称")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品图片")
|
||||||
|
private String productImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "productImage")
|
||||||
|
private String productImageUrl;
|
||||||
|
/**
|
||||||
|
* 销售价格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "销售价格")
|
||||||
|
private Long sellingPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮费
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "邮费")
|
||||||
|
private Long mailPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实收价格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "实收价格")
|
||||||
|
private Long actualPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单总额")
|
||||||
|
private Long totalPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "退款金额")
|
||||||
|
private Long refundMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态(0未收款,1已收款,2已发货,3已签收,4已完成,5已取消,6申请退款,7申请退货,8退货已发货,9退货已签收,10退货成功)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "订单状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "order_status")
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买日期
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "购买日期")
|
||||||
|
private String buyData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "支付时间")
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "发货时间")
|
||||||
|
private Date shipmentTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "发货图片")
|
||||||
|
private String shipmentImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "shipmentImage")
|
||||||
|
private String shipmentImageUrl;
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "快递单号")
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface OrderMapper extends BaseMapperPlus<Order, OrderVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface IOrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 订单明细
|
||||||
|
*/
|
||||||
|
OrderVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 订单明细分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<OrderVo> queryPageList(OrderBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 订单明细列表
|
||||||
|
*/
|
||||||
|
List<OrderVo> queryList(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(OrderBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除订单明细信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.OrderBo;
|
||||||
|
import org.dromara.system.domain.vo.OrderVo;
|
||||||
|
import org.dromara.system.domain.Order;
|
||||||
|
import org.dromara.system.mapper.OrderMapper;
|
||||||
|
import org.dromara.system.service.IOrderService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class OrderServiceImpl implements IOrderService {
|
||||||
|
|
||||||
|
private final OrderMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单明细
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 订单明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 订单明细分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<OrderVo> queryPageList(OrderBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<Order> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<OrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的订单明细列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 订单明细列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderVo> queryList(OrderBo bo) {
|
||||||
|
LambdaQueryWrapper<Order> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<Order> buildQueryWrapper(OrderBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<Order> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(Order::getId);
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getCustomerName()), Order::getCustomerName, bo.getCustomerName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getCustomerPhone()), Order::getCustomerPhone, bo.getCustomerPhone());
|
||||||
|
lqw.eq(bo.getCustomerId() != null, Order::getCustomerId, bo.getCustomerId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getProductName()), Order::getProductName, bo.getProductName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getProductImage()), Order::getProductImage, bo.getProductImage());
|
||||||
|
lqw.eq(bo.getSellingPrice() != null, Order::getSellingPrice, bo.getSellingPrice());
|
||||||
|
lqw.eq(bo.getMailPrice() != null, Order::getMailPrice, bo.getMailPrice());
|
||||||
|
lqw.eq(bo.getActualPrice() != null, Order::getActualPrice, bo.getActualPrice());
|
||||||
|
lqw.eq(bo.getTotalPrice() != null, Order::getTotalPrice, bo.getTotalPrice());
|
||||||
|
lqw.eq(bo.getRefundMoney() != null, Order::getRefundMoney, bo.getRefundMoney());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getOrderStatus()), Order::getOrderStatus, bo.getOrderStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getBuyData()), Order::getBuyData, bo.getBuyData());
|
||||||
|
lqw.eq(bo.getPayTime() != null, Order::getPayTime, bo.getPayTime());
|
||||||
|
lqw.eq(bo.getShipmentTime() != null, Order::getShipmentTime, bo.getShipmentTime());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getShipmentImage()), Order::getShipmentImage, bo.getShipmentImage());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getTrackingNumber()), Order::getTrackingNumber, bo.getTrackingNumber());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(OrderBo bo) {
|
||||||
|
Order add = MapstructUtils.convert(bo, Order.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单明细
|
||||||
|
*
|
||||||
|
* @param bo 订单明细
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(OrderBo bo) {
|
||||||
|
Order update = MapstructUtils.convert(bo, Order.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(Order entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除订单明细信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.dromara.system.mapper.OrderMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user