package com.chenyang.nse.bussiness.dao.table.core.rule.app;

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

@Repository
public class AppDataRuleDao extends BaseDao<AppDataRule, String> {
   public List<AppDataRule> queryByAssetId(String assetid) {
      String sql = "select u.id as id,u.rulename from t_console_appdatarule u inner join t_core_controlled_asset_rule r on u.id = r.ruleid where u.id!=1 and r.assetid = :assetid order by u.createtime desc ";
      return this.getSession().createNativeQuery(sql).setParameter("assetid", assetid).setResultTransformer(Transformers.aliasToBean(AppDataRule.class)).getResultList();
   }
}
