CompanyDictServiceImpl.java 2.93 KB
package com.subsidy.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.subsidy.dto.company.GetCompanyMembersDTO;
import com.subsidy.dto.company.OperatorsDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.CompanyMemberMappingMapper;
import com.subsidy.mapper.FieldDictMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.service.CompanyDictService;
import com.subsidy.vo.company.GetCompanyMembersVO;
import com.subsidy.vo.company.MemberCompanyVO;
import com.subsidy.vo.company.OperatorsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 企业字典表 服务实现类
 * </p>
 *
 * @author Tuyp
 * @since 2024-01-11
 */
@Service
public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, CompanyDictDO> implements CompanyDictService {

    @Autowired
    private AdministerMapper administerMapper;

    @Autowired
    private FieldDictMapper fieldDictMapper;

    @Autowired
    private CompanyMemberMappingMapper companyMemberMappingMapper;

    public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
        Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());

//        AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getId());

        IPage page = this.baseMapper.operators(pager, operatorsDTO.getUserId(), operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), operatorsDTO.getSuperviseName());
        List<OperatorsVO> operatorsVOS = page.getRecords();
        for (OperatorsVO operatorsVO : operatorsVOS) {


            //查看公司所在行业
            List<FieldDictDO> fieldDictDOS = fieldDictMapper.queryCompanyFields(operatorsVO.getCompanyId());
            operatorsVO.setField(fieldDictDOS);
        }
        page.setRecords(operatorsVOS);
        return page;
    }


    public IPage<GetCompanyMembersVO> getCompanyMembers(GetCompanyMembersDTO getCompanyMembersDTO) {
        Page pager = new Page(getCompanyMembersDTO.getPageNum(), getCompanyMembersDTO.getPageSize());

        IPage<GetCompanyMembersVO> companyMembersVOIPage = this.baseMapper.getCompanyMembers(pager, getCompanyMembersDTO.getCompanyId(), getCompanyMembersDTO.getUserName(), getCompanyMembersDTO.getMemberStatus());

        List<GetCompanyMembersVO> records = companyMembersVOIPage.getRecords();
        for (GetCompanyMembersVO gcmv : records) {

            //历史带过的企业
            List<MemberCompanyVO> memberCompanyVOS = companyMemberMappingMapper.memberCompanys(gcmv.getId());
            gcmv.setMemberCompanyVOS(memberCompanyVOS);

        }
        return companyMembersVOIPage;
    }

}