package cn.com.countrygarden.bi.main.repository;


import com.sunshine.common.repository.DataRepositoryJDBC;
import org.springframework.stereotype.Repository;

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

@Repository("sysOrgRepository")
public class SysOrgRepository extends DataRepositoryJDBC {

    public SysOrgRepository() {
        this.masterTable = "[HM_wygl_new_1853].[dbo].[Tb_Sys_Organ]";
    }

    public Map<String, Object> findByOrganCode(String organCode) {
        List paramList = new ArrayList();
        paramList.add(organCode);

        String sql = "SELECT o.OrganCode, o.OrganName " +
                "FROM " + this.masterTable + " AS o " +
                "WHERE o.IsDelete = 0 AND o.OrganCode = ?";
        return this.jdbcTemp.queryForMap(sql, paramList.toArray());
    }
}
