package com.sifang.modules.customer.dao;

import com.jfinal.plugin.activerecord.Db;
import com.sifang.modules.customer.entity.CrmCustomerIncomingApplicationEquipInfoNormal;
import com.sifang.modules.sys.common.persistence.BaseDao;
import com.sifang.modules.sys.common.persistence.Parameter;
import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

@Repository
public class CrmCustomerIncomingApplicationEquipInfoNormalDao extends BaseDao<CrmCustomerIncomingApplicationEquipInfoNormal> {

    public CrmCustomerIncomingApplicationEquipInfoNormal getByApplicationId(String applicationId){
        return getByHql(" from CrmCustomerIncomingApplicationEquipInfoNormal where status='0' and applicationId =:p1", new Parameter(applicationId));
    }

    public void deleteRecord(String applicationId){
        SQLQuery sqlQuery = getSession().createSQLQuery("DELETE FROM crm_customer_incoming_application_equip_info_normal WHERE application_id =:applicationId");
        sqlQuery.setParameter("applicationId", applicationId);
        sqlQuery.executeUpdate();
    }
}
