INSERT INTO ciimp_privilege (
uuid,type,owner,privilege_code,company_code,department_code,loc_timezone,is_void
) select replace (UUID(),'-',''),'U',user_id,'SHARE_ACCOUNT_INFO,READ_ACCOUNT_INFO,MAINTAIN_COMPANY_INFO',
u.company_code,'*','UTC','0' from scdp_user u where u.user_id not in(select `owner` from ciimp_privilege ) and (u.is_admin is null or u.is_admin = 0 )
转载于:https://www.cnblogs.com/wcnwcn/p/7244835.html