package cn.hmsoft.frame.data.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.hmsoft.frame.data.model.FrameModule;
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 FrameModuleDao extends PlatformDaoSupport<FrameModule>{

	
	public Pager pageModule(Integer start, Integer limit, String query, QueryOrder order) {		
		return super.pageBySql(order, start, limit, "select * from frame_module order by load_order ");
	}
	
	private final static String LIST_MODULE_SQL = "select * from frame_module where project_name like ? or 1=? order by load_order";

	/***********************
	 * 查询参数列表
	 * 
	 * @param project_name 如果为空，返回所有参数
	 * @return
	 */
	public List<FrameModule> listModule(String project_name) {
		 List<FrameModule> list = this.listBySql(LIST_MODULE_SQL, StringHelper.isNotEmpty(project_name) ? ("%," + project_name + ",%") : "",
				StringHelper.isNotEmpty(project_name) ? 2 : 1);
		 return list;
	}
	
}
