mybatis去重查询对象封装时只封装1条

g084120209 发布于 2017/01/06 10:47
阅读 442
收藏 0

我想查询出一个学校的所有年级的所有班级,sql语句:select distinct grade,className from t_stu_parent WHERE   school_id=1  limit 0,8;


sql语句在mysql命令行中执行是没问题的,但是通过mybatis执行的时候,只查询出1条。mybatis查询:

<select id="getPageStuParByGradeAndClass"  resultMap="studentMap"  parameterType="java.util.Map">
           select distinct grade,className from t_stu_parent   
        <where>
           school_id=#{school.id}
             <if test="stuPar!=null and stuPar.grade!=null and stuPar.grade!=''">
               <![CDATA[ and grade =#{stuPar.grade} ]]>
            </if>
            <if test="stuPar!=null and stuPar.className!=null and stuPar.className!=''">
               <![CDATA[ and className=#{stuPar.className}]]>
            </if>
        </where>
           <if test="page.pageNum!=0 and page.pageCount!=0">
               <![CDATA[ limit ${ page.startIndex} ,${ page.pageCount}   ]]>
           </if>
     </select>



求大神帮帮忙,我感激不尽!

加载中
0
l
leeko
接口定义成List<?> 就可以了啊
返回顶部
顶部