feat(printer): 增加打印任务查询功能并完善商品详情展示

- 在 PrinterMapper 中新增 queryTaskByMpId 方法用于查询打印任务
- 扩展 GoodsDetailVO 类,增加打印机名称和纸张类型字段
- 修改 OrderServiceImpl,在商品列表中设置打印机相关信息
- 更新 PrintTaskResp 类,添加纸张类型属性
- 在 PrinterMapper.xml 中实现 queryTaskByMpId 的 SQL 查询逻辑
This commit is contained in:
2025-10-27 10:24:59 +08:00
parent b3e2601758
commit 27930b1dca
5 changed files with 15 additions and 1 deletions

View File

@@ -55,4 +55,6 @@ public interface PrinterMapper {
void updateUserPhotoListToPrinter(Long memberId, Long scenicId, Integer printerId);
List<MemberPrintResp> listRelationByOrderId(Long orderId);
PrintTaskResp queryTaskByMpId(Integer id);
}

View File

@@ -43,7 +43,9 @@ public class GoodsDetailVO {
private Integer isFree;
private Integer parts;
private Integer sort;
private String printerName;
private String printerPaper;
@JsonProperty("sourceType")
public Integer getSourceType() {
return goodsType;

View File

@@ -10,6 +10,7 @@ public class PrintTaskResp {
private Integer printerId;
private Integer status;
private String printerName;
private String paper;
private String url;
private Integer width;
private Integer height;

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.ycwl.basic.dto.MobileOrderRequest;
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
import com.ycwl.basic.model.printer.resp.PrintTaskResp;
import com.ycwl.basic.order.dto.PaymentParamsRequest;
import com.ycwl.basic.order.dto.PaymentParamsResponse;
import com.ycwl.basic.pricing.dto.CouponUseRequest;
@@ -351,6 +352,11 @@ public class OrderServiceImpl implements OrderService {
goods.setScenicId(sourceEntity.getScenicId());
goods.setTemplateCoverUrl(sourceEntity.getCropUrl());
goods.setCreateTime(sourceEntity.getCreateTime());
PrintTaskResp printTaskResp = printerMapper.queryTaskByMpId(sourceEntity.getId());
if (printTaskResp != null) {
goods.setPrinterName(printTaskResp.getPrinterName());
goods.setPrinterPaper(printTaskResp.getPaper());
}
goodsList.add(goods);
}
}

View File

@@ -68,6 +68,9 @@
FROM member_print p
WHERE p.id in (select order_item.goods_id from order_item where order_item.order_id = #{orderId} and order_item.goods_type = 3)
</select>
<select id="queryTaskByMpId" resultType="com.ycwl.basic.model.printer.resp.PrintTaskResp">
SELECT t.*, p.name as printerName FROM print_task t left join printer p on p.id = t.printer_id WHERE mp_id = #{orderId} order by t.create_time desc limit 1
</select>
<!-- 新增 -->
<insert id="add">