| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.mapper.MonitorPointMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.pojo.vo.user.QxUser; |
| | | import com.moral.api.service.DeviceService; |
| | | import com.moral.api.service.MonitorPointService; |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.constant.Constants; |
| | |
| | | @Autowired |
| | | OrganizationMapper organizationMapper; |
| | | |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | |
| | | @Override |
| | |
| | | return organizationMapper.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户查询组织 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Organization> getOrganizations() { |
| | | QueryWrapper<Organization> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("id","name"); |
| | | QxUser user = UserHelper.getCurrentUser(); |
| | | Integer organizationId = user.getOrganizationId(); |
| | | if (organizationId!=24){ |
| | | wrapper.eq("id",user.getOrganizationId()); |
| | | } |
| | | wrapper.eq("is_delete",Constants.NOT_DELETE); |
| | | List<Organization> organizations = organizationMapper.selectList(wrapper); |
| | | for (int i=0; i<organizations.size(); i++) { |
| | | List<String> macs = deviceService.getMacsByOrganizationId(organizations.get(i).getId()); |
| | | if (ObjectUtils.isEmpty(macs)){ |
| | | organizations.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | return organizations; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> orgIdList(Integer organizationId) { |
| | | return this.baseMapper.orgIdList(organizationId); |
| | | } |
| | | } |