CREATE PROCEDURE securityflow.`proc_refresh_tenant_user`( IN p_id VARCHAR ( 100 ) ) BEGIN declare p_name VARCHAR ( 200 ); declare p_sex TINYINT; declare p_military_status VARCHAR(100); declare p_authenticated_status TINYINT; declare p_checked_status TINYINT; declare d_type VARCHAR(100); declare d_number VARCHAR(100); declare d_telephone VARCHAR(100); select u.`name`,u.`sex`,(case when u.military_status='服过' then 1 else 0 end), u.authenticated_status,u.checked_status,c.number,u.telephone,c.credential_type into p_name,p_sex,p_military_status,p_authenticated_status,p_checked_status,d_number,d_telephone,d_type from obpm2.tenant_users u left join obpm2.tenant_user_credentials c on u.selected_credential_id=c.id where u.id=p_id; update rd_employee_summary set `name`= p_name,idCard=d_number,sex=p_sex,telephone=d_telephone where tenant_user_id=p_id; update rd_security_service_station_relation_employee_summary set `tenant_user_name`= p_name, tenant_user_certificated_type=d_type, tenant_user_certificated_number=d_number where tenant_user_id=p_id; END;