v8:修改同步信息重复的bug

This commit is contained in:
gaoben 2023-09-25 15:24:57 +08:00
parent ef3a9002b7
commit 9f88bd089c
4 changed files with 32 additions and 0 deletions

View File

@ -38,4 +38,10 @@ public interface TenPersonSyncDao {
void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("tenantId")Long tenantId); void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("tenantId")Long tenantId);
List<TenPersonSyncEntity> findTwo(@Param("tenantId")Long tenantId);
List<TenPersonSyncEntity> findByDeviceIdAndPersonIdTwo(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("tenantId")Long tenantId);
} }

View File

@ -38,6 +38,10 @@ public interface TenPersonSyncService {
List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId); List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId);
List<TenPersonSyncEntity> findTwo(Long tenantId);
List<TenPersonSyncEntity> findByDeviceIdAndPersonIdList(Long deviceId, Long personId,Long tenantId);
} }

View File

@ -94,4 +94,14 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService {
public List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId) { public List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId) {
return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,tenantId); return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,tenantId);
} }
@Override
public List<TenPersonSyncEntity> findTwo(Long tenantId) {
return tenPersonSyncDao.findTwo(tenantId);
}
@Override
public List<TenPersonSyncEntity> findByDeviceIdAndPersonIdList(Long deviceId, Long personId, Long tenantId) {
return tenPersonSyncDao.findByDeviceIdAndPersonIdTwo(deviceId, personId, tenantId);
}
} }

View File

@ -150,6 +150,8 @@
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${tenantId}
where device_id = #{deviceId} where device_id = #{deviceId}
and person_id = #{personId} and person_id = #{personId}
order by last_update_time desc
limit 1
</select> </select>
<select id="findByPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findByPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
@ -182,4 +184,14 @@
and state = 1 and state = 1
</select> </select>
<select id="findTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select device_id, person_id, count(*) from ten_person_sync_${tenantId} group by device_id, person_id having count(*) > 1
</select>
<select id="findByDeviceIdAndPersonIdTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId}
where device_id = #{deviceId}
and person_id = #{personId}
</select>
</mapper> </mapper>