package com.sifang.modules.customer.dao;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.customer.entity.CustomerRentVariable;
import com.sifang.modules.sys.common.persistence.BaseDao;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CustomerRentVariableDao extends BaseDao<CustomerRentVariable> {

    public List<Record> getPRVList(String projectId) {
        return Db.find("SELECT stage,start_year,end_year,unit_price FROM crm_project_rent_variable WHERE project_id=? AND status = '0'",projectId);
    }

    public Integer getMaxYear(String entryId) {
        return Db.queryInt("SELECT max(end_year) as years FROM crm_customer_rent_variable where entry_id = ?", entryId);
    }

}
