kongzy
2024-07-01 47a751cb301d05276ae5d75145d57b2d090fe4e1
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;
    }
}