package com.cool.store.service.impl;

import com.cool.store.dto.partner.UserChannelDTO;
import com.cool.store.entity.HyPartnerUserChannelDO;
import com.cool.store.mapper.HyPartnerUserChannelMapper;
import com.cool.store.service.HyPartnerUserChannelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author suzhuhong
 * @Date 2023/8/10 11:14
 * @Version 1.0
 */
@Service
public class HyPartnerUserChannelServiceImpl implements HyPartnerUserChannelService {

    @Resource
    HyPartnerUserChannelMapper hyPartnerUserChannelMapper;

    @Override
    public List<UserChannelDTO> queryAllUserChannelList() {
        List<HyPartnerUserChannelDO> allUserChannel = hyPartnerUserChannelMapper.getAllUserChannel();
        List<UserChannelDTO>  result = new ArrayList<>();
        allUserChannel.forEach(x->{
            UserChannelDTO userChannelDTO = new UserChannelDTO();
            userChannelDTO.setUserChannelId(x.getChannelId());
            userChannelDTO.setUserChannelName(x.getChannelName());
            result.add(userChannelDTO);
        });
        return result;
    }
}
