v4.0 修改大屏查询记录总数面的问题

This commit is contained in:
gaoben 2022-05-17 15:14:28 +08:00
parent 5c1536d342
commit 8ebf4d29c5
3 changed files with 62 additions and 11 deletions

View File

@ -27,6 +27,8 @@ public interface TenRecordDao {
List<TenRecordEntity> findAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
int findAllSize(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
int findHourAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
IPage<TenRecordEntity> findPageBlackRecord(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);

View File

@ -291,7 +291,7 @@ public class TenRecordServiceImpl implements TenRecordService {
if (cellIds.size() == 0) {
return 0;
}
int c = tenRecordDao.findAll(cellIds, params).size();
int c = tenRecordDao.findAllSize(cellIds, params);
return c;
}

View File

@ -336,6 +336,20 @@
</select>
<select id="findAllSize" resultType="int">
select count(1) from ten_record_${params.tenantId} r
where 1 = 1
<if test="params.cellId != null and params.cellId!=''">
and r.cell_id = #{params.cellId}
</if>
<if test="cellIds != null">
and r.cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId}
</foreach>
</if>
</select>
<select id="findHourAll" resultType="int">
<!--SELECT count(*) from (-->
@ -446,11 +460,31 @@
<!--</if>-->
<!--order by record_time desc-->
select r.*,t.name from ten_record_${params.tenantId} r
<!-- select r.*,t.name from ten_record_${params.tenantId} r-->
<!-- left join ten_person t on r.person_id = t.person_id-->
<!-- left join ten_device d on r.device_sn = d.sn-->
<!-- where d.tenant_id = #{params.tenantId}-->
<!-- and d.delete_flag = 0-->
<!-- <if test="params.cellId != null and params.cellId!=''">-->
<!-- and r.cell_id = #{params.cellId}-->
<!-- </if>-->
<!-- <if test="params.roomId != null and params.roomId!=''">-->
<!-- and t.room_id = #{params.roomId}-->
<!-- </if>-->
<!-- <if test="params.name != null and params.name!=''">-->
<!-- and `name` like CONCAT('%', '${params.name}', '%')-->
<!-- </if>-->
<!-- <if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!-- and `record_time` &gt;= #{params.recordTimeStart}-->
<!-- </if>-->
<!-- <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!-- and `record_time` &lt; #{params.recordTimeEnd}-->
<!-- </if>-->
<!-- order by record_time desc-->
select rec.* from (select r.*,t.name from ten_record_${params.tenantId} r
left join ten_person t on r.person_id = t.person_id
left join ten_device d on r.device_sn = d.sn
where d.tenant_id = #{params.tenantId}
and d.delete_flag = 0
where 1 = 1
<if test="params.cellId != null and params.cellId!=''">
and r.cell_id = #{params.cellId}
</if>
@ -466,7 +500,10 @@
<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
and `record_time` &lt; #{params.recordTimeEnd}
</if>
order by record_time desc
order by record_time desc) as rec left join ten_device d on rec.device_sn = d.sn
where d.tenant_id = #{params.tenantId}
and d.delete_flag = 0
</select>
@ -486,7 +523,7 @@
and tr.record_face is not null
and TO_DAYS(tr.record_time) = TO_DAYS(NOW())
and tp.xa_sync_card = 1
-->
select tr.* from (select * from ten_record_${tenantId}
where cell_id = #{cellId}
@ -494,6 +531,18 @@
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 rr.* from (select record_id 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_record_${tenantId} rr
on tr.record_id = rr.record_id
left join ten_person tp
on rr.person_id = tp.person_id
and tp.xa_sync_card = 1
</select>