|
@@ -0,0 +1,63 @@
|
|
|
+package com.usky.fire.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.core.util.StringUtils;
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.domain.DataRt;
|
|
|
+import com.usky.fire.mapper.DataRtMapper;
|
|
|
+import com.usky.fire.service.BaseUserCompanyService;
|
|
|
+import com.usky.fire.service.DataRtService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 实时数据表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author JCB
|
|
|
+ * @since 2022-08-24
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class DataRtServiceImpl extends AbstractCrudService<DataRtMapper, DataRt> implements DataRtService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BaseUserCompanyService baseUserCompanyService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonPage<DataRt> dataRtList(String deviceCode, Integer systemType, Integer pageNum, Integer pageSize) {
|
|
|
+ List<String> companyIdList = baseUserCompanyService.companyIdList();
|
|
|
+ IPage<DataRt> page = new Page<>(pageNum, pageSize);
|
|
|
+ if (CollectionUtils.isNotEmpty(companyIdList)) {
|
|
|
+ LambdaQueryWrapper<DataRt> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.like(StringUtils.isNotBlank(deviceCode), DataRt::getDeviceCode, deviceCode)
|
|
|
+ .eq(DataRt::getSystemType, systemType)
|
|
|
+ .in(DataRt::getCompanyId, companyIdList);
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ }
|
|
|
+ return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DataRt> dataRtListOne(String deviceCode, Integer systemType) {
|
|
|
+ List<String> companyIdList = baseUserCompanyService.companyIdList();
|
|
|
+ List<DataRt> list = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(companyIdList)) {
|
|
|
+ LambdaQueryWrapper<DataRt> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.like(StringUtils.isNotBlank(deviceCode), DataRt::getDeviceCode, deviceCode)
|
|
|
+ .eq(DataRt::getSystemType, systemType)
|
|
|
+ .in(DataRt::getCompanyId, companyIdList);
|
|
|
+ list = this.list(queryWrapper);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|