联表查询,查询右表有的数据或右表没有的数据
SELECT
a.supvs_deptid as supvsDeptid,
a.org_type as orgType,
a.org_name as originalRegName,
b.report_time as operateTime
FROM
uac_org_main a
LEFT JOIN t_management_document_report b ON a.regcode = b.original_reg_code
where
a.status = 1
AND
a.valid_status = 1
AND
a.is_deleted = 'N'
<if test="flag == true">
a.regcode = b.original_reg_code
</if>
<if test="flag == false">
and b.original_reg_code is NULL
</if>