111
k94314517
2024-01-22 c8ad6f13c0e9cbff9a0763bc50c86576449f6e03
server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -92,6 +92,22 @@
        dealSolutionsData(company);
        return company;
    }
    @Override
    @Transactional
    public void  updateSolutions(Company company) {
        if(company.getId()==null
                ||company.getSolutionList() == null
                ||company.getSolutionList().size() == 0 ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        Company model = findById(company.getId());
        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
        }
        companySolutionJoinMapper.delete(new UpdateWrapper<CompanySolution>().lambda().eq(CompanySolution::getCompanyId,company.getId()));
        //处理关联方案
        dealSolutionsData(company);
    }
    private void dealSystemUserData(Company company) {
        if(systemUserMapper.selectCount(new QueryWrapper<SystemUser>().lambda()
@@ -432,7 +448,7 @@
        if(model == null ||Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        MPJLambdaWrapper<CompanySolution> csWrapper = new MPJLambdaWrapper<>();
        /*MPJLambdaWrapper<CompanySolution> csWrapper = new MPJLambdaWrapper<>();
        csWrapper.selectAll(CompanySolution.class);
        csWrapper.selectAs(Solutions::getName,CompanySolution::getSolutionName);
        csWrapper.leftJoin(Solutions.class,Solutions::getId,CompanySolution::getSolutionBaseId);
@@ -440,7 +456,7 @@
        csWrapper.eq(CompanySolution::getIsdeleted,Constants.ZERO);
        csWrapper.orderByAsc(CompanySolution::getSortnum);
        model.setSolutionList(companySolutionJoinMapper.selectJoinList(CompanySolution.class,csWrapper));
*/
        initImgData(model);
        return model;
    }
@@ -593,7 +609,12 @@
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(pageWrap.getModel().getQueryFlag() == 0){
            //只能看权限范围内
            queryWrapper.exists("select b.id from company_permission b where b.user_id="+user.getId()+" and b.isdeleted=0 and b.company_id=company.id");
            if(user.getCompanyIdList() == null || user.getCompanyIdList().size() == 0){
                queryWrapper.lambda().eq(Company::getId,-1);//设置无效访问
            }else {
                queryWrapper.lambda().in(Company::getId, user.getCompanyIdList());
            }
//            queryWrapper.exists("select b.id from company_permission b where b.user_id="+user.getId()+" and b.isdeleted=0 and b.company_id=company.id");
        } else if (pageWrap.getModel().getQueryFlag() == 1) {
            //查詢是否有查看權限
            queryWrapper.select("*,(select count(1) from company_permission b where b.user_id="+user.getId()+" and b.isdeleted=0 and b.company_id=company.id) as hasPerimission");