Activiti6 self-road (nine) - leave application and leave the database table design approval

A, leave request flowchart Review

We designed a flow chart in front of your approval process, and completion of the flowchart Task allocation function,

Here Insert Picture Description

The above-described flowchart has four task node

1, fill out the application for leave
Here Insert Picture Description
2, manager for approval
Here Insert Picture Description
3, Director for approval
Here Insert Picture Description
4. Approval of Human Resources

Here Insert Picture Description

Two, Activiti table design principles: flow data and traffic data for phase separation

These four tasks, each equipped with four form form. Activiti but did not provide table service store to store form data.

Activiti related table is only responsible for the jump process, to and so on. Business table Business Forms data produced in the process, approval comments, attachments, etc. stored in the developer-defined.

Interconnected by processInstanceId (process instance ID), and traffic flow between the primary key data and business data.

Why not use Activiti related table to store form data and attachments?

See Table act_hi_detail find, using the Activiti longitudinal mode table stored form data, the data is assumed that a leave request form have a number of fields, it would need to be adjusted accordingly original cross-memory recording requires only one table stored in the record data Here Insert Picture Descriptionwhile using the vertical table way will have the following questions:

1, there will be a lot of redundant data and dramatically increase the amount of data

2, query complexity, low query efficiency

3, not suitable for statistical analysis reports late

4, Activiti storage accessory that uses Blob data format in the database, the database data files can become large file storage, database backup and is not conducive to migration.

Third, the leave application process table design business

For these conditions, typically establishes a corresponding leave application process, the form data is stored separately.

Leave Application Form

Field Types of Are Empty Remark
id varchar(64) not null Primary key
process_instance_id varchar(64) not null Process instance id
user_id varchar(64) not null Applicants user id
reason varchar(200) not null Leave Application reason
time int not null Leave days
name varchar(64) not null Name of applicant
process_status varchar(64) not null Process state (0: application; 1: Approval; 2: approved by; 3: Approval not through)
submitTime data not null Date of submission
createTime data not null Creation Date
updateTime data not null Modified Date

Leave Application Form

Field Types of Are Empty Remark
id varchar(64) not null Primary key
process_instance_id varchar(64) not null Process instance id
task_id varchar(64) not null Activti task id
user_id varchar(64) not null Approver user id
result varchar(64) not null Approval result (0: not pass; 1: pass)
remark varchar(200) not null Remark
name varchar(64) not null Approval name
createTime data not null Creation Date
updateTime data not null Modified Date

Guess you like

Origin blog.csdn.net/qq_29914837/article/details/92396204