| | |
| | | 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() |
| | |
| | | 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); |
| | |
| | | csWrapper.eq(CompanySolution::getIsdeleted,Constants.ZERO); |
| | | csWrapper.orderByAsc(CompanySolution::getSortnum); |
| | | model.setSolutionList(companySolutionJoinMapper.selectJoinList(CompanySolution.class,csWrapper)); |
| | | |
| | | */ |
| | | initImgData(model); |
| | | return model; |
| | | } |
| | |
| | | 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"); |