我先介绍下一,我们这个项目用到的日志是每天生成的然后 ,要查询日期范围内的 数据 然后分页 废话不罗嗦了,看代码
<select id="getResourceAllList" parameterType="java.util.Map"
resultType="ResourseLog" statementType="STATEMENT">
<foreach item="da" index="index" collection="tableTime" open=" " separator="UNION All" close=" ">
SELECT *
FROM resourse${da}
<where>
<if test="id!=null">
and uid=${id}
</if>
<if test="itemID!=null">
and itemID=${itemID}
</if>
<if test="res!=null and res!=''">
and logReason like concat('%','${res}','%')
</if>
<if test="serverIds!=null">
and serverId in
<foreach item="item" index="index" collection="serverIds" open="(" separator="," close=")">
${item}
</foreach>
</if>
</where>
</foreach> limit ${skip},${take}
</select>