SELECT
*
FROM
ZHC_VSL_DEV_ENCODER_CHN chn LEFT JOIN
ZHC_VSL_DEV_ENCODER_DEV dev ON chn.DEVICECODE = dev.DEVICEID
WHERE
1 = 1
AND (
(${device_type}='1' and dev.category='1') or
(${device_type}='2' and dev.category='5' AND ( instr(','||chn.cameraFunctions||',',',8,')>0 or instr(','||chn.cameraFunctions||',',',12,')>0 or instr(','||chn.cameraFunctions||',',',10,')>0)) or
(${device_type}='3' and chn.device_type='3') or
(${device_type}='4' and dev.category='5' AND (instr(','||chn.cameraFunctions||',',',9,')>0 or instr(','||chn.cameraFunctions||',',',10,')>0))
)
${device_type} 为条件值,不同的${device_type},查询条件不同。