Browse Source

添加登录样式

wangmh 8 years ago
parent
commit
500fa75bfd

+ 11 - 0
sso-server/src/main/java/com/uas/sso/controller/LoginController.java

@@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.io.IOException;
@@ -376,4 +377,14 @@ public class LoginController extends BaseController {
         return success(new ModelMap("isLogin", token != null));
     }
 
+    /**
+     * 页面样式
+     * @param appId 应用id
+     * @return
+     */
+    @RequestMapping(value = "/page/style", method = RequestMethod.GET)
+    public ModelMap getPageStyle(@RequestParam(defaultValue = "sso") String appId) {
+        App app = appService.findOne(appId);
+        return success(app.getPageStyle());
+    }
 }

+ 23 - 7
sso-server/src/main/java/com/uas/sso/entity/App.java

@@ -1,10 +1,10 @@
 package com.uas.sso.entity;
 
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
 import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
 
 /**
  * 应用
@@ -26,7 +26,6 @@ public class App implements Serializable {
      */
     @Id
     @Column(name = "uid_")
-    // @GeneratedValue
     private String uid;
 
     /**
@@ -107,6 +106,9 @@ public class App implements Serializable {
     @Column(name = "personal_enable", nullable = false)
     private int personalEnable;
 
+    @OneToOne(mappedBy = "app", fetch = FetchType.LAZY)
+    private PageStyle pageStyle;
+
     public String getUid() {
         return uid;
     }
@@ -219,10 +221,24 @@ public class App implements Serializable {
         this.personalEnable = personalEnable;
     }
 
+    @JsonIgnore
+    @JSONField(serialize = false)
+    public PageStyle getPageStyle() {
+        return pageStyle;
+    }
+
+    public void setPageStyle(PageStyle pageStyle) {
+        this.pageStyle = pageStyle;
+    }
+
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         App app = (App) o;
 

+ 208 - 0
sso-server/src/main/java/com/uas/sso/entity/PageStyle.java

@@ -0,0 +1,208 @@
+package com.uas.sso.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @author wangmh
+ * @create 2018-02-05 8:47
+ * @desc 页面对应用独特样式
+ **/
+@Entity
+@Table(name = "sso$app$style")
+public class PageStyle implements Serializable {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @Id
+    @Column(name = "_id")
+    private Long id;
+
+    /**
+     * 应用Id
+     */
+    @Column(name = "app_uid")
+    private String appId;
+
+    /**
+     * 应用
+     */
+    @OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
+    @JoinColumn(name = "app_uid", insertable = false, updatable = false)
+    private App app;
+
+    /**
+     * 应用描述
+     */
+    @Column(name = "app_desc")
+    private String desc;
+
+    /**
+     * logo图片
+     */
+    @Column(name = "logo_url")
+    private String logoUrl;
+
+    /**
+     * 背景图片
+     */
+    @Column(name = "bg_url")
+    private String bgUrl;
+
+    /**
+     * 背景颜色
+     */
+    @Column(name = "bg_color")
+    private String bgColor;
+
+    /**
+     * 背景图片链接
+     */
+    @Column(name = "bg_link")
+    private String bgLink;
+
+    /**
+     * 主标题
+     */
+    @Column(name = "title")
+    private String title;
+
+    /**
+     * 副标题
+     */
+    @Column(name = "subtitle")
+    private String subtitle;
+
+    /**
+     * 按钮样式(json字符串)
+     */
+    @Column(name = "btns")
+    private String btns;
+
+    /**
+     * 字体颜色
+     */
+    @Column(name = "font_color")
+    private String fontColor;
+
+    /**
+     * 相对字体颜色
+     */
+    @Column(name = "reserve_color")
+    private String reserveColor;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    @JsonIgnore
+    @JSONField(serialize = false)
+    public App getApp() {
+        return app;
+    }
+
+    public void setApp(App app) {
+        this.app = app;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public String getLogoUrl() {
+        return logoUrl;
+    }
+
+    public void setLogoUrl(String logoUrl) {
+        this.logoUrl = logoUrl;
+    }
+
+    public String getBgUrl() {
+        return bgUrl;
+    }
+
+    public void setBgUrl(String bgUrl) {
+        this.bgUrl = bgUrl;
+    }
+
+    public String getBgColor() {
+        return bgColor;
+    }
+
+    public void setBgColor(String bgColor) {
+        this.bgColor = bgColor;
+    }
+
+    public String getBgLink() {
+        return bgLink;
+    }
+
+    public void setBgLink(String bgLink) {
+        this.bgLink = bgLink;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getSubtitle() {
+        return subtitle;
+    }
+
+    public void setSubtitle(String subtitle) {
+        this.subtitle = subtitle;
+    }
+
+    public String getBtns() {
+        return btns;
+    }
+
+    public void setBtns(String btns) {
+        this.btns = btns;
+    }
+
+    public String getFontColor() {
+        return fontColor;
+    }
+
+    public void setFontColor(String fontColor) {
+        this.fontColor = fontColor;
+    }
+
+    public String getReserveColor() {
+        return reserveColor;
+    }
+
+    public void setReserveColor(String reserveColor) {
+        this.reserveColor = reserveColor;
+    }
+}