select * from t_user x where x.ID='248283--__qFCcCnozYNwzoG3O6Ms';
select * from baibaodunflow.tlk_securityman x where x.ID='248283--__qFCcCnozYNwzoG3O6Ms';
/**
  同一家企业为什么这么多员工
 */
select LOGINNO,FIELD1,DOMAINID,ID from t_user where LOGINNO='10701164802';

select CONCAT("delete from t_user_department_role_set where USERID in (select id from t_user where loginno='",LOGINNO,"' and domainId='",DOMAINID,"' and id like '%__XQfjpd9pI9QLFaMYoYm');delete from t_user where loginno='",LOGINNO,"' and domainId='",DOMAINID,"' and id like '%__XQfjpd9pI9QLFaMYoYm';")
from (
         select LOGINNO,DOMAINID,FIELD1,FIELD2,count(1) as ct from t_user group by LOGINNO,DOMAINID
     ) as p where ct>1 ;

select CONCAT("delete from t_user where loginno='",LOGINNO,"' and domainId='",DOMAINID,"' and FIELD1='",FIELD1,"';")
from (
         select LOGINNO,DOMAINID,FIELD1,FIELD2,count(1) as ct from t_user group by LOGINNO,DOMAINID
     ) as p where ct>1 and IFNULL(FIELD1,'')<>'';

delete from t_user_department_role_set where USERID in (select id from t_user where id like '%__XQfjpd9pI9QLFaMYoYm');
delete from t_user where id like '%__XQfjpd9pI9QLFaMYoYm';

delete from tenant_employee_events where employee_id in (select id from tenant_employees  where id not in (select id from t_user) and id like '%--_%');
delete from tenant_contracts where employee_id in (select id from tenant_employees  where id not in (select id from t_user) and id like '%--_%');
delete from tenant_employees  where id not in (select id from t_user) and id like '%--_%';


select d.id,d.LOGINNO,d.DOMAINID,k.`NAME`,d.FIELD1,d.FIELD12
from t_user d join t_domain k on d.DOMAINID=k.ID where d.LOGINNO in (
    select LOGINNO
    from (
             select LOGINNO,DOMAINID,FIELD1,FIELD2,count(1) as ct from t_user  group by LOGINNO,DOMAINID
         ) as p where ct>1
) order by k.`NAME` asc, d.LOGINNO asc;

