package com.sifang.modules.customer.Service;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.customer.dao.CrmCustomerEntryDailyRecordDao;
import com.sifang.modules.sys.common.service.BaseService;
import com.sifang.modules.sys.entity.Operator;
import com.sifang.modules.sys.util.LayuiPage;
import com.sifang.modules.sys.util.SqlBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class CrmCustomerEntryDailyRecordService extends BaseService {

    @Autowired
    private CrmCustomerEntryDailyRecordDao dailyRecordDao;


    /**
     * 获取最小日期
     */
    public Date getMinDate(){
        return dailyRecordDao.getMinDate();
    }

    /**
     * 获取列表数据
     */
    public String getPageData(LayuiPage page, Map<String, String> map, Operator operator) {
        logger.info("getDailyRecordListData, map={}", map);
        page.setData(dailyRecordDao.findPageData(page, map, operator));
        page.setCount(dailyRecordDao.findPageCount(map, operator));
        return page.renderJson();
    }
    public List<Record> getDailyRecordsByDate(String date){
        return  dailyRecordDao.getDailyRecordsByDate(date);
    }
}
