mybatis中,表作为参数${table}的分页查询

我先介绍下一,我们这个项目用到的日志是每天生成的然后 ,要查询日期范围内的 数据 然后分页 废话不罗嗦了,看代码

    <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>
    

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值