From acfaebfffa56f5a723f6c8a6778b199ce592db77 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 8 Nov 2025 17:38:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(printer):=E4=BF=AE=E5=A4=8D=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=9C=BA=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整打印机选择逻辑,确保正确获取打印机ID - 优化SourceMapper查询,按创建时间倒序并限制结果数量- 修复可能因逻辑错误导致的打印机选择异常问题 --- .../ycwl/basic/service/printer/impl/PrinterServiceImpl.java | 6 ++---- src/main/resources/mapper/SourceMapper.xml | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java b/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java index 6703ac49..062178df 100644 --- a/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java @@ -490,12 +490,10 @@ public class PrinterServiceImpl implements PrinterService { List printerList = printerMapper.listByScenicId(scenicId); if (printerList.size() != 1) { throw new BaseException("请选择打印机"); - } else { - printerId = printerList.getFirst().getId(); } - } else { - printer = printerMapper.getById(printerId); + printerId = printerList.getFirst().getId(); } + printer = printerMapper.getById(printerId); if (printer == null) { throw new BaseException("打印机不存在"); } diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index 0bd0aa81..3f7c2338 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -358,5 +358,7 @@ select * from source where face_sample_id = #{faceSampleId} and type = #{type} + order by create_time desc + limit 1