mybatis 配置-简单记录一下,免得忘记了
2016-10-27 15:26
351 查看
<!-- 用户信息 --> <resultMap id="BaseResultMap" type="com.test.model.User" > <id column="id" property="id" jdbcType="BIGINT" /> <result column="user_name" property="userName" jdbcType="VARCHAR" /> <result column="user_status" property="userStatus" jdbcType="SMALLINT" /> </resultMap> <!-- 用户与用户的备注信息信息,一个用户有一个用户备注信息 select * from user u inner join remarkInfo r on u.id=r.user_id--> <resultMap id="userAndRemarkInfoResultMap" extends="BaseResultMap" type="com.test.model.User"> <association property="userRemarkInfo" resultMap="userRemarkInfoBaseResultMap"></association> </resultMap> <!-- 用户的备注信息信息 --> <resultMap id="userRemarkInfoBaseResultMap" type="com.test.model.UserRemarkInfo" > <id column="remarkId" property="id" jdbcType="BIGINT" /> <!-- remarkId 为别名 ,查询用户以及用户备注信息的时候防止id字段相同值覆盖 --> <result column="use_age" property="useCpu" jdbcType="INTEGER" /> <result column="use_sex" property="useMemory" jdbcType="SMALLINT" /> <result column="user_id" jdbcType="BIGINT" property="userId" /> </resultMap> <!-- 用户与用户的备注信息信息以及用户的房产信息,一个用户有一个用户备注信息,多个房产信息 select * from user u inner join remarkInfo r on u.id=r.user_id left join hourseInfo h on u.id=h.user_id --> <resultMap id="userAndRemarkInfoAndHourseInfoResultMap" extends="userAndRemarkInfoResultMap" type="com.test.model.User"> <collection property="hourseList" ofType="com.chinac.cpc.model.hourse" column="userId"> <id column="h_id" jdbcType="BIGINT" property="id" /> <result column="hourse_name" jdbcType="VARCHAR" property="hourseName" /> <result column="hourse_addr" jdbcType="VARCHAR" property="hourseAddr" /> <result column="user_id" jdbcType="BIGINT" property="userId" /> </collection> </resultMap>
相关文章推荐
- 简单的MogileFS-2.44安装及配置过程记录一下
- 简单记录一下phpmyadmin的https配置
- 关于c# 和 SQL SERVER 2000 日期比较查询的一点点经验,记录一下,免得忘记!
- 简单的SQL语句记一下,免得自己忘记
- Linux系统日志记录到远程服务器简单配置
- SUSE下telnet的简单配法,转贴 -- 记录一下,以便备份
- 安装和配置Apache,PHP,Mysql.记录一下。
- 在Windows2003环境中,AWStats 简单的配置记录
- 记录Windows Service简单DEMO以及配置..
- 简单记录一下Linux gadget serial的工作
- MOSS Search学习记录(二):配置爬网并尝试一个简单的搜索
- 简单判断用户重复登录,记录一下
- js操作dataset以及datatable(记录一下老是忘记)
- 记录一下,gvim配置文件
- 记录一下,gvim配置文件
- 对ManualResetEvent的简单理解(记录以备忘记)
- 简单介绍一下linux下的ftp服务及相关配置
- Linux 下配置 IP(这么简单居然经常忘记)
- 备份一下输出流,免得久不用忘记掉
- 最近系统整理一下 linux 各配置文件备份、编译命令备份、源文件路径、编译命名路径等记录