Skip to content

Commit

Permalink
refactor: implements DAO layer with mybatis and spring framework
Browse files Browse the repository at this point in the history
  • Loading branch information
wrayzheng committed Aug 8, 2018
1 parent 8cc673d commit 58098fa
Show file tree
Hide file tree
Showing 62 changed files with 3,002 additions and 5,066 deletions.
54 changes: 27 additions & 27 deletions init_db.sql
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
CREATE TABLE IF NOT EXISTS `User` (
`UserName` varchar(16) NOT NULL,
`Password` char(64) NOT NULL,
`Email` varchar(64) NOT NULL,
`PushTime` time NOT NULL,
PRIMARY KEY (`UserName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Url` (
`UrlID` int(11) NOT NULL AUTO_INCREMENT,
`UserName` varchar(16) NOT NULL,
`Title` varchar(100) NOT NULL,
`Url` text NOT NULL,
`Enabled` tinyint(1) NOT NULL,
`RealTimePush` tinyint(1) NOT NULL,
PRIMARY KEY (`UrlID`),
FOREIGN KEY (`UserName`) REFERENCES `User` (`UserName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Content` (
`ContentID` int(11) NOT NULL AUTO_INCREMENT,
`UrlID` int(11) NOT NULL,
`Html` text NOT NULL,
`Delta` text NOT NULL,
PRIMARY KEY (`ContentID`),
FOREIGN KEY (`UrlID`) REFERENCES `Url` (`UrlID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `User` (
`UserName` varchar(16) NOT NULL,
`Password` char(64) NOT NULL,
`Email` varchar(64) NOT NULL,
`PushTime` time NOT NULL,
PRIMARY KEY (`UserName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Url` (
`UrlID` int(11) NOT NULL AUTO_INCREMENT,
`UserName` varchar(16) NOT NULL,
`Title` varchar(100) NOT NULL,
`Url` text NOT NULL,
`Enabled` tinyint(1) NOT NULL,
`RealTimePush` tinyint(1) NOT NULL,
PRIMARY KEY (`UrlID`),
FOREIGN KEY (`UserName`) REFERENCES `User` (`UserName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `Content` (
`ContentID` int(11) NOT NULL AUTO_INCREMENT,
`UrlID` int(11) NOT NULL,
`Html` text NOT NULL,
`Delta` text NOT NULL,
PRIMARY KEY (`ContentID`),
FOREIGN KEY (`UrlID`) REFERENCES `Url` (`UrlID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19 changes: 18 additions & 1 deletion module-dao/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,28 @@
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
<!-- 整合 mybatis 与 spring 所依赖的 API -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
<version>6.0.6</version>
</dependency>
<!-- 数据库连接池 -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 58098fa

Please sign in to comment.