package com.app.ydl.marketing.service;

import com.app.framework.core.support.service.impl.CrudBaseServiceSupport;
import com.app.ydl.marketing.dao.LandingChannelConfigExtendDao;
import com.app.ydl.marketing.model.LandingChannelConfigExtend;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LandingChannelConfigExtendService extends CrudBaseServiceSupport<LandingChannelConfigExtendDao, LandingChannelConfigExtend> {


    public LandingChannelConfigExtend getByFfrom(String ffrom) {
        LambdaQueryWrapper<LandingChannelConfigExtend> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LandingChannelConfigExtend::getFfrom, ffrom);
        return this.getOne(wrapper);
    }

    public List<LandingChannelConfigExtend> list(LandingChannelConfigExtend view) {
        LambdaQueryWrapper<LandingChannelConfigExtend> wrapper = new LambdaQueryWrapper<>();
        if (view.getChannelConfigId() != null) {
            wrapper.eq(LandingChannelConfigExtend::getChannelConfigId, view.getChannelConfigId());
        }
        if (view.getLaunchStatus() != null) {
            wrapper.eq(LandingChannelConfigExtend::getLaunchStatus, view.getLaunchStatus());
        }
        wrapper.orderByDesc(LandingChannelConfigExtend::getCreateTime);
        return this.list(wrapper);
    }

}
