fix(printer):修复打印机选择逻辑并优化查询

- 调整打印机选择逻辑,确保正确获取打印机ID
- 优化SourceMapper查询,按创建时间倒序并限制结果数量- 修复可能因逻辑错误导致的打印机选择异常问题
This commit is contained in:
2025-11-08 17:38:44 +08:00
parent 72e215c552
commit acfaebfffa
2 changed files with 4 additions and 4 deletions

View File

@@ -490,12 +490,10 @@ public class PrinterServiceImpl implements PrinterService {
List<PrinterResp> 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("打印机不存在");
}

View File

@@ -358,5 +358,7 @@
select *
from source
where face_sample_id = #{faceSampleId} and type = #{type}
order by create_time desc
limit 1
</select>
</mapper>