From f14bfd47670e57d1d28d006464cb8ba576c8a49c Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 22 五月 2025 10:26:08 +0800
Subject: [PATCH] 基于测试服务器修改配置文件
---
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
index 3cb8c22..b12e7f1 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
@@ -1,13 +1,10 @@
package com.dy.pmsBase.util;
import com.dy.common.util.ConfigXml;
-import com.dy.common.util.MD5;
import com.dy.common.util.NumUtil;
import com.dy.common.webListener.ConfigListener;
import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
-import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
import com.dy.pmsGlobal.pojoBa.BaPrivilege;
-import com.dy.pmsGlobal.pojoBa.BaUser;
import org.jdom2.Document;
import org.jdom2.Element;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,9 +45,12 @@
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
+ /*
if(!this.existPrivileges()){
this.init(event);
}
+ */
+ this.init(event);
}
}
@@ -76,12 +76,16 @@
if(prs != null){
List<Element> list = prs.getChildren() ;
if(list != null){
- for(Element ele : list){
- String num = ele.getAttributeValue("num") ;
- String name = ele.getAttributeValue("name") ;
- String type = ele.getAttributeValue("type") ;
- String typeName = ele.getAttributeValue("typeName") ;
- this.savePrivilege(num, name, type,typeName);
+ Long totalInDb = this.countTotalPrivileges() ;
+ if(list.size() != totalInDb){
+ this.deleteAllPrivilegesInDb();
+ for(Element ele : list){
+ String num = ele.getAttributeValue("num") ;
+ String name = ele.getAttributeValue("name") ;
+ String type = ele.getAttributeValue("type") ;
+ String typeName = ele.getAttributeValue("typeName") ;
+ this.savePrivilege(num, name, type,typeName);
+ }
}
}
}
@@ -90,7 +94,7 @@
/**
- * 鏁版嵁搴撲腑鏄惁瀛樺湪琛屾斂鍖哄垝鏁版嵁
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
* @return 瀛樺湪鍚�
*/
private boolean existPrivileges(){
@@ -98,7 +102,22 @@
return (total != null && total > 0) ;
}
+ /**
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+ * @return 瀛樺湪鍚�
+ */
+ private Long countTotalPrivileges(){
+ return this.privilegeDao.selectCount() ;
+ }
+
+ /**
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+ * @return 瀛樺湪鍚�
+ */
+ private void deleteAllPrivilegesInDb(){
+ this.privilegeDao.deleteAll() ;
+ }
/**
* 淇濆瓨鏉冮檺
* @param name 缂栫爜
--
Gitblit v1.8.0