package com.trade.client;

import com.trade.service.enterprise.customer.domain.Enterprise;
import com.trade.service.enterprise.customer.mapper.EnterpriseMapper;
import com.trade.service.enterprise.customer.service.EnterpriseBaseService;
import com.trade.service.system.domain.SysDictData;
import com.trade.service.system.mapper.SysDictDataMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@SpringBootTest
public class EnterpriseTest {

    @Resource
    private EnterpriseBaseService enterpriseBaseService;
    @Resource
    private EnterpriseMapper enterpriseMapper;
    @Resource
    private SysDictDataMapper dictDataMapper;

    @Test
    public void select() {
        Enterprise enterprise = enterpriseBaseService.getById(1);
        System.out.println(enterprise);
        enterprise = enterpriseMapper.selectById(1);
        System.out.println(enterprise);
        SysDictData dictData = new SysDictData();
        dictData.setStatus("0");
        Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream()
                .collect(Collectors.groupingBy(SysDictData::getDictType));
        System.out.println(dictDataMap);
    }
}
