<!--按照条件查询--><select id="findInfo" resultType="com.hikvision.aidp.dto.TotalCameraInfoDto">
select region_index_code,(select pi.property_name from property_info pi where pi.property_id = rci.unit_id) as unit_name,(select pi.property_name from property_info pi where pi.property_id = rci.plate_id) as plate_name,(select pi.property_name from property_info pi where pi.property_id = rci.subordinate_part_id) as subordinate_part_name,
camera_name,
ip,
online_state,
offline_duration,
not_recorded_duration,
state_change_num,
blur_duration
from related_camera_info rci
left join camera_info ci
on rci.camera_index_code = ci.camera_index_code
<where><if test="relatedPropertyIdDto.cameraName != null and relatedPropertyIdDto.cameraName !=''">
camera_name like '%${relatedPropertyIdDto.cameraName}%'</if><if test="relatedPropertyIdDto.plateNames != null">
and
<foreach collection="relatedPropertyIdDto.plateNames" item="item" separator="or" open="(" close=")">
plate_id = #{item}</foreach></if><if test="relatedPropertyIdDto.subordinatePartNames!=null">
and
<foreach collection="relatedPropertyIdDto.subordinatePartNames" item="item" separator="or" open="("
close=")">
subordinate_part_id = #{item}</foreach></if><if test="relatedPropertyIdDto.unitNames!=null">
and
<foreach collection="relatedPropertyIdDto.unitNames" item="item" separator="or" open="(" close=")">
unit_id = #{item}</foreach></if></where>
offset (#{pageNo}-1)* #{pageSize}
limit #{pageSize}</select>
<!--按照条件查询条数--><select id="getFindInfoCount" parameterType="com.hikvision.aidp.dto.TotalCameraInfoDto" resultType="int">
select count(*) from related_camera_info rci
left join camera_info ci
on rci.camera_index_code = ci.camera_index_code
<where><if test="relatedPropertyIdDto.cameraName != null and relatedPropertyIdDto.cameraName !=''">
camera_name like '%${relatedPropertyIdDto.cameraName}%'</if><if test="relatedPropertyIdDto.plateNames != null">
and
<foreach collection="relatedPropertyIdDto.plateNames" item="item" separator="or" open="(" close=")">
plate_id = #{item}</foreach></if><if test="relatedPropertyIdDto.subordinatePartNames!=null">
and
<foreach collection="relatedPropertyIdDto.subordinatePartNames" item="item" separator="or" open="("
close=")">
subordinate_part_id = #{item}</foreach></if><if test="relatedPropertyIdDto.unitNames!=null">
and
<foreach collection="relatedPropertyIdDto.unitNames" item="item" separator="or" open="(" close=")">
unit_id = #{item}</foreach></if></where></select>