实现自定义审批流程,表设计分两类,一是流程模板,2是流程实例与任务日志
流程模板包含:流程模板主表、流程节点表、流程分支表、表单与流程关系表
流程实例:流程实例主表、流程实例节点表、流程实例分支表、流程任务、流程日志。
业务思路大致是:先构建流程模板、绑定模板与表单、发起表单时调用对应的模板进行生成流程实例、冗余模板对应的流程到实例中、审核流转过程中对任务进行下发预处理。
CREATE TABLE [dbo].[approveflow_formbasicinfo](
[Id] [bigint] NOT NULL,
[FormCode] [nvarchar](50) NULL,
[FormEntityName] [nvarchar](500) NULL,
[FormTableName] [nvarchar](50) NULL,
[FormDesc] [nvarchar](50) NULL,
[CreaterID] [bigint] NULL,
[CreateTime] [datetime] NULL,
[ModifierID] [bigint] NULL,
[ModifyTime] [datetime] NULL,
[IsDeleted] [bit] NULL,
[CreaterName] [nvarchar](50) NULL,
[ModifierName] [nvarchar](50) NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ((0)) FOR [Id]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [FormCode]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [FormEntityName]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [FormTableName]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [FormDesc]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ((0)) FOR [CreaterID]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT (getdate()) FOR [CreateTime]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ((0)) FOR [ModifierID]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT (getdate()) FOR [ModifyTime]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ((0)) FOR [IsDeleted]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [CreaterName]
GO
ALTER TABLE [dbo].[approveflow_formbasicinfo] ADD DEFAULT ('') FOR [ModifierName]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'主键' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'表单编码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'FormCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'表单实体名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'FormEntityName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'表单数据表名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'FormTableName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'表单描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'FormDesc'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'CreaterID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'CreateTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编辑人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'ModifierID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编辑时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'ModifyTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否删除' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'IsDeleted'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'CreaterName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'编辑人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'approveflow_formbasicinfo', @level2type=N'COLUMN',@level2name=N'ModifierName'
GO