package com.yihu.hos.resource.dao;

import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
import com.yihu.hos.web.framework.model.DataGridResult;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * Created by chenweida on 2016/1/30.
 */
@Repository("resourceRestDao")
public class RsResourceRestDaoImpl extends SQLGeneralDAO  {

    public static final String BEAN_ID = "resourceRestDao";

    public DataGridResult getResourceRestList(Map<String, Object> conditionMap, Integer page, Integer rows) throws Exception {
        StringBuilder sb = new StringBuilder();
        sb.append(" from RsResourceRest r ");
        sb.append(" where 1=1 ");
        if (!StringUtils.isEmpty(conditionMap.get("categoryId"))) {
            sb.append(" and r.name like '%" + conditionMap.get("categoryId") + "%'");
        }
        return super.getDataGridResult(sb.toString(), page, rows);
    }
}
