AugustLeo_cheng 2015-11-06 02:03 采纳率: 100%
浏览 7931
已采纳

Mybatis 返回类型问题 list selectOne()

报错:nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 17
我返回的类型明明就是list 为什么还是报这个错

这个是我Mapper的

    public List<RefusalCause> findPage(DefaultCriteria obj);

    public Long findPageCount(DefaultCriteria obj);

    public List<RefusalCause> refusalCause(DefaultCriteria obj);

这个是Mapper.xml

 <resultMap type="com.xxx.o2o.model.RefusalCause" id="refusalCause">
        <result property="refusalTime" column="refusalTime" />
        <result property="noStore" column="noStore" />
        <result property="idCheck" column="idCheck" />
        <result property="preRefuse" column="preRefuse" />
        <result property="noLocNoSecurity" column="noLocNoSecurity" />
        <result property="FNoSecurity" column="FNoSecurity" />
        <result property="MNoSecurity" column="MNoSecurity" />
    </resultMap>



    <select id="refusalCause" parameterType="com.xxx.o2o.model.RefusalCause"
        resultMap="refusalCause">
        select date_format(update_time,'%y-%m-%d') as refusalTime,
        sum(case
        when
        close_reason=1 then 1 else 0 end) as noStore,
        sum(case
        when
        close_reason=2 then 1 else 0 end) as idCheck,
        sum(case when
        close_reason=3 then 1 else 0 end) as preRefuse,
        sum(case when
        close_reason=5 then 1 else 0 end) as noLocNoSecurity,
        sum(case when
        close_reason=7 then 1 else 0 end) as FNoSecurity,
        sum(case when
        close_reason=8 then 1 else 0 end) as MNoSecurity
        from t_order_overview
        where order_id in (
        select order_id from t_order_history where
        1 = 1 and
        order_status = 10
        and
        <![CDATA[order_time  > '2015-10-12' ]]>
        and
        <![CDATA[order_time < '2015-10-22']]>)

        and is_close = '1' group by
        date_format(update_time,'%y-%m-%d')
    </select>

    <select id="findPage" parameterType="com.xxx.framework.pagination.DefaultCriteria"
        resultMap="refusalCause">
        select date_format(update_time,'%y-%m-%d') as refusalTime,
        sum(case
        when
        close_reason=1 then 1 else 0 end) as noStore,
        sum(case
        when
        close_reason=2 then 1 else 0 end) as idCheck,
        sum(case when
        close_reason=3 then 1 else 0 end) as preRefuse,
        sum(case when
        close_reason=5 then 1 else 0 end) as noLocNoSecurity,
        sum(case when
        close_reason=7 then 1 else 0 end) as FNoSecurity,
        sum(case when
        close_reason=8 then 1 else 0 end) as MNoSecurity
        from t_order_overview
        where order_id in (
        select order_id from t_order_history where
        1 = 1 and
        order_status = 10
        <if test="startTime !=null">
            and order_time &gt; #{startTime}
        </if>
        <if test="endTime !=null">
            and order_time &lt; #{endTime}
        </if>
        )and is_close = '1' group by
        date_format(update_time,'%y-%m-%d')
        order
        by
        refusalTime desc
        limit #{start},#{end}
    </select>
    <select id="findPageCount" parameterType="com.xxx.framework.pagination.DefaultCriteria"
        resultType="Long">
        select count(1)
        from t_order_overview
        where order_id in (
        select order_id
        from t_order_history where
        1 = 1 and
        order_status = 10
        <if test="startTime !=null">
            and order_time &gt; #{startTime}
        </if>
        <if test="endTime !=null">
            and order_time &lt; #{endTime}
        </if>
        )
        and is_close = '1' group by
        date_format(update_time,'%y-%m-%d')
    </select>

求助

  • 写回答

1条回答 默认 最新

  • AugustLeo_cheng 2015-11-06 05:21
    关注

    我知道了 ,我count(1)传回来的是数组,我用了long接收

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题