<select id="getTaskData" resultType="com.collect.engine.vo.TaskDataVo">
select log.id as id, t.name as name, c.name as channelName,c.site as site,log.count as count,
log.start_time as startTime,log.end_time as endTime
from task_log log left join task t on log.task_id=t.id left join channel c on t.channel_id=c.id
<where>
<if test="param.name != null">
and t.name like '%${param.name}%'
</if>
<if test="param.channelId !=null">
and t.channel_id = #{param.channelId}
</if>
<if test="param.startTime !=null">
and log.start_time >= #{param.startTime,jdbcType=TIMESTAMP}
</if>
<if test="param.endTime !=null">
and log.start_time <= #{param.endTime,jdbcType=TIMESTAMP}
</if>
</where>
order by log.start_time desc limit #{param.index},#{param.pageSize}
</select>
注意时间条件查询,遇到过这种问题,这次再遇见还是出错,不能直接用<=这些
模糊查询还可以用"%"#{param.name}"%"