美文网首页
2018-05-17 mybits进一步理解

2018-05-17 mybits进一步理解

作者: 江江江123 | 来源:发表于2018-05-17 16:55 被阅读0次

之前觉得使用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>

相关文章

网友评论

      本文标题:2018-05-17 mybits进一步理解

      本文链接:https://www.haomeiwen.com/subject/epxidftx.html