今天碰到一個(gè)關(guān)于mybatis的問題 查詢到的數(shù)據(jù)是null首先申明,數(shù)據(jù)庫(kù)是有相關(guān)的數(shù)據(jù),并且sql是正確的,但是調(diào)用的時(shí)候 debug進(jìn)去發(fā)現(xiàn)查出來的list集合是空數(shù)據(jù)。 <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代碼里面調(diào)用這個(gè)查詢數(shù)據(jù)庫(kù)的方法的時(shí)候,方法查出來的數(shù)據(jù)是:只有當(dāng)o.business_type = 2 有顯示查到數(shù)據(jù),o.business_type = 0 和 o.business_type = 1 都是null的
添加回答
舉報(bào)
0/150
提交
取消