字符串ID转换成字符串名字

时间:2021-12-07 05:34:53

select  U.CnName+','  from f_splitstr('1828,1055333,1,1035681,752,494,22549,219,23860,478,23453,677,718,782,2358', ',')
     join T_BD_User U on U.ID=F1
  for xML PATH('')

select RoleName,ExecutorName,
  case  when temp.CnName='' then ''
  when temp.CnName<>'' then
  LEFT(temp.CnName,LEN(temp.CnName)-1) end as CnName,ExecuteDate,ActionName,Status,Remark from ( select R.name RoleName,U.CnName ExecutorName,
   (select  U.CnName+','  from f_splitstr(ReceiverID, ',')
     join T_BD_User U on U.ID=F1
  for xML PATH('')) as CnName,
    A.ExecuteDate,
   case ActionID when 13 then '呈递'
   when 38 then '审批'  end ActionName,
    case ApproveLogStatusID when 1 then '已呈递'
   when 2 then '已发布'  end Status,
   Remark
   from
   T_FI_WF_ApproveLog A
      join T_IS_FacilityLPPTemplate LPP on LPP.WorkFlowInstanceID=A.InstanceID
   join T_BD_role R on R.ID=A.roleID
    join T_BD_User U on U.ID=A.ExecutorID
  join T_SYS_Enum_TemplateStatus T on T.ID=A.ApproveLogStatusID
   where LPP.ID=61) temp