主要介绍了mybatis一对多查询功能,非常不错,具有参考借鉴价值,需要的朋友可以参考下
2024-05-05 17:21:17 148KB mybatis 一对多查询
1
生成数据库的语句如下: 数据库是试用mysql数据库 /* Navicat MySQL Data Transfer Source Server : mysqlTest Source Server Version : 50022 Source Host : localhost:3306 Source Database : ibatis_db Target Server Type : MYSQL Target Server Version : 50022 File Encoding : 65001 Date: 2013-05-02 22:49:28 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `book` -- ---------------------------- DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `oid` int(10) NOT NULL, `name` varchar(50) default NULL, PRIMARY KEY (`oid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of book -- ---------------------------- INSERT INTO `book` VALUES ('1', 'java开发宝典'); -- ---------------------------- -- Table structure for `book_user` -- ---------------------------- DROP TABLE IF EXISTS `book_user`; CREATE TABLE `book_user` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(50) default NULL, `book_oid` int(10) default NULL, PRIMARY KEY (`id`), KEY `FK_user_1` (`book_oid`), CONSTRAINT `FK_user_1` FOREIGN KEY (`book_oid`) REFERENCES `book` (`oid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of book_user -- ---------------------------- INSERT INTO `book_user` VALUES ('1', 'tom', '1'); INSERT INTO `book_user` VALUES ('2', 'lily', '1');
2021-06-29 22:50:02 1.77MB ibatis
1