package cn.hmsoft.weixin.data.dao;

import org.springframework.stereotype.Component;

import cn.hmsoft.helper.StringHelper;
import cn.hmsoft.jdbc.core.PlatformDaoSupport;
import cn.hmsoft.jdbc.entity.Pager;
import cn.hmsoft.jdbc.entity.QueryOrder;
import cn.hmsoft.weixin.data.model.WxParam;

@Component
public class WxParamDao extends PlatformDaoSupport<WxParam> {

	public Pager pageParam(Integer wx_id, Integer start, Integer limit, String query, QueryOrder order) {
		String sql = "select * from wx_param where (wx_id=0 or wx_id=?)";
		if (StringHelper.isEmpty(query))
			return this.pageBySql(order, start, limit, sql, wx_id);
		sql = sql + " and (param_name like ?  or param_value like ?)";
		return this.pageBySql(order, start, limit, sql, wx_id, "%" + query + "%", "%" + query + "%");
	}

}