思念食品API

sql_P_GetSeatGroup_20180517.sql 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. USE [ANTU20480330]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[P_GetSeatGroup] Script Date: 05/17/2018 17:36:50 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER PROCEDURE [dbo].[P_GetSeatGroup]
  9. (
  10. @Caller NVARCHAR(50), --主叫号码
  11. @Callee NVARCHAR(50) --被叫号码
  12. )
  13. AS
  14. BEGIN
  15. SET NOCOUNT ON;
  16. declare @locationID int--主叫号码的归属地ID
  17. declare @areacode nvarchar(50)--区号
  18. declare @usercode nvarchar(50)--需要返回的坐席
  19. declare @zxzid int --坐席组ID
  20. --根据被叫号码获取对应坐席组
  21. if @Callee='8001'
  22. begin
  23. select @zxzid= F_ZXZID from T_Sys_SeatGroup where F_ZXZCode='KFZ'
  24. end
  25. else
  26. begin
  27. select @areacode=dbo.GetPhoneLocation(@Caller)
  28. --根据区号获取地区ID
  29. select @locationID=id FROM tel_location where tel=@areacode
  30. --根据地区ID获取对应负责的坐席组ID
  31. select @zxzid=userid from telloc_users where tellocid=@locationID
  32. end
  33. select @zxzid
  34. END