Device Resource Management System-Data Dictionary
User information table:
User ID (primary key) name age gender unit address in Service
1 Zhang San 23 1 1 Beijing shangdihuan DAO 1
2 Li Si 22 2 2 Shanghai Pudong 1
3 Wang Wu 22 1 3 Shenzhen Meisha 1
4 Zhao liu24 1 1 Beijing Zhongguancun 2
Enter (error data)
The system introduces a data dictionary for data type maintenance:
Code name Data Type
1 male
2 female
1 Beijing affiliated Unit
2 Shanghai Enterprise
3 Shenzhen Enterprise
4 Tianjin Enterprise
1. Is it in service?
2. Are you in service?
Statistics on employee gender:
Male: 3
Female: 1
Unit of statistics:
Beijing: 2
Shanghai: 1
Shenzhen: 1
Drop-down menu (unit ):
Beijing
Shanghai
Shenzhen
Tianjin
--------------------
You can use a data dictionary to dynamically generate data.
Advantages:
1. Data items can be dynamically generated based on the data type.
2. It is easy to collect statistics on system data, and collect statistics on fields such as the unit, gender, and whether or not the system is in service.
3. Basic data items of the system can be maintained.
Table Design:
Features:
1. The code of the data item cannot be repeated and is arranged in sequence starting from 1.
2. The name of the data item cannot be repeated.
3. Data Type, data item code, and data item name cannot be blank
Operation:
1. Organize hql statements and query the database. Note: (for hql statements, use disctinct to remove duplicate values and display the data type list)
2. Convert the form output object of VO from the Po object
Operation: (asynchronous call)
1. Obtain the value of "data type (keyword)" passed on the page.
2. Organize hql statements and query data types to obtain the code and value values of the corresponding data items in the data type.
3. the query result is converted from the Po object to the VO object.
- Data dictionary storage (added, modified, and deleted in one step)
Passing parameters:
1. Hidden: keywordname, used to store the data type to be saved
2. Hidden: typeflag, used to determine whether the storage is new or modified based on the original data type
Parameter New: adds a data type.
Parameter Add: modified based on the original data type
3. Input = text: itemname: transmits a string-type array to store the name value of the data item.
Operation:
1. receive three passed parameters: keywordname, typeflag, and itemname [].
2. Determine whether typeflag is 'new' or 'add'
(1) If typeflag = new
I. Make the passed parameters into a PO (elecsystemddl) object.
Ii. Run save ()
(2) If typeflag = add
I. Use keywordname to query the corresponding data set under the keywordname. A list is returned and the delete method is called to delete the value of this data type.
Ii. Make the passed parameters into a PO (elecsystemddl) object.
Iii. Execute save ()
Original data:
Data Type data item code data item name
Unit 1 Beijing
Enterprise 2 Shanghai
Enterprise 3 Shenzhen
Current data:
Data Type data item code data item name
Unit 1 Beijing
Unit 2 Tianjin
Enterprise 3 Shenzhen
Unit 4 Zhengzhou
Unit 5 Shenyang
There are two implementation methods for the above:
Method 1:
1, 2, 3 for Modification
4 ~... Used to add
Method 2: (method 2)
By using the data type, you can delete all data under the Data Type and save the Organization parameters to the database.