package com.chenyang.nse.bussiness.dao.table.core.fieldscope;

import com.chenyang.nse.bussiness.dao.BaseDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.fieldscope.TCoreScopeField;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

@Repository
public class TCoreScopeFieldDao extends BaseDao<TCoreScopeField, String> {
   public void saveTCoreScopeField(StringBuilder sql) {
      this.getSession().createNativeQuery(sql.toString()).executeUpdate();
   }

   public List<TCoreScopeField> getTCoreScopeField(StringBuilder sql) {
      List<TCoreScopeField> vo = this.getSession().createNativeQuery(sql.toString()).setResultTransformer(Transformers.aliasToBean(TCoreScopeField.class)).getResultList();
      return vo;
   }

   public List<Object> getTCoreScopeCount(StringBuilder sql) {
      new ArrayList();
      List list = this.getSession().createNativeQuery(sql.toString()).getResultList();
      return list;
   }

   public List<Object> getTCoreScopeInfo(StringBuilder sql) {
      new ArrayList();
      List list = this.getSession().createNativeQuery(sql.toString()).getResultList();
      return list;
   }

   public List<Map> getTCoreScopeFieldDistinct(String sql) {
      List<Map> vo = this.getSession().createNativeQuery(sql).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
      return vo;
   }

   public List<Map<String, Object>> queryTCoreFieldScope(String project_id, String edition_id, String tschemas, String datasystem_id) {
      String sql = "select names from T_CORE_SCOPE_FIELD WHERE projectid = :project_id and edition_id = :edition_id and tschemas = :tschemas and datasystem_id = :datasystem_id";
      return this.getSession().createNativeQuery(sql).setParameter("project_id", project_id).setParameter("edition_id", edition_id).setParameter("tschemas", tschemas).setParameter("datasystem_id", datasystem_id).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
   }
}
