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

import com.chenyang.nse.bussiness.dao.BaseDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.discovery.TcoreDiscoveryResultsRecord;
import org.springframework.stereotype.Repository;

@Repository
public class TcoreDiscoveryResultsRecordDao extends BaseDao<TcoreDiscoveryResultsRecord, String> {
   public int saveDiscoveryResults(StringBuilder sql) {
      return this.getSession().createNativeQuery(sql.toString()).executeUpdate();
   }

   public void truncateDiscoveryResults(String tablename) {
      String sql = "delete from " + tablename;
      this.getSession().createNativeQuery(sql.toString()).executeUpdate();
   }

   public void truncateAssignTableDiscoveryResults(String tablename, String datasystemid, String schema, String ntablename) {
      String sql = "delete from " + tablename + " where tdatasystem_id='" + datasystemid + "' and tschemas='" + schema + "' and ttables='" + ntablename + "'";
      this.getSession().createNativeQuery(sql).executeUpdate();
   }
}
