简体   繁体   English

用于存储合同的数据库:mysql + php,处理数据库设计中的编号项目

[英]Database for storing contracts: mysql + php, handling numbered items in database design

I'm looking for solutions to store the contracts in the database. 我正在寻找将合同存储在数据库中的解决方案。 I use mysql + php. 我使用mysql + php。 A contract looks like this 合同看起来像这样

Contract # place holder 合同编号place holder

place place holder date place holder place holder日期place holder

  1. GENERAL TERMS 一般条款

1.1. 1.1。 text-text-text place holder text-text-text 文本文本文本place holder文本文本文本

... ...

  1. FINANCIAL TERMS 财务条款

2.1. 2.1。 text-text-text place holder 文本-​​文本-文本place holder

and so on. 等等。

The things to be put instead of the place holder s will come a DB query. 代替place holder放置的东西将是数据库查询。

My first idea is to create 3 tables (simplified): 1st with contract numbers, 2nd with numbered items (1, 1.1, ... 2, 2.1, ...) and textual fields relating to the numbered items, and 3rd having many-to-many relationship between the 1st and the 2nd table. 我的第一个想法是创建3个表(简化表):第一个具有合同编号,第二个具有编号项目(1、1.1,...,2.1,...)和与编号项目有关的文本字段,第三个具有多个项目第一和第二表之间的一对多关系。 I'm afraid that this solution is a nightmare to maintain because the textual fields can change, some may be left out completely depending on the contract. 恐怕此解决方案将是维护的噩梦,因为文本字段可能会更改,根据合同,某些字段可能会完全遗漏。

What are the possible solutions to my problem? 我的问题有哪些可能的解决方案? One thing to keep in mind is that I want to display the contract in the html later, or maybe in a Word document, whatever is easier. 要记住的一件事是,我想稍后在html或Word文档中显示合同,无论哪种方法都更容易。

After searching the internet and trials + errors, replacement of place holders for the needed data from the DB is not a problem (obviously). 搜索互联网并进行试验+错误后,从数据库中替换占位符以获取所需数据不是问题(很明显)。 The problem is how to get the numbered items from the database and not have a DB design nightmare. 问题是如何从数据库中获取编号的项目,而又没有DB设计的噩梦。 In the end, decided to go with one TEXTual field in mysql that stores the complete text of the contract. 最后,决定在mysql中使用一个TEXTual字段来存储合同的完整文本。 Then use something like http://parsedown.org/ that'll format the numbered items well. 然后使用类似http://parsedown.org/的格式,可以很好地格式化编号的项目。 Then the person who's not familiar with the html markup can correct the contract text if necessary, and Parsedown (or similar) will take care of the proper html layout. 然后,不熟悉html标记的人可以在必要时更正合同文本,并且Parsedown(或类似文件)将处理正确的html布局。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM