package cn.hmsoft.hmplatform.identity.data.dao;

import org.springframework.stereotype.Repository;
import cn.hmsoft.helper.StringHelper;
import cn.hmsoft.hmplatform.identity.data.model.PStdReg;
import cn.hmsoft.jdbc.core.PlatformDaoSupport;
import cn.hmsoft.jdbc.entity.Pager;
import cn.hmsoft.jdbc.entity.QueryOrder;

@Repository
public class PStdRegDao extends PlatformDaoSupport<PStdReg> {

	public Pager pageStd(Integer start, Integer limit, String query, QueryOrder queryOrder) {
		StringBuilder sql = new StringBuilder();
		sql.append("select s.* from p_std_reg s ");
		sql.append("where 1=1 ");
		if (StringHelper.isEmpty(query)) {
			return this.pageMapBySql(queryOrder, start, limit, sql.toString());
		}
		sql.append(" and (s.std_name like ? or s.cert_id like ? or s.from_project like ?)");
		return this.pageMapBySql(queryOrder, start, limit, sql.toString(), "%" + query + "%", "%" + query + "%", "%" + query + "%");
	}

}
