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.client.UserServiceClient;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.UserOrgDTO;
import com.diagbot.entity.LantoneProduct;
import com.diagbot.entity.wrapper.LantoneProductWrapper;
import com.diagbot.mapper.LantoneProductMapper;
import com.diagbot.service.LantoneProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 朗通产品表 服务实现类
 * </p>
 *
 * @author gaodm
 * @since 2018-09-18
 */
@Service
public class LantoneProductServiceImpl extends ServiceImpl<LantoneProductMapper, LantoneProduct> implements LantoneProductService {
    @Autowired
    private UserServiceClient userServiceClient;
    /**
     * @Description: 显示朗通产品线
     * @Author: wangyu
     * @Date: 13:29 2018/9/18
     */
    @Override
    public IPage<LantoneProduct> productLine(Page<LantoneProduct> page,Long userId) {
        return baseMapper.productLine(page, userId);
    }

    /**
     * @Description: 查询朗通所有产品线
     * @Author: wangyu
     * @Date: 17:05 2018/9/18
     */
    @Override
    public IPage<LantoneProduct> selectProduct(Page<LantoneProduct> page, String name) {
        List<Long> list =new ArrayList<>();
        list.add(2l);
        RespDTO<Map<Long,UserOrgDTO>> map = userServiceClient.getUserAndOrg(list);
        return baseMapper.selectProduct(page,name);
    }

    @Override
    public IPage<LantoneProduct> opendedProduct(Page page, Map map) {
        return baseMapper.opendedProduct(page,map);
    }

    @Override
    public List<LantoneProductWrapper> opendedProductByUserId(Long userId) {
        return null;
    }
}
