package com.diagbot.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.diagbot.dto.UserAndProdutDTO;
import com.diagbot.entity.OpenedProducts;
import com.diagbot.entity.OpenedProductsIndex;
import com.diagbot.entity.wrapper.OpendProductWrapper;
import com.diagbot.mapper.OpenedProductsMapper;
import com.diagbot.service.OpenedProductsService;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 已开通产品 服务实现类
 * </p>
 *
 * @author gaodm
 * @since 2018-09-18
 */
@Service
public class OpenedProductsServiceImpl extends ServiceImpl<OpenedProductsMapper, OpenedProducts> implements OpenedProductsService {


    @Override
    public IPage<OpenedProducts> selectOpendInfoByUserId(Page<OpenedProducts> page, Long userId) {
        return baseMapper.selectOpendInfoByUserId(page, userId);
    }

    /**
     * 查询已开通产品
     *
     * @param map 查询条件
     * @return
     */
    public List<OpenedProducts> selectOpenedProducts(Map<String, Object> map) {
        return baseMapper.selectOpenedProducts(map);
    }

    @Override
    public List<OpenedProducts> getByAppkeyAndSecret(Map<String, Object> map) {
        return baseMapper.getByAppkeyAndSecret(map);
    }

    @Override
    public List<UserAndProdutDTO> getInformationAvailableByUserId(OpenedProducts openedProducts) {
        // TODO Auto-generated method stub
        return baseMapper.getInformationAvailableByUserId(openedProducts);
    }

    @Override
    public boolean startAndendByuserId(OpenedProducts openedProducts) {
        // TODO Auto-generated method stub
        return baseMapper.startAndendByuserId(openedProducts);
    }

    @Override
    public boolean delInformationAvailable(OpenedProducts openedProducts) {
        // TODO Auto-generated method stub
        return baseMapper.delInformationAvailable(openedProducts);
    }

    @Override
    public boolean modifyOpeningTime(OpenedProducts openedProducts) {
        // TODO Auto-generated method stub
        return baseMapper.modifyOpeningTime(openedProducts);
    }

    @Override
    public IPage<OpendProductWrapper> getByProductId(Page page,OpenedProductsIndex openedProductsIndex) {
        return baseMapper.getByProductId(page,openedProductsIndex);
    }

    @Override
    public List<OpenedProducts> getOpendById(OpenedProducts openedProducts) {
        return baseMapper.getOpendById(openedProducts);
    }
    @Override
    public List<UserAndProdutDTO> getInformationAvailableByUserIds(List<Long> userIds){
    	return baseMapper.getInformationAvailableByUserIds(userIds);
    }

    @Override
    public List<Long> getOpendCountByUserId(Long userId) {
        return baseMapper.getOpendCountByUserId(userId);
    }
}
