From dfe1751af8dbe7ed23906010a6505fb3bbc134fd Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期二, 22 三月 2022 11:17:39 +0800
Subject: [PATCH] 功能实现
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java | 31 +++++++++++++++
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 25 ++++++++----
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java | 18 ++++++--
3 files changed, 60 insertions(+), 14 deletions(-)
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 79192fc..4ee399b 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
@@ -208,11 +208,19 @@
/**
* 鏌ユ壘鑷繁鎷ユ湁鐨勭伅鏉�
*/
- @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());
+ @PostMapping("/getOwnerPole/{cilentId}")
+ public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword
+ ,@PathVariable Long cilentId) {
+ List<Pole> results = poleService.getOwnerPole(baseConditionVO, keyword, cilentId);
+// CommonPage commonPage = CommonPage.restPage(results);
+// int size = results.size();
+// commonPage.setTotal((long) size);
+// commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
+// if (size % baseConditionVO.getPageSize() == 0) {
+// commonPage.setTotalPage(size / baseConditionVO.getPageSize());
+// }
+// return ResponseUtil.success(commonPage);
+ return ResponseUtil.success(results);
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
index 376c204..ae54250 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/ClientService.java
@@ -177,6 +177,23 @@
}
/**
+ * \
+ * 鍏朵粬绫荤敤鏉ユ煡鎵惧鎴穒d浣跨敤 濡傛灉娌℃湁涓婄骇瀹㈡埛 杩欒繑鍥炵敤鎴稩D
+ *
+ * @param
+ * @return
+ */
+ public Long getClientId(Long userId) {
+ Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId));
+ if (one != null && one.getSuperiorId() != null) {
+ return one.getSuperiorId();
+ } else {
+ return userId;
+ }
+
+ }
+
+ /**
* 涓�绾у鎴疯繑鍥瀎alse 浜岀骇瀹㈡埛杩斿洖true
*
* @return
@@ -191,4 +208,18 @@
}
}
+
+ /**
+ * 涓�绾у鎴疯繑鍥瀎alse 浜岀骇瀹㈡埛杩斿洖true
+ *
+ * @return
+ */
+ public boolean findClientId(Long userId) {
+ Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId));
+ if (one != null && one.getSuperiorId() != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
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 c9a4119..fc1420f 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
@@ -653,20 +653,27 @@
}
- public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword) {
+ public List<Pole> getOwnerPole(BaseConditionVO baseConditionVO, String keyword,Long cilentId) {
LambdaQueryWrapper<Pole> eq;
- if(SecurityUtils.getClientId()!=null){
+// if(SecurityUtils.getClientId()!=null){
PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- if(clientService.findClientId()){
- eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, SecurityUtils.getUserId());
+ if(clientService.findClientId(cilentId)){
+ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getUserId, cilentId);
}else{
- eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, SecurityUtils.getUserId());
+ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+ eq = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, cilentId)
+ .or(
+ pole->{
+ pole.eq(Pole::getUserId, cilentId);
+ }
+ );
}
- }else {
- PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- eq = Wrappers.lambdaQuery(Pole.class);
- }
+// }else {
+// PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+// eq = Wrappers.lambdaQuery(Pole.class);
+// }
+ PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
if (!keyword.isEmpty()){
eq.like(Pole::getPoleName,keyword).or(
code->{
--
Gitblit v1.9.3