package com.fzm.mall.server.admin.finance_center.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fzm.mall.server.admin.finance_center.entity.vo.MerchantAssetsVO;
import com.fzm.mall.server.admin.finance_center.entity.vo.PlatformAssetsFlowVO;
import com.fzm.mall.server.admin.finance_center.model.MerchantAssets;
import com.fzm.mall.server.admin.finance_center.model.PlatformAssetsFlow;
import com.fzm.mall.server.admin.finance_center.mapper.PlatformAssetsFlowMapper;
import com.fzm.mall.server.admin.finance_center.service.IPlatformAssetsFlowService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wangp
 * @date 2021/4/27 10:44
 * @description 服务实现类
 * @since JDK 1.8
 */
@Service
public class PlatformAssetsFlowServiceImpl extends ServiceImpl<PlatformAssetsFlowMapper, PlatformAssetsFlow> implements IPlatformAssetsFlowService {
    @Override
    public IPage<PlatformAssetsFlowVO> page(String flowId, String coin, Integer type, Integer pageNum, Integer pageSize) {
        IPage<PlatformAssetsFlowVO> page = new Page<>(pageNum, pageSize);
        return baseMapper.page(page, flowId, coin, type);
    }

    @Override
    public List<String> assetsType() {
        List<String> assetsTypes = list().stream().map(PlatformAssetsFlow::getCoin).distinct().collect(Collectors.toList());
        return assetsTypes;
    }
}
