select name, zzjgdm, zfdw, sub_name, zfcode, sfzcode_encrypt,x.dept_id as deptId,phoneNumber as phoneNumber,ancestors as ancestors from
(select* from
(select name, zzjgdm, zfdw, sub_name, zfcode, sfzcode_encrypt from zfryjdm2405301
<where>
and code_state = '01'
and name is not null
and zfdw is not null
and zfcode is not null
<iftest="name != null and name != ''">and name like concat('%',#{name},'%')</if>
<iftest="zfcode != null and zfcode != ''">and zfcode like concat('%',#{zfcode},'%')</if>
</where>
group by sfzcode) z
left join (select dept_id,phoneNumber, certificateNumber from sys_user where law_certificate_num is not null and user_source = 0 and status='0' and del_flag='0' group by certificateNumber) u
on z.sfzcode_encrypt=u.certificateNumber
group by z.sfzcode_encrypt)x
left join (select dept_id,ancestors,creditcode from sys_dept where status='0' and del_flag='0') d
select name, zzjgdm, #{zfdw} as zfdw, sub_name, zfcode, sfzcode_encrypt,x.dept_id as deptId,phoneNumber as phoneNumber,ancestors as ancestors from
(select* from
(select name, zzjgdm, zfdw, sub_name, zfcode, sfzcode_encrypt from zfryjdm2405301
<where>
and code_state = '01'
and name is not null
and zfdw is not null
and zfcode is not null
<iftest="name != null and name != ''">and name like concat('%',#{name},'%')</if>
<iftest="zfcode != null and zfcode != ''">and zfcode like concat('%',#{zfcode},'%')</if>
</where>
group by sfzcode) z
left join (select dept_id,phoneNumber, certificateNumber from sys_user where law_certificate_num is not null and user_source = 0 and status='0' and del_flag='0' group by certificateNumber) u
on z.sfzcode_encrypt=u.certificateNumber
group by z.sfzcode_encrypt)x
left join (select dept_id,ancestors,creditcode from sys_dept where status='0' and del_flag='0') d