SELECT coiid as id coiorg_id as orgId coicompany_id as companyId coiqrcode_id as qrcodeId coient_org_name as entOrgName coient_org_short_name as entOrgShortNa
SELECT coi.id as id, coi.org_id as orgId, coi.company_id as companyId, coi.qrcode_id as qrcodeId, coi.ent_org_name as entOrgName, coi.ent_org_short_name as entOrgShortName, coi.ent_org_en_name as entOrgEnName, coi.pid, coi.LEVEL, coi.pic_name as picName, coi.pic_concat as picConcat, coi.ent_org_address as entOrgAddress, coi.sort, coi.create_time as createTime, coi.modify_time as modifyTime, ccq.startup_status AS startupStatus, ccq.qrcode AS qrcode, coo.ent_org_name as superName, coo.level as cooLevel, (CASE coi.level when 1 THEN (select count(1) from comp_import_roster cr where cr.ent_org_2 in(select id from comp_org_info coi1 where coi1.pid = coi.id) and cr.state in(0,1)) when 2 THEN (select count(1) from comp_import_roster cr where cr.ent_org_2 = coi.id and cr.state in(0,1)) when 3 THEN (select count(1) from comp_import_roster cr where cr.ent_org_3 = coi.id and cr.state in(0,1)) when 4 THEN (select count(1) from comp_import_roster cr where cr.ent_org_4 = coi.id and cr.state in(0,1)) when 5 THEN (select count(1) from comp_import_roster cr where cr.ent_org_5 = coi.id and cr.state in(0,1)) END) AS personNum FROM comp_org_info coi LEFT JOIN comp_company_qrcode ccq ON coi.qrcode_id = ccq.id left join comp_org_info coo on coi.pid = coo.id WHERE coi.level <= 5 AND ccq.startup_status IS NOT NULL AND ccq.qrcode IS NOT NUL
原文地址: https://www.cveoy.top/t/topic/hN3g 著作权归作者所有。请勿转载和采集!