首页 > 其他 > 详细

MyBatis 多个查询条件的传递

时间:2015-05-16 20:11:09      阅读:300      评论:0      收藏:0      [点我收藏+]
<!--
    方法1,构建查询对象;
    QueryCondition qc = new QueryCondition();
    qc.setGender(1);
    qc.setBirthday(new Date());
-->
<select id="selectPersonByParams" parameterType="com.stone.model.QueryCondition" resultMap="BaseResultMap">
    <![CDATA[
     select * from person t where t.gender=#{gender} and t.birthday <#{birthday}
    ]]>
</select>

<!--
    方法2,使用map;
    map.put("gender",1);
    map.put("birthday",new Date());
-->
<select id="selectPersonByParams" parameterType="java.util.Map" resultMap="BaseResultMap">
    <![CDATA[
     select * from person t where t.gender=#{gender} and t.birthday <#{birthday}
    ]]>
</select>

 

MyBatis 多个查询条件的传递

原文:http://www.cnblogs.com/stono/p/4508343.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!