package com.yunzhi.marketing.service.impl;

import com.yunzhi.marketing.common.StringUtils;
import com.yunzhi.marketing.entity.TsActivityDaily;
import com.yunzhi.marketing.excel.ActivityDailyExport;
import com.yunzhi.marketing.mapper.TsActivityDailyMapper;
import com.yunzhi.marketing.service.ITsActivityDailyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 活动统计  服务实现类
 * </p>
 *
 * @author yansen
 * @since 2020-04-20
 */
@Service
public class TsActivityDailyServiceImpl extends ServiceImpl<TsActivityDailyMapper, TsActivityDaily> implements ITsActivityDailyService {
    @Autowired
    private TsActivityDailyMapper tsActivityDailyMapper;

    @Override
    public List<TsActivityDaily> getActivityDetail(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId, String targetName, String asc, String desc) {
        if (StringUtils.isEmpty(asc) && StringUtils.isEmpty(desc)) {
            asc = "statis_date";
        }

        return tsActivityDailyMapper.getActivityDetail(orgId, startDate, endDate, buildingId, targetType, targetId, targetName, asc, desc);
    }

    @Override
    public List<ActivityDailyExport> getActivityExport(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId) {
        return tsActivityDailyMapper.getActivityExport(orgId, startDate, endDate, buildingId, targetType, targetId);
    }
}
