package com.seeyon.apps.src_ydctdatasync.dao;

import com.seeyon.ctp.common.exceptions.BusinessException;
import com.seeyon.ctp.util.JDBCAgent;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class KsQueryDao {

    public Map<String,Object> queryByName(String name,String clause,String table,MyJdbcAgent agent) throws BusinessException, SQLException {;
        String sql = "SELECT * FROM " + table + clause +";";
        List<String> params = new ArrayList<>();
        params.add(name);
        List<Map<String,Object>> list = (List<Map<String, Object>>) agent.execute(sql,params);
        return list == null || list.size() == 0 ? null : list.get(0);
    }
}
