<select id="selectSpAmtBetweenDate" resultMap="SumAmtResultMap">
select
<include refid="Base_Column_List" />,
SUM(sp_amt) as sp_sum_amt
from shelf_pay sp
where sp.sp_shelf_no = #{shelfNo} and sp.sp_time >=#{startDate}
and sp.sp_time < #{endDate}
group by sp.sp_shelf_no
</select>
<select id="selectAllSpAmtFromStartDate" resultMap="SumAmtResultMap">
select
<include refid="Base_Column_List" />,
SUM(sp_amt) as sp_sum_amt
from shelf_pay sp
left join billinfo bi on sp.sp_shelf_no = bi.device_id
left join user_shelf us on us.shelf_id = sp.sp_shelf_no
where bi.bill_status= #{status} and sp.sp_time >=bi.bill_startDate
AND us.user_id = #{userId}
group by sp.sp_shelf_no
</select>
这两个select上面那个是能够正常返回的 下面那个的确是没有查询出来。但在数据库工具中是能查询出来的。后面一个多了两个连接 。
始终找不到问题原因。还望赐教。
你可以把执行的sql打印在控制台,观察一下