There are only four tables in the entire project
book-book master table, which records the detailed information of the book, including category, author description, etc.
type- Category table, book category management
menu-catalog chapter table
properties-configuration table
book table Is the main book table
code: used for book code records. This field can be considered to determine the uniqueness of the book
typeId: associated type table primary key id, identifying the book category
title :Book title
author:author
lastMenuId: latest chapter directory, associated menu table primary key id
description: book description
originalUrl (obsolete)
imageUri: Image address, this address is a relative address. The file name of the book display image is recorded
createTime: book entry time
updateTime: last update time
rootTypeId: main category id, tpye table primary key id, see type for details Table record
menuNum: Number of book catalogs
textSize: How many words are there in the current book
menu chapter table :
description: Chapter name
prevMenuId: previous chapter id (menu table primary key id)
nextMenuId: next chapter id (menu table primary key id)
bookId: book id (book table primary key id)
contentUri: text address (this address is the address where the text file is stored on the server)
createTime: chapter entry time
code: Chapter coding (no specific effect)
mversion: Chapter version control (to prevent repeated entry)
## The #type table is the book category table: description: category description level: category level parentId: the parent category it belongs to Category establishment As mentioned above, the main category with level 1 is the main category, and the level below it with level 2 is the subcategory. The parentId of the subcategory is associated with the primary key id of the parent category. The main category has no parent category, that is, the parentId is 0One thing to mention here is that the parent class primary key * 100 is incremented as the primary key id of the subcategory. For example, the parent category with id 101 has an id 1 . The properties table is used for configuration. Consider placing the configuration in the program in properties in the next version. Now this table only has one configuration pKey: Read the corresponding pValue value for the program and display it as a marquee on the homepageThe table creation script is given here for your reference:
<br/>
ET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for book-- ----------------------------DROP TABLE IF EXISTS `book`;CREATE TABLE `book` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '图书主表', `code` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '图书编码(默认图书目录地址,也是图书文件保留目录)', `typeId` int(11) DEFAULT NULL COMMENT '类别', `title` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '书名', `author` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '作者', `lastMenuId` int(11) DEFAULT '0' COMMENT '最新章节目录Id', `description` varchar(500) COLLATE utf8_bin DEFAULT NULL COMMENT '简介描述', `originalUrl` varchar(200) COLLATE utf8_bin DEFAULT NULL COMMENT '已废弃', `imageUri` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '图片地址', `createTime` timestamp NULL DEFAULT NULL COMMENT '创建时间', `updateTime` timestamp NULL DEFAULT NULL COMMENT '更新时间', `rootTypeId` int(11) DEFAULT NULL COMMENT '主类别', `menuNum` int(11) DEFAULT '0' COMMENT '章节总数', `textSize` bigint(18) DEFAULT '0' COMMENT '小说字数', PRIMARY KEY (`id`), UNIQUE KEY `index_title` (`code`) USING BTREE, KEY `FK_mxn08ipa84r1evyt2cnn7jkpi` (`typeId`,`rootTypeId`), KEY `FK_6ji3nbliycexuj771dlqn25s3` (`lastMenuId`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for menu-- ----------------------------DROP TABLE IF EXISTS `menu`;CREATE TABLE `menu` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '描述', `prevMenuId` int(11) DEFAULT '0' COMMENT '上一章id', `nextMenuId` int(11) DEFAULT '0' COMMENT '下一章id', `bookId` int(11) DEFAULT NULL COMMENT '图书id', `contentUri` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '文本路径', `createTime` timestamp NULL DEFAULT NULL COMMENT '创建时间', `code` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '编码(做索引)', `mversion` varchar(45) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mvserion` (`mversion`) USING BTREE, KEY `FK_c6rhyxr26doitte59912cid6v` (`bookId`), CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`bookId`) REFERENCES `book` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=231 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for properties-- ----------------------------DROP TABLE IF EXISTS `properties`;CREATE TABLE `properties` ( `id` int(11) NOT NULL AUTO_INCREMENT, `pKey` varchar(45) COLLATE utf8_bin NOT NULL, `pValue` varchar(256) COLLATE utf8_bin NOT NULL, `description` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '描述', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;-- ------------------------------ Table structure for type-- ----------------------------DROP TABLE IF EXISTS `type`;CREATE TABLE `type` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '类别描述', `level` int(11) DEFAULT NULL COMMENT '类别等级', `parentId` int(11) unsigned DEFAULT '0' COMMENT '父类别', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=702 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
The above is the detailed content of java database table structure. For more information, please follow other related articles on the PHP Chinese website!