今天碰到一個關于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的
添加回答
舉報
0/150
提交
取消
