想用ParameterType=Map传入多个参数构造SQL进行查询
<select resultMap="busListMap" parameterType="">
select bs.bus_id as bus_id,bs.arrive_time as up_time,b.start_station
as start_station_id,
b.end_station as end_station_id
from bus b , bus_station bs where b.bus_id = bs.bus_id and
bs.station_id=#{upStationId}
and is_up=1 and b.up_station_line like
#{upStationLineLike} and b.down_station_line
like
#{downStationLineLike}
and (=1 or like #{weeklyLike} or b.run_day like
#{runDayLike} )
order by bs.arrive_time asc
</select>
调试时报 Parameter not found异常
解决方法,使用此方式传参,必须在对应的接口方法用@Param标签定义参数value才行
public List<Bus> getBusList(@Param(value = "upStationId") long upStationId,
@Param(value = "upStationLineLike") String upStationLineLike,
@Param(value = "downStationLineLike") String downStationLineLike,
@Param(value = "weeklyLike") String weeklyLike,
@Param(value = "runDayLike") String runDayLike
) ;