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

import com.chenyang.nse.bussiness.dao.BaseDao;
import com.chenyang.nse.bussiness.entity.orm.table.core.encryption.ColumnPrimaryKeyInfo;
import java.util.List;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

@Repository
public class ColumnPrimaryKeyInfoDao extends BaseDao<ColumnPrimaryKeyInfo, String> {
   public List<ColumnPrimaryKeyInfo> queryColumnPrimaryKeyInfoList(String dataSystemId, String projectId, String schema, String tableName) {
      String sql = "SELECT id as id,primary_key_columns FROM COLUMN_PRIMARY_KEY_INFO WHERE datasystem_id = '" + dataSystemId + "' and project_id = '" + projectId + "' and tschema='" + schema + "' and tname='" + tableName + "'";
      return this.getSession().createNativeQuery(sql).setResultTransformer(Transformers.aliasToBean(ColumnPrimaryKeyInfo.class)).getResultList();
   }
}
