154 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			MySQL
		
	
	
	
		
		
			
		
	
	
			154 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			MySQL
		
	
	
	
| 
								 | 
							
								--Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
							 | 
						|||
| 
								 | 
							
								INSERT INTO Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
							 | 
						|||
| 
								 | 
							
								VALUES('0E46F8F2-69DB-4F54-BCA0-1F3CBE57DA10','<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滮','Person/PersonPlan.aspx',80,'0','Menu_Person',1,1,1)
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
							 | 
						|||
| 
								 | 
							
								VALUES('34D71F63-D749-4307-9268-8348F3F81ACB','0E46F8F2-69DB-4F54-BCA0-1F3CBE57DA10','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1)
							 | 
						|||
| 
								 | 
							
								GO	
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								CREATE TABLE [dbo].[Person_PersonPlan](
							 | 
						|||
| 
								 | 
							
									[PersonPlanId] [nvarchar](50) NOT NULL,
							 | 
						|||
| 
								 | 
							
									[DepartId] [nvarchar](50) NULL,
							 | 
						|||
| 
								 | 
							
									[UserId] [nvarchar](50) NULL,
							 | 
						|||
| 
								 | 
							
									[Major] [nvarchar](50) NULL,
							 | 
						|||
| 
								 | 
							
									[ProjectId] [nvarchar](50) NULL,
							 | 
						|||
| 
								 | 
							
									[PersonType] [nchar](10) NULL,
							 | 
						|||
| 
								 | 
							
									[Years] [int] NULL,
							 | 
						|||
| 
								 | 
							
									[Month1] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month2] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month3] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month4] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month5] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month6] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month7] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month8] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month9] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month10] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month11] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Month12] [bit] NULL,
							 | 
						|||
| 
								 | 
							
									[Remark] [nvarchar](500) NULL,
							 | 
						|||
| 
								 | 
							
								 CONSTRAINT [PK_Person_PersonPlan] PRIMARY KEY CLUSTERED 
							 | 
						|||
| 
								 | 
							
								(
							 | 
						|||
| 
								 | 
							
									[PersonPlanId] ASC
							 | 
						|||
| 
								 | 
							
								)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
							 | 
						|||
| 
								 | 
							
								) ON [PRIMARY]
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan]  WITH CHECK ADD  CONSTRAINT [FK_Person_PersonPlan_Base_Depart] FOREIGN KEY([DepartId])
							 | 
						|||
| 
								 | 
							
								REFERENCES [dbo].[Base_Depart] ([DepartId])
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan] CHECK CONSTRAINT [FK_Person_PersonPlan_Base_Depart]
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan]  WITH CHECK ADD  CONSTRAINT [FK_Person_PersonPlan_Base_Project] FOREIGN KEY([ProjectId])
							 | 
						|||
| 
								 | 
							
								REFERENCES [dbo].[Base_Project] ([ProjectId])
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan] CHECK CONSTRAINT [FK_Person_PersonPlan_Base_Project]
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan]  WITH CHECK ADD  CONSTRAINT [FK_Person_PersonPlan_Sys_User] FOREIGN KEY([UserId])
							 | 
						|||
| 
								 | 
							
								REFERENCES [dbo].[Sys_User] ([UserId])
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Person_PersonPlan] CHECK CONSTRAINT [FK_Person_PersonPlan_Sys_User]
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'PersonPlanId'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'DepartId'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ԱId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'UserId'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'רҵ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Major'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ĿId' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'ProjectId'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>1-<2D><>ʽԱ<CABD><D4B1><EFBFBD><EFBFBD>2-<2D><>ƸԱ<C6B8><D4B1><EFBFBD><EFBFBD>3-<2D>в<EFBFBD><D0B2>˲ţ<CBB2>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'PersonType'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'1<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month1'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'2<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month2'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'3<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month3'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'4<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month4'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'5<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month5'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'6<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month6'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'7<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month7'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'8<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month8'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'9<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month9'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'10<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month10'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'11<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month11'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'12<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Month12'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ע' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Person_PersonPlan', @level2type=N'COLUMN',@level2name=N'Remark'
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								CREATE VIEW View_Person_PersonPlan
							 | 
						|||
