package com.chenyang.nse.bussiness.dao.table.console;

import com.chenyang.nse.bussiness.dao.BaseDao;
import com.chenyang.nse.bussiness.entity.orm.table.console.TConsoleSearchregex;
import java.util.List;
import java.util.Map;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

@Repository
public class TConsoleSearchregexDao extends BaseDao<TConsoleSearchregex, String> {
   public String updatedef(String id) {
      String r = "f";
      String sql1 = "select defaulttype  from  t_console_searchregex where  dataarea_id ='" + id + "'";
      List<Map<String, Object>> vo = this.getSession().createNativeQuery(sql1).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
      if (!vo.isEmpty()) {
         r = "s";
      }

      return r;
   }

   public List<TConsoleSearchregex> queryByDataareaid(String dataarea_id) {
      String sql1 = "select  regex from  t_console_searchregex where  dataarea_id ='" + dataarea_id + "' and defaulttype='1'";
      List<TConsoleSearchregex> vo = this.getSession().createNativeQuery(sql1).setResultTransformer(Transformers.aliasToBean(TConsoleSearchregex.class)).getResultList();
      return vo;
   }
}
