之前觉得使用hibernate和mybits在做关联查询很不方便。。今天突然询问别人有更方便的查询时意外明白mybits从来不限制能查到什么东西。。只要写好要查哪个对象,加上id。。想查哪个表随心所欲。。而关键查询更不在话下。。
//想查什么
<resultMap id="BaseResultMap" type="com.schoolbag.model.TBag">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="status" jdbcType="CHAR" property="status" />
</resultMap>
//查询
<select id="getBagList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM t_bag t
</select>
网友评论