Loading

MyBatis 多个查询条件的传递

<!--
    方法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>

 

posted @ 2015-05-16 18:32  stono  阅读(499)  评论(0编辑  收藏  举报