package com.sifang.modules.customer.Service;

import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.customer.dao.CrmCustomerEntryWeeklyRecordDao;
import com.sifang.modules.sys.common.service.BaseService;
import com.sifang.modules.sys.entity.Operator;
import com.sifang.modules.sys.util.LayuiPage;
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 CrmCustomerEntryWeeklyRecordService extends BaseService {

    @Autowired
    private CrmCustomerEntryWeeklyRecordDao weeklyRecordDao;


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

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