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

import com.chenyang.nse.bussiness.config.HibernateConfig;
import com.chenyang.nse.bussiness.dao.BaseDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.dataproject.TCoreDiscoverySysdata;
import java.util.List;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

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

   public List<TCoreDiscoverySysdata> discoverResultPage(int i, Integer rows) {
      String sql = "select tdatasystem_id,tschemas,ttables from t_core_discovery_sysdata order by tschemas,ttables  limit " + i + "," + rows;
      if (HibernateConfig.PEIZHIKUDBTYPE.equals("3")) {
         sql = "select tdatasystem_id as \"tdatasystem_id\",tschemas as \"tschemas\",ttables as \"ttables\" from t_core_discovery_sysdata order by tschemas,ttables  limit " + i + "," + rows;
      }

      List<TCoreDiscoverySysdata> vo = this.getSession().createNativeQuery(sql).setResultTransformer(Transformers.aliasToBean(TCoreDiscoverySysdata.class)).getResultList();
      return vo;
   }
}
