refactor(iot): 优化 OTA 升级记录查询方法

- 重写 getOtaUpgradeRecordCount 和 getOtaUpgradeRecordStatistics 方法,使用 MyBatis-Plus 的 LambdaQueryWrapperX
-移除 XML 中对应的 SQL 查询语句
- 提高代码可维护性和数据库兼容性
This commit is contained in:
陈玄礼
2025-02-27 23:07:09 +08:00
parent 6e1ec8b3eb
commit 0302ebee99
2 changed files with 15 additions and 22 deletions

View File

@@ -4,21 +4,4 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.iot.dal.mysql.ota.IotOtaUpgradeRecordMapper">
<!-- TODO @li看看是不是可以通过 mybatis plus 写哈,更好适配多 db -->
<select id="getOtaUpgradeRecordCount" resultType="java.lang.Long">
select count(*)
from iot_ota_upgrade_record
where task_id = #{taskId}
and device_name like concat('%', #{deviceName}, '%')
and status = #{status}
</select>
<!-- TODO @li看看是不是可以通过 mybatis plus 写哈,更好适配多 db -->
<select id="getOtaUpgradeRecordStatistics" resultType="java.lang.Long">
select count(*)
from iot_ota_upgrade_record
where firmware_id = #{firmwareId}
and status = #{status}
</select>
</mapper>