v4.0 优化查询未同步记录sql慢的问题

This commit is contained in:
gaoben 2022-05-16 14:43:28 +08:00
parent ce9efa70ab
commit 5c1536d342
1 changed files with 10 additions and 3 deletions

View File

@ -478,16 +478,23 @@
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity"> <select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
<!--
select tr.* from ten_record_${tenantId} tr left join ten_person tp select tr.* from ten_record_${tenantId} tr left join ten_person tp
on tr.person_id = tp.person_id on tr.person_id = tp.person_id
where tr.cell_id = #{cellId} where tr.cell_id = #{cellId}
and tr.xa_sync = 0 and tr.xa_sync = 0
and tr.record_face is not null and tr.record_face is not null
and TO_DAYS(tr.record_time) = TO_DAYS(NOW()) and TO_DAYS(tr.record_time) = TO_DAYS(NOW())
and tp.xa_sync_card = 1 and tp.xa_sync_card = 1
-->
select tr.* from (select * from ten_record_${tenantId}
where cell_id = #{cellId}
and xa_sync = 0
and TO_DAYS(record_time) = TO_DAYS(NOW())
and record_face is not null) as tr left join ten_person tp
on tr.person_id = tp.person_id
and tp.xa_sync_card = 1
</select> </select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity"> <select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">