|
@@ -521,17 +521,17 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
|
//是否有虚拟设备
|
|
|
if (query.getHasVirtual() != null) {
|
|
|
if (query.getHasVirtual()) {
|
|
|
- sql.append(" and camera.virtual_camera=1 ");
|
|
|
-// sql.append(" and record_data.id in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
|
|
|
+ sql.append(" AND EXISTS( ");
|
|
|
+ sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
+ sql.append(" ");
|
|
|
} else {
|
|
|
- //原先写法会跟有虚拟设备的出现重复情况,用有虚拟设备的not in
|
|
|
- //sql.append(" and record_data.id in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId()+" and (t2.has_virtual_camera=0 or t2.has_virtual_camera is null) )");
|
|
|
-// sql.append(" and record_data.id not in (select t1.id from ec_oe_exam_record_data t1 left join ec_oe_exam_capture t2 on t1.id=t2.exam_record_data_id where t1.exam_id =" + query.getExamId() + " and t2.has_virtual_camera=1 )");
|
|
|
- sql.append(" and (camera.virtual_camera=0 or camera.virtual_camera is null) ");
|
|
|
+ sql.append(" AND NOT EXISTS( ");
|
|
|
+ sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
+ sql.append(" ");
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(query.getVirtualName())) {
|
|
|
- sql.append(" and camera.name='"+query.getVirtualName()+"' ");
|
|
|
+ sql.append(" and camera.virtual_camera=1 and camera.name='"+query.getVirtualName()+"' ");
|
|
|
}
|
|
|
|
|
|
//ip
|