| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.OrganizationLayout; |
| | | import com.moral.api.entity.SpecialDevice; |
| | | import com.moral.api.mapper.DeviceMapper; |
| | | import com.moral.api.mapper.OrganizationLayoutMapper; |
| | | import com.moral.api.mapper.SpecialDeviceMapper; |
| | | import com.moral.api.service.OrganizationLayoutService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.moral.constant.Constants; |
| | |
| | | @Autowired(required = false) |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Autowired(required = false) |
| | | private SpecialDeviceMapper specialDeviceMapper; |
| | | |
| | | @Transactional |
| | | @Override |
| | | public Map<String, Object> getLayoutByMac(String mac) { |
| | |
| | | wrapper_device.eq("is_delete",Constants.NOT_DELETE); |
| | | wrapper_device.eq("mac",mac); |
| | | Device device = deviceMapper.selectOne(wrapper_device); |
| | | if (ObjectUtils.isEmpty(device)){ |
| | | QueryWrapper<SpecialDevice> wrapper_specialDevice = new QueryWrapper<>(); |
| | | wrapper_specialDevice.eq("is_delete",Constants.NOT_DELETE); |
| | | wrapper_specialDevice.eq("mac",mac); |
| | | SpecialDevice specialDevice = specialDeviceMapper.selectOne(wrapper_specialDevice); |
| | | if (ObjectUtils.isEmpty(device) && ObjectUtils.isEmpty(specialDevice)){ |
| | | return null; |
| | | } |
| | | int organizationId = device.getOrganizationId(); |
| | | int versionId = device.getDeviceVersionId(); |
| | | int organizationId; |
| | | if (!ObjectUtils.isEmpty(device)){ |
| | | organizationId = device.getOrganizationId(); |
| | | }else { |
| | | organizationId = specialDevice.getOrganizationId(); |
| | | } |
| | | int versionId; |
| | | if (!ObjectUtils.isEmpty(device)){ |
| | | versionId = device.getDeviceVersionId(); |
| | | }else { |
| | | versionId = specialDevice.getDeviceVersionId(); |
| | | } |
| | | QueryWrapper<OrganizationLayout> wrapper_organizationLayout = new QueryWrapper<>(); |
| | | wrapper_organizationLayout.eq("organization_id",organizationId); |
| | | wrapper_organizationLayout.eq("version_id",versionId); |