首页 > 其他分享 >所以函数获取项目负责人和部门负责人

所以函数获取项目负责人和部门负责人

时间:2023-03-07 11:23:24浏览次数:38  
标签:set VARCHAR 函数 utf8 获取 负责人 hrids id select

CREATE DEFINER=`root`@`localhost` FUNCTION `getHRids`(projectid VARCHAR(32),userid VARCHAR(32)) RETURNS varchar(2000) CHARSET utf8
BEGIN
DECLARE projmanager VARCHAR(256);
DECLARE orgmanager VARCHAR(256);
DECLARE pronumber VARCHAR(2000);
DECLARE hrids VARCHAR(2000);
DECLARE result VARCHAR(2000);
/**项目负责人**/
set projmanager=(select projectmgr from project where id=CONVERT(projectid USING utf8) COLLATE utf8_unicode_ci);
/**项目成员**/
set pronumber=(select projectrolea from project where id=CONVERT(projectid USING utf8) COLLATE utf8_unicode_ci);

/**部门负责人**/
set orgmanager=(select id from humres where station like concat('%',(select mstationid from orgunit o inner join humres h on h.orgid=o.id where h.id=CONVERT(userid USING utf8) COLLATE utf8_unicode_ci),'%') and isdelete=0 and hrstatus = '402881ea0b1c751a010b1cd0a73e0003');
set hrids=CONCAT_WS(',',orgmanager,projmanager,pronumber);
IF (hrids is not null) THEN
set hrids=CONCAT(hrids,',');
END IF ;
set result=deleteManyChar(hrids);
return result;
END

标签:set,VARCHAR,函数,utf8,获取,负责人,hrids,id,select
From: https://www.cnblogs.com/jk200/p/17187406.html

相关文章