新远程服务表.sql 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. -- 远程服务(remote_service);
  2. CREATE TABLE [dbo].[remote_service](
  3. [service_id] [varchar](38) NOT NULL, -- 远程服务id(上传截图时使用,保存在服务器目录下);
  4. [order] [nvarchar](24) NOT NULL, -- 远程的订单号;
  5. [remote_date] [nvarchar](24) NOT NULL, -- 远程日期;
  6. [remote_submit_staff] [nvarchar](12) NOT NULL, -- 远程提交员工;
  7. [remote_service_staff] [nvarchar](12) NOT NULL, -- 远程服务员工;
  8. [remote_service_commodity][nvarchar](24) NOT NULL, -- 远程服务的商品(经典片,铂金版,小程序等, 有配置表);
  9. [remote_service_problem][nvarchar](24) NOT NULL, -- 远程服务问题(每种商品,都有独立的问题, 表配置表);
  10. [remote_service_status][nvarchar](8) NOT NULL, -- 远程服务状态(已解决,未解决);
  11. [remote_service_result][nvarchar](8) NOT NULL, -- 远程服务结果(员工对远程服务的满意结果:非常满意,满意,一般,客怨);
  12. [remote_service_describe][nvarchar](8) NOT NULL, -- 远程服务描述;
  13. [remote_customer_contact][nvarchar](12) NOT NULL, -- 远程客户的联系人;
  14. [remote_customer_qq][nvarchar](16) NOT NULL, -- 远程客户的qq;
  15. [remote_customer_phone][nvarchar](16) NOT NULL, -- 远程客户的手机;
  16. [return_visit_status][nvarchar](8) NOT NULL, -- 回访状态(已回访,未回访);
  17. [return_visit_date][nvarchar](24) NOT NULL, -- 回访日期;
  18. [return_visit_staff][nvarchar](12) NOT NULL, -- 回访员工;
  19. [return_visit_result][nvarchar](12) NOT NULL, -- 回访结果(客户对远程服务的满意度:非常满意,满意,一般,客怨);
  20. [return_visit_remark][nvarchar](250) NOT NULL, -- 回访备注;
  21. CONSTRAINT [PK_service_id] PRIMARY KEY CLUSTERED ([service_id] ASC),
  22. ) ON [PRIMARY]
  23. GO
  24. -- 远程商品表(remote_commodity);
  25. CREATE TABLE [dbo].[remote_commodity](
  26. [commodity_id] [int] IDENTITY(1,1) NOT NULL, -- 远程商品id;
  27. [commodity_name][nvarchar](24) NOT NULL, -- 远程商品名;
  28. [commodity_remark][nvarchar](50) NOT NULL, -- 远程商品备注;
  29. CONSTRAINT [PK_remote_commodity] PRIMARY KEY CLUSTERED ([commodity_id] ASC),
  30. CONSTRAINT [UK_remote_commodity] UNIQUE NONCLUSTERED ([commodity_name] ASC)
  31. ) ON [PRIMARY]
  32. GO
  33. -- 远程商品问题表(remote_commodity_problem);
  34. CREATE TABLE [dbo].[remote_commodity_problem](
  35. [problem_id] [int] IDENTITY(1,1) NOT NULL, -- 问题id;
  36. [commodity_id][nvarchar](40) NOT NULL, -- 商品id;
  37. [problem_name][nvarchar](50) NOT NULL, -- 问题名称;
  38. [problem_remark][nvarchar](250) NOT NULL, -- 问题备注;
  39. CONSTRAINT [PK_remote_commodity_problem] PRIMARY KEY CLUSTERED ([problem_id] ASC),
  40. CONSTRAINT [UK_remote_commodity_problem] UNIQUE NONCLUSTERED ([commodity_id] ASC,[problem_name] ASC)
  41. ) ON [PRIMARY]
  42. GO
  43. -- 远程服务视图(remote_services);
  44. CREATE VIEW [remote_services] AS
  45. select
  46. dbo.dindan.name1, -- 老板姓名;
  47. dbo.dindan.name2, -- 影楼名称;
  48. dbo.dindan.phone1, -- 老板电话;
  49. dbo.dindan.ren, -- 接单人;
  50. dbo.client.addr1, -- 影楼地址;
  51. dbo.client.qq1, -- 影楼QQ;
  52. dbo.dindan.[pinyin1], -- 老板姓名拼音;
  53. dbo.dindan.[pinyin2], -- 影楼名称拼音;
  54. [remote_service].*
  55. from [dindan] inner join [client]
  56. on [dindan].[id] = [client].[id] inner join [remote_service]
  57. on [remote_service].[order] = [client].[id]