package com.sifang.modules.customer.dao;


import com.sifang.modules.customer.entity.CrmCustomerIncomingProductPara;
import com.sifang.modules.sys.common.persistence.BaseDao;

import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class CrmCustomerIncomingProductParaDao extends BaseDao<CrmCustomerIncomingProductPara> {


    public List<CrmCustomerIncomingProductPara> getProductPara(String projectCode){
        Query query = getSession().createQuery("from CrmCustomerIncomingProductPara where projectCode=:projectCode and productParaCode not in ('EQUIPMENT_PRICE','TENANT_INCOME_PRICE')");
        query.setParameter("projectCode", projectCode);
        List<CrmCustomerIncomingProductPara> list=query.list();
        return list;
    }
    public void deleteProductPara(String projectCode){
        SQLQuery sqlQuery = getSession().createSQLQuery("DELETE FROM crm_customer_incoming_product_para WHERE project_code=:projectCode");
        sqlQuery.setParameter("projectCode", projectCode);
        sqlQuery.executeUpdate();
    }

}
