package com.sifang.modules.customer.dao;


import com.sifang.modules.customer.entity.CrmCustomerIncomingApplicationBasic;
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 CrmCustomerIncomingApplicationBasicDao extends BaseDao<CrmCustomerIncomingApplicationBasic> {

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

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