From 47a751cb301d05276ae5d75145d57b2d090fe4e1 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期一, 01 七月 2024 10:58:35 +0800
Subject: [PATCH] change

---
 src/main/java/com/nanometer/smartlab/controller/BaseController.java |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/controller/BaseController.java b/src/main/java/com/nanometer/smartlab/controller/BaseController.java
index 2c821ad..b61151c 100644
--- a/src/main/java/com/nanometer/smartlab/controller/BaseController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/BaseController.java
@@ -5,6 +5,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.Serializable;
 
@@ -12,6 +13,19 @@
  * Created by johnny on 15/12/24.
  */
 public class BaseController implements Serializable {
+
+
+    @Value("${institute.name}")
+    private String title;
+
+    @Value("${institute.logo}")
+    private String logo;
+
+    @Value("${institute.copyright}")
+    private String copyright;
+
+    @Value("${activeEnv}")
+    private String activeEnv;
 
     public Subject getSubject() {
         return SecurityUtils.getSubject();
@@ -40,7 +54,7 @@
         return "";
     }
 
-    public String getUserId() {
+    public Long getUserId() {
         SysUser user = this.getUser();
         if (user != null) {
             return user.getId();
@@ -48,11 +62,41 @@
         return null;
     }
 
-    public String getUserDepartment() {
+    public Long getUserDepartment() {
         SysUser user = this.getUser();
         if (user != null) {
             return user.getDepartment();
         }
         return null;
     }
+
+    public Long getUserProject() {
+        SysUser user = this.getUser();
+        if (user != null) {
+            return user.getProjectId();
+        }
+        return null;
+    }
+
+    public String getTitle(){
+        if(StringUtils.isBlank(this.title)){
+            return "中国科学院苏州纳米技术与纳米仿生研究所";
+        }
+        return this.title;
+    }
+
+    public String getLogo(){
+        if(StringUtils.isBlank(this.logo)){
+            return "/resources/images/中国科学院苏州纳米技术与纳米仿生研究所logo.png";
+        }
+        return this.logo;
+    }
+
+    public String getActiveEnv(){
+        return this.activeEnv;
+    }
+
+    public String getCopyright() {
+        return copyright;
+    }
 }

--
Gitblit v1.9.2