package cn.hmsoft.frame.data.dao;

import org.springframework.stereotype.Repository;

import cn.hmsoft.frame.data.model.FrameRegionProvince;
import cn.hmsoft.helper.StringHelper;
import cn.hmsoft.jdbc.core.PlatformDaoSupport;
import cn.hmsoft.jdbc.entity.Pager;
import cn.hmsoft.jdbc.entity.QueryOrder;

@Repository
public class FrameRegionDao extends PlatformDaoSupport<FrameRegionProvince> {
	public Pager pageProvince(Integer start, Integer limit, String query, QueryOrder order) {
		String sql = "select * from frame_region_province where 1=1  ";
		if (StringHelper.isEmpty(query)) {
			return this.pageMapBySql(order, start, limit, sql);
		}
		String value = this.generateLikeParamter(query);
		sql = sql
				+ " and  (province_name like ? or province_abbr like ? or province_capital like ? or province_short_name=?)";
		return this.pageMapBySql(order, start, limit, sql, value, value, value, query);
	}

}