| 
								 | 
							
								AS
							 | 
						|||
| 
								 | 
							
								/******<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滮<EFBFBD><EFBFBD>******/
							 | 
						|||
| 
								 | 
							
								SELECT p.PersonPlanId, 
							 | 
						|||
| 
								 | 
							
								p.DepartId, 
							 | 
						|||
| 
								 | 
							
								p.UserId, 
							 | 
						|||
| 
								 | 
							
								p.Major, 
							 | 
						|||
| 
								 | 
							
								p.ProjectId, 
							 | 
						|||
| 
								 | 
							
								p.PersonType, 
							 | 
						|||
| 
								 | 
							
								p.Years, 
							 | 
						|||
| 
								 | 
							
								p.Month1, 
							 | 
						|||
| 
								 | 
							
								p.Month2, 
							 | 
						|||
| 
								 | 
							
								p.Month3, 
							 | 
						|||
| 
								 | 
							
								p.Month4, 
							 | 
						|||
| 
								 | 
							
								p.Month5, 
							 | 
						|||
| 
								 | 
							
								p.Month6, 
							 | 
						|||
| 
								 | 
							
								p.Month7, 
							 | 
						|||
| 
								 | 
							
								p.Month8, 
							 | 
						|||
| 
								 | 
							
								p.Month9, 
							 | 
						|||
| 
								 | 
							
								p.Month10, 
							 | 
						|||
| 
								 | 
							
								p.Month11, 
							 | 
						|||
| 
								 | 
							
								p.Month12, 
							 | 
						|||
| 
								 | 
							
								p.Remark,
							 | 
						|||
| 
								 | 
							
								d.DepartName,
							 | 
						|||
| 
								 | 
							
								u.UserName,
							 | 
						|||
| 
								 | 
							
								pro.ProjectName,
							 | 
						|||
| 
								 | 
							
								(CASE p.PersonType WHEN '1' THEN '<EFBFBD><EFBFBD>ʽԱ<EFBFBD><EFBFBD>' WHEN '2' THEN '<EFBFBD><EFBFBD>ƸԱ<EFBFBD><EFBFBD>' WHEN '3' THEN '<EFBFBD>в<EFBFBD><EFBFBD>˲<EFBFBD>' END) AS PersonTypeName
							 | 
						|||
| 
								 | 
							
								FROM Person_PersonPlan AS p
							 | 
						|||
| 
								 | 
							
								LEFT JOIN Base_Depart AS d ON d.DepartId = p.DepartId
							 | 
						|||
| 
								 | 
							
								LEFT JOIN Sys_User AS u ON u.UserId = p.UserId
							 | 
						|||
| 
								 | 
							
								LEFT JOIN Base_Project AS pro ON pro.ProjectId = p.ProjectId
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Comprehensive_SpecialEquipment] DROP CONSTRAINT [FK_Comprehensive_SpecialEquipment_Base_Equipment]
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Comprehensive_SpecialEquipment]  WITH CHECK ADD  CONSTRAINT [FK_Comprehensive_SpecialEquipment_Base_SpecialEquipment] FOREIGN KEY([EquipmentId])
							 | 
						|||
| 
								 | 
							
								REFERENCES [dbo].[Base_SpecialEquipment] ([SpecialEquipmentId])
							 | 
						|||
| 
								 | 
							
								GO
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								ALTER TABLE [dbo].[Comprehensive_SpecialEquipment] CHECK CONSTRAINT [FK_Comprehensive_SpecialEquipment_Base_SpecialEquipment]
							 | 
						|||
| 
								 | 
							
								GO
							 |