Design of time period data

        When I design a table now, I usually add two fields of date type, begin_dt and end_dt. Represents valid data for a certain time period.

 

        When there is a time period field, it can be applied to the following scenarios:

        1. Soft deletion of data: update the end_dt time to the current time minus one second.

        2. Support for historical query of reports: Query the calculation and statistics of valid data at a certain time point, including dictionary data of relationships, which is valid at the corresponding time point.

        3. Pre-set data: pre-configure permissions, and set the start time to the effective time point. Configure dynamic keys at different time points on the data dictionary. For the configuration of the menu, new functions need to be released, and the new menu for the time period can be pre-configured.

 

       This design is widely used in sap's hrm system, such as: educational experience, organizational structure, relationship between superiors and subordinates, transfer records, and so on.

      

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326691475&siteId=291194637