MyBatis关联查询简单示例
首先在数据库bookstore中建立三张表,分别是BSuser,author,reader CREATE TABLE `author` ( `id` int(11) NOT NULL AUTO_INCREMENT, `realName` varchar(20) COLLATE utf8_bin DEFAULT NULL, `userID` int(11) DEFAULT NULL, `IDCard` varchar(20) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; CREATE TABLE `BSuser` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userName` varchar(20) COLLATE utf8_bin DEFAULT NULL, `password` varchar(20) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;