Blame view

CompanyDictServiceImpl.java 3.23 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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 FieldDictMapper fieldDictMapper;

    @Autowired
    private CompanyMemberMappingMapper companyMemberMappingMapper;

41 42 43
    @Autowired
    private AdministerMapper administerMapper;

涂亚平 committed
44 45 46
    public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
        Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());

47 48 49 50 51 52 53 54
        AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getUserId());

        IPage page = null;
        if (0 == administerDO.getRole()) {
            page = this.baseMapper.allOperators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), operatorsDTO.getSuperviseName());
        } else if (1 == administerDO.getRole() || 3 == administerDO.getRole()) {
            page = this.baseMapper.operators(pager, operatorsDTO.getUserId(), operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), operatorsDTO.getSuperviseName());
        }
涂亚平 committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

        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;
    }

}