# 清理user/account/user_role/employee数据
> author:guzg
> date:2022-04-03
1、首先使用左关联查询出相应的记录;
```
SELECT su.id,su.login_name,su.name, sa.account,sur.role_id,tce.tce_sys_user_id,tce.tce_login_code,su.`company_id`,su.`office_id` FROM
gaoxinintepark.`t_corp_employee` tce LEFT JOIN sys_user su ON tce.tce_sys_user_id = su.id
LEFT JOIN sys_account sa ON tce.tce_login_code = sa.account COLLATE utf8_unicode_ci
LEFT JOIN sys_user_role sur ON tce.tce_sys_user_id= sur.user_id
WHERE tce.tce_sys_user_id = '6305d3b8-7b1d-4a76-b2a8-bf3784e80be6';
```
2、对于数据缺失的情况进行补充;
[企业信息导入模板](https://pan.baidu.com/s/1DeGu_-Bn5z5ozyFT64B9lg)(n7qm )
[企业人员数据导入模板](https://pan.baidu.com/s/1DjlsY1TdVWK8D1iFCrLzrw)【he82】
3、删除多余的账号信息;
```
DELETE FROM sys_user WHERE id = '09d5f4d25df7d3a71a5bddaeab7ceda0'
DELETE FROM sys_account WHERE account = '1811298xxxx'
DELETE FROM sys_account WHERE CODE = ''
DELETE FROM sys_user_role WHERE user_id = '09d5f4d25df7d3a71a5bddaeab7ceda0'
DELETE FROM gaoxinintepark.`t_corp_employee` WHERE -- tce_login_code = '1826xxxxxxx'
tce_sys_user_id= '6305d3b8-7b1d-4a76-b2a8-bf3784e80be6'
```