package io.renren.modules.demo.service.impl;

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

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import io.renren.common.constant.Constant;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.demo.dao.ChannelsDao;
import io.renren.modules.demo.dto.ChannelsDTO;
import io.renren.modules.demo.entity.ChannelsEntity;
import io.renren.modules.demo.service.ChannelsService;

/**
 * 投放渠道表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2022-05-29
 */
@Service
public class ChannelsServiceImpl extends CrudServiceImpl<ChannelsDao, ChannelsEntity, ChannelsDTO> implements ChannelsService {

    @Override
    public QueryWrapper<ChannelsEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<ChannelsEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }

	@Override
	public List<ChannelsEntity> listAll() {
		return baseDao.selectList(new QueryWrapper<ChannelsEntity>().eq("status", Constant.Status.ENABLE.getValue()));
	}


}