package com.sifang.modules.customer.dao;

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

    public CrmCustomerIncomingApplicationLeaseItem getByEntryId(String entryId){
        return getByHql(" from CrmCustomerIncomingApplicationLeaseItem where entryId =:p1", new Parameter(entryId));
    }

    public void deleteRecord(String entryId){
        SQLQuery sqlQuery = getSession().createSQLQuery("DELETE FROM crm_customer_incoming_application_lease_item WHERE entry_id =:entryId");
        sqlQuery.setParameter("entryId", entryId);
        sqlQuery.executeUpdate();
    }
}
