为了账号安全,请及时绑定邮箱和手机立即绑定

mybatis sql 查询问题

mybatis sql 查询问题

跃然一笑 2019-03-20 18:19:03
今天碰到一个关于mybatis的问题 查询到的数据是null首先申明,数据库是有相关的数据,并且sql是正确的,但是调用的时候 debug进去发现查出来的list集合是空数据。   <resultMap id="RevenuePercsResultMap"    type="com.xxx.common.dto.report.RevenuePercsEntity">    <result property="totalPrice" column="totalPrice" />    <result property="bussinessType" column="bussinessType"/> </resultMap><select id="getCommoditySalesTotalPercentage" resultMap="RevenuePercsResultMap" parameterType="com.xxx.common.param.report.GetReportParam">   select sum(a.`num` * a.price) as totalPrice,o.business_type as bussinessType    from order_detail a right join `order` o on o.id = a.order_id    where o.shop_id = #{param.shopId} and (o.business_type = 0 or o.business_type = 1 or o.business_type = 2)   <if test="param.startTm != null and param.endTm != null and param.startTm != '' and param.endTm != ''">        and o.create_tm between #{param.startTm} and #{param.endTm}   </if>    group by o.business_type</select>在java代码里面调用这个查询数据库的方法的时候,方法查出来的数据是:只有当o.business_type = 2 有显示查到数据,o.business_type = 0 和 o.business_type = 1 都是null的
查看完整描述

1 回答

?
qq_花开花谢_0

TA贡献1835条经验 获得超7个赞

你数据库字段 跟 javabean 的关系在哪?


查看完整回答
反对 回复 2019-04-16
  • 1 回答
  • 0 关注
  • 392 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号