From 0661d40712d7d1ce234f9d0afa6a58f7b8ca56ec Mon Sep 17 00:00:00 2001
From: jiazx0107 <jiazx0107@163.com>
Date: 星期一, 15 十二月 2025 10:10:15 +0800
Subject: [PATCH] 调整登录页面2
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DeviceIotService.java | 78 ++++++++++++++++++++++++++++----------
1 files changed, 57 insertions(+), 21 deletions(-)
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DeviceIotService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DeviceIotService.java
index b147541..359c635 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DeviceIotService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DeviceIotService.java
@@ -1,24 +1,25 @@
package com.fzzy.igds.service;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fzzy.igds.constant.RedisConst;
+import com.fzzy.igds.data.DeviceIotParam;
import com.fzzy.igds.domain.DeviceIot;
-import com.fzzy.igds.repository.DeviceIotRepository;
+import com.fzzy.igds.mapper.DeviceIotMapper;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
- * @Description
- * @Author CZT
- * @Date 2025/11/28 14:45
+ * @Desc:
+ * @Author: CZT
+ * @Date: 2025/11/28 14:45
*/
@Slf4j
@Service
@@ -27,17 +28,46 @@
@Resource
private RedisCache redisCache;
@Resource
- private DeviceIotRepository deviceIotRepository;
+ private DeviceIotMapper deviceIotMapper;
/**
- * JPA鍒嗛〉鏌ヨ鏁版嵁
- *
- * @param specification
- * @param pageable
- * @return
+ * 鍒嗛〉鏌ヨ鏁版嵁
+ * @param page
+ * @param param
*/
- public Page<DeviceIot> findAll(Specification<DeviceIot> specification, Pageable pageable) {
- return deviceIotRepository.findAll(specification, pageable);
+ public void listPageData(Page<DeviceIot> page, DeviceIotParam param) {
+ QueryWrapper<DeviceIot> queryWrapper = new QueryWrapper<>();
+
+ param.setCompanyId(ContextUtil.getCompanyId());
+ param.setDeptId(ContextUtil.subDeptId(null));
+ queryWrapper.eq("company_id", param.getCompanyId());
+ queryWrapper.eq("dept_id", param.getDeptId());
+
+ if (StringUtils.isNotBlank(param.getDepotId())) {
+ queryWrapper.eq("depot_id", param.getDepotId());
+ }
+ if (StringUtils.isNotBlank(param.getType())) {
+ queryWrapper.eq("type", param.getType());
+ }
+ if (StringUtils.isNotBlank(param.getSerId())) {
+ queryWrapper.eq("ser_id", param.getSerId());
+ }
+
+ deviceIotMapper.selectPage(page, queryWrapper);
+ }
+
+ /**
+ * 鏍规嵁鏉′欢鏌ヨ
+ * @param companyId
+ */
+ public List<DeviceIot> listData(String companyId) {
+ QueryWrapper<DeviceIot> queryWrapper = new QueryWrapper<>();
+ if (StringUtils.isEmpty(companyId)) {
+ companyId = ContextUtil.getCompanyId();
+ }
+ queryWrapper.eq("company_id", companyId);
+
+ return deviceIotMapper.selectList(queryWrapper);
}
/**
@@ -55,10 +85,14 @@
deviceIot.setId(ContextUtil.generateId());
deviceIot.setCreateBy(ContextUtil.getLoginUserName());
deviceIot.setCreateTime(new Date());
+ deviceIot.setUpdateBy(ContextUtil.getLoginUserName());
+ deviceIot.setUpdateTime(new Date());
+ deviceIotMapper.insert(deviceIot);
+ }else {
+ deviceIot.setUpdateBy(ContextUtil.getLoginUserName());
+ deviceIot.setUpdateTime(new Date());
+ deviceIotMapper.updateById(deviceIot);
}
- deviceIot.setUpdateBy(ContextUtil.getLoginUserName());
- deviceIot.setUpdateTime(new Date());
- deviceIotRepository.save(deviceIot);
}
/**
@@ -66,7 +100,7 @@
* @param deviceIot
*/
public void delDepotDeviceIot(DeviceIot deviceIot) {
- deviceIotRepository.delete(deviceIot);
+ deviceIotMapper.deleteById(deviceIot);
}
/**
@@ -77,7 +111,9 @@
* @param posY
*/
public void updatePos(String deviceId, Double posX, Double posY) {
- deviceIotRepository.updatePos(deviceId, posX, posY);
+ UpdateWrapper<DeviceIot> updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("id", deviceId).set("pos_x", posX).set("pos_y", posY);
+ deviceIotMapper.update(null, updateWrapper);
}
/**
@@ -89,7 +125,7 @@
companyId = ContextUtil.getCompanyId();
}
// 鑾峰彇鎵�鏈夌殑璁惧淇℃伅
- List<DeviceIot> listAll =deviceIotRepository.getDeviceIotByCompanyId(companyId);
+ List<DeviceIot> listAll =this.listData(companyId);
if (null != listAll) {
this.setCacheAllDeviceIot(listAll, companyId);
--
Gitblit v1.9.3