From ceb66c0a1dcfcfdd7c331d104f66be9e033ac902 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期一, 21 三月 2022 16:47:15 +0800
Subject: [PATCH] bug修复
---
dao/src/main/resources/mapper/PoleMapper.xml | 11 +++--
dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java | 5 ++
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 35 +++++++++++++++++
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java | 11 +++++
dao/src/main/resources/mapper/LightReportDataMapper.xml | 9 +++-
5 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java b/dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java
index cb3d99f..27a5b9e 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/domain/Pole.java
@@ -38,6 +38,11 @@
private Integer deviceType;
/**
+ *
+ */
+ private Long userId;
+
+ /**
* 瀹㈡埛id
*/
private Long clientId;
diff --git a/dao/src/main/resources/mapper/LightReportDataMapper.xml b/dao/src/main/resources/mapper/LightReportDataMapper.xml
index 649f93f..b1456bd 100644
--- a/dao/src/main/resources/mapper/LightReportDataMapper.xml
+++ b/dao/src/main/resources/mapper/LightReportDataMapper.xml
@@ -51,15 +51,18 @@
light_report_data t1
LEFT JOIN pole t2 USING ( device_code )
<where>
+ 1 = 1
+
+ <if test="deviceCode != null and deviceCode != ''">
+ AND t1.device_code = #{deviceCode}
+ </if>
<if test="keyword != null and keyword != ''">
AND (
t1.device_code LIKE CONCAT('%', #{keyword},'%')
OR t2.pole_name LIKE CONCAT('%', #{keyword},'%')
)
</if>
- <if test="deviceCode != null and keyword != ''">
- AND t1.device_code = #{deviceCode}
- </if>
+
</where>
ORDER BY t1.light_report_data_id DESC
</select>
diff --git a/dao/src/main/resources/mapper/PoleMapper.xml b/dao/src/main/resources/mapper/PoleMapper.xml
index cbe3bed..a0a356a 100644
--- a/dao/src/main/resources/mapper/PoleMapper.xml
+++ b/dao/src/main/resources/mapper/PoleMapper.xml
@@ -9,6 +9,7 @@
<result property="poleCode" column="pole_code" jdbcType="BIGINT"/>
<result property="poleName" column="pole_name" jdbcType="VARCHAR"/>
<result property="deviceType" column="device_type" jdbcType="INTEGER"/>
+ <result property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="clientId" column="client_id" jdbcType="BIGINT"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
@@ -25,10 +26,10 @@
<sql id="Base_Column_List">
id,pole_code,pole_name,
- device_type,client_id,province,
- city,region,address,
- lon,lat,device_code,
- on_line_state,binding_count,create_time,
- update_time
+ device_type,user_id,client_id,
+ province,city,region,
+ address,lon,lat,
+ device_code,on_line_state,binding_count,
+ create_time,update_time
</sql>
</mapper>
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
index faea1fa..79192fc 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -205,4 +205,15 @@
}
+ /**
+ * 鏌ユ壘鑷繁鎷ユ湁鐨勭伅鏉�
+ */
+ @PostMapping("/getOwnerPole")
+ public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
+ //public ResponseVO<Object> setMac() {
+ return ResponseUtil.success(poleService.getOwnerPole(baseConditionVO,keyword));
+ // return ResponseUtil.success(poleService.setMac());
+ }
+
+
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index d591e72..c9a4119 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.execption.BusinessException;
+import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.redis.RedisService;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.dto.DeviceStatus;
@@ -60,6 +61,7 @@
private final RedisService redisService;
private final PoleBindingService poleBindingService;
private final PoleGroupRelationService groupRelationService;
+ private final ClientService clientService;
public boolean addPole(PoleParam param) {
Pole pole = new Pole();
@@ -649,4 +651,37 @@
}
return r;
}
+
+
+ public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword) {
+ LambdaQueryWrapper<Pole> eq;
+ if(SecurityUtils.getClientId()!=null){
+ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+ if(clientService.findClientId()){
+ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, SecurityUtils.getUserId());
+ }else{
+ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, SecurityUtils.getUserId());
+ }
+
+ }else {
+ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+ eq = Wrappers.lambdaQuery(Pole.class);
+ }
+ if (!keyword.isEmpty()){
+ eq.like(Pole::getPoleName,keyword).or(
+ code->{
+ code.like(Pole::getPoleCode,keyword);
+ }
+ ).or(
+ deviceCode->{
+ deviceCode.like(Pole::getDeviceCode,keyword);
+ }
+ );
+ }
+ List<Pole> list ;
+ list =list(eq);
+ setCount(list);
+ setOnline(list);
+ return list;
+ }
}
--
Gitblit v1.9.3