mybatis 动态传多表分页查询

来源:互联网 发布:公司域名邮箱注册 编辑:程序博客网 时间:2024/06/04 17:56
我先介绍下一,我们这个项目用到的日志是每天生成的然后 ,要查询日期范围内的 数据 然后分页 废话不罗嗦了,看代码
    <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>    

原创粉丝点击