ServiceAdministerMappingServiceImpl.java 1.64 KB
package com.subsidy.service.impl;

import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.ServiceCompanyMappingMapper;
import com.subsidy.model.*;
import com.subsidy.mapper.ServiceAdministerMappingMapper;
import com.subsidy.service.ServiceAdministerMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.vo.administer.AdministerServicesVO;
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 ServiceAdministerMappingServiceImpl extends ServiceImpl<ServiceAdministerMappingMapper, ServiceAdministerMappingDO> implements ServiceAdministerMappingService {


    @Autowired
    private AdministerMapper administerMapper;

    @Autowired
    private ServiceCompanyMappingMapper serviceCompanyMappingMapper;

    public List<AdministerServicesVO> administerServices(AdministerCompanyMappingDO administerCompanyMappingDO) {

        AdministerDO administerDO = administerMapper.selectById(administerCompanyMappingDO.getAdministerId());
        if (3 == administerDO.getRole() || 1 == administerDO.getRole()) {
            //返回企业全部的
            return serviceCompanyMappingMapper.companyService(administerCompanyMappingDO.getCompanyId());
        } else {
            //返回企业中授权给这个人的应用
            return serviceCompanyMappingMapper.companyAdministerService(administerCompanyMappingDO.getCompanyId(),administerCompanyMappingDO.getAdministerId());
        }
    }

}