myibatis 一对一 一对多 多对多 (网络整理)

说实话,eclipse我受够了.
自从用了Intellijidea ,我的腰不酸了,腿不疼了,一口气能上一层楼.
先上代码结构
myibatis 一对一 一对多 多对多 (网络整理)_第1张图片

数据库表结构


 1 CREATE DATABASE  `test`  ;
 2 
 3 USE `test`;
 4 
 5 /*Table structure for table `group_info` */
 6 
 7 DROP TABLE IF EXISTS `group_info`;
 8 
 9 CREATE TABLE `group_info` (
10   `id` int(11NOT NULL auto_increment,
11   `name` varchar(40) collate utf8_bin default NULL,
12   `createdate` timestamp NULL default CURRENT_TIMESTAMP,
13   `state` int(1default '0' COMMENT '0:??;1:???',
14   PRIMARY KEY  (`id`)
15 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
16 
17 /*Table structure for table `idcard` */
18 
19 DROP TABLE IF EXISTS `idcard`;
20 
21 CREATE TABLE `idcard` (
22   `cd_id` int(11NOT NULL auto_increment,
23   `cd_card_number` int(11default NULL,
24   `cd_address` varchar(255default NULL,
25   PRIMARY KEY  (`cd_id`)
26 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27 
28 /*Table structure for table `t_dept` */
29 
30 DROP TABLE IF EXISTS `t_dept`;
31 
32 CREATE TABLE `t_dept` (
33   `dp_id` int(11NOT NULL auto_increment,
34   `dp_name` varchar(255default NULL,
35   `dp_desc` varchar(255default NULL,
36   PRIMARY KEY  (`dp_id`)
37 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38 
39 /*Table structure for table `t_person` */
40 
41 DROP TABLE IF EXISTS `t_person`;
42 
43 CREATE TABLE `t_person` (
44   `ps_id` int(11NOT NULL auto_increment,
45   `ps_name` varchar(255default NULL,
46   `ps_password` varchar(255default NULL,
47   `ps_cd_id` int(11default NULL,
48   `ps_dept_Id` int(11default NULL,
49   PRIMARY KEY  (`ps_id`)
50 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
51 
52 /*Table structure for table `user` */
53 
54 DROP TABLE IF EXISTS `user`;
55 
56 CREATE TABLE `user` (
57   `id` int(11NOT NULL auto_increment,
58   `name` varchar(40) collate utf8_bin default NULL,
59   `password` varchar(20) collate utf8_bin default NULL,
60   `createtime` timestamp NULL default CURRENT_TIMESTAMP,
61   PRIMARY KEY  (`id`)
62 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
63 
64 /*Table structure for table `user_group` */
65 
66 DROP TABLE IF EXISTS `user_group`;
67 
68 CREATE TABLE `user_group` (
69   `user_idint(11default NULL,
70   `group_id` int(11default NULL,
71   `createdate` timestamp NULL default CURRENT_TIMESTAMP,
72   KEY `FK_user_group_user_id` (`user_id`),
73   KEY `FK_user_group_group_id` (`group_id`)
74 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;



maven的pom.xml(不得不说maven,大大的好)


  1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3    <!-- <parent>
  4         <artifactId>p1</artifactId>
  5         <groupId>p1</groupId>
  6         <version>1.0</version>
  7     </parent>-->
  8     <modelVersion>4.0.0</modelVersion>
  9     <groupId>p1</groupId>
 10     <artifactId>p1_app</artifactId>
 11     <version>1.0</version>
 12     <packaging>jar</packaging>
 13 
 14     <properties>
 15         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 16         <spring.version>3.0.5.RELEASE</spring.version>
 17         <aspectj.version>1.6.10</aspectj.version>
 18     </properties>
 19     <dependencies>
 20         <dependency>
 21             <groupId>junit</groupId>
 22             <artifactId>junit</artifactId>
 23             <version>4.7</version>
 24         </dependency>
 25         <dependency>
 26             <groupId>log4j</groupId>
 27             <artifactId>log4j</artifactId>
 28             <version>1.2.14</version>
 29         </dependency>
 30         <dependency>
 31             <groupId>dom4j</groupId>
 32             <artifactId>dom4j</artifactId>
 33             <version>1.6.1</version>
 34         </dependency>
 35         <dependency>
 36             <groupId>jaxen</groupId>
 37             <artifactId>jaxen</artifactId>
 38             <version>1.1.1</version>
 39         </dependency>
 40         <dependency>
 41             <groupId>velocity</groupId>
 42             <artifactId>velocity</artifactId>
 43             <version>1.5</version>
 44         </dependency>
 45         <dependency>
 46             <groupId>org.apache.commons</groupId>
 47             <artifactId>commons-io</artifactId>
 48             <version>1.3.2</version>
 49             <scope>test</scope>
 50         </dependency>
 51         <dependency>
 52             <groupId>commons-dbcp</groupId>
 53             <artifactId>commons-dbcp</artifactId>
 54             <version>1.4</version>
 55         </dependency>
 56         <dependency>
 57             <groupId>mysql</groupId>
 58             <artifactId>mysql-connector-java</artifactId>
 59             <version>5.1.9</version>
 60         </dependency>
 61         <dependency>
 62             <groupId>org.mybatis</groupId>
 63             <artifactId>mybatis</artifactId>
 64             <version>3.0.4</version>
 65         </dependency>
 66         <dependency>
 67             <groupId>org.mybatis</groupId>
 68             <artifactId>mybatis-guice</artifactId>
 69             <version>3.2</version>
 70         </dependency>
 71         <dependency>
 72             <groupId>org.mybatis</groupId>
 73             <artifactId>mybatis-spring</artifactId>
 74             <version>1.0.0</version>
 75         </dependency>
 76         <dependency>
 77             <groupId>org.springframework</groupId>
 78             <artifactId>spring-core</artifactId>
 79             <version>${spring.version}</version>
 80         </dependency>
 81         <dependency>
 82             <groupId>org.springframework</groupId>
 83             <artifactId>spring-webmvc</artifactId>
 84             <version>${spring.version}</version>
 85         </dependency>
 86         <dependency>
 87             <groupId>org.springframework</groupId>
 88             <artifactId>spring-beans</artifactId>
 89             <version>${spring.version}</version>
 90         </dependency>
 91         <dependency>
 92             <groupId>org.springframework</groupId>
 93             <artifactId>spring-context</artifactId>
 94             <version>${spring.version}</version>
 95         </dependency>
 96         <dependency>
 97             <groupId>org.springframework</groupId>
 98             <artifactId>spring-aop</artifactId>
 99             <version>${spring.version}</version>
100         </dependency>
101         <dependency>
102             <groupId>org.springframework</groupId>
103             <artifactId>spring-tx</artifactId>
104             <version>${spring.version}</version>
105         </dependency>
106         <dependency>
107             <groupId>org.springframework</groupId>
108             <artifactId>spring-test</artifactId>
109             <version>${spring.version}</version>
110         </dependency>
111         <dependency>
112             <groupId>org.aspectj</groupId>
113             <artifactId>aspectjrt</artifactId>
114             <version>${aspectj.version}</version>
115         </dependency>
116         <dependency>
117             <groupId>org.aspectj</groupId>
118             <artifactId>aspectjweaver</artifactId>
119             <version>${aspectj.version}</version>
120         </dependency>
121 
122         <dependency>
123             <groupId>org.mongodb</groupId>
124             <artifactId>mongo-java-driver</artifactId>
125             <version>2.6.5</version>
126         </dependency>
127     </dependencies>
128 
129 </project>
130 

其他的就不贴了,都在压缩包里.
由于使用的IDE是intellijidea,导入到eclipse时,需使用maven命令mvn eclipse:eclipse 好像是.....
/Files/czcode/p1_app.rar

你可能感兴趣的:(myibatis 一对一 一对多 多对多 (网络整理))