亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》
  • 首頁 > 
  • 教程 > 
  • 數據庫 > 
  • Spring + Struts2 + ExtJs 權限管理的設計(一)數據庫的設計

Spring + Struts2 + ExtJs 權限管理的設計(一)數據庫的設計

發布時間:2020-08-02 06:44:15 來源:網絡 閱讀:647 作者:柯木超 欄目:數據庫

1、本系統的后臺使用mysql數據庫,SSH 框架,前端使用ExtJs實現。因為系統需要用到權限管理,所以作此記錄,權限管理精確到前端的每一個按鈕,甚至每一個action請求。


廢話不多說,直接進入主題


(一)、數據庫的設計

權限管理部分總共包括4個數據表:

Power(記錄權限)、  Role(記錄角色)、 PowerRole(中間表)、 PowerUrl(記錄每一個action請求或者前端按鈕)


(Role表)

package com.txb.model;


import java.util.Set;


import javax.persistence.CascadeType;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.FetchType;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.OneToMany;

import javax.persistence.Table;


@Entity

@Table(name="TB_ROLE")

public class Role {

private int roleId;

private String roleName;

private Set<RolePower> rolePowers;

private Set<AdminRole> adminRoles;

@Id

@Column(name = "ROLE_ID", insertable = false, updatable = false, nullable = false, unique = true)

@GeneratedValue(strategy=GenerationType.AUTO)

public int getroleId() {

return roleId;

}


public void setroleId(int roleId) {

this.roleId = roleId;

}


@Column(name = "role_NAME", nullable = false, length = 50)

public String getroleName() {

return roleName;

}


public void setroleName(String roleName) {

this.roleName = roleName;

}


@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "role") 

public Set<RolePower> getrolePowers() {

return rolePowers;

}


public void setrolePowers(Set<RolePower> rolePowers) {

this.rolePowers = rolePowers;

}


@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "role") 

public Set<AdminRole> getAdminroles() {

return adminRoles;

}


public void setAdminroles(Set<AdminRole> adminRoles) {

this.adminRoles = adminRoles;

}

}


(Power表)

package com.txb.model;


import java.util.Set;


import javax.persistence.CascadeType;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.FetchType;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.OneToMany;

import javax.persistence.Table;

@Entity

@Table(name="TB_POWER")

public class Power {

private int powerId;

private String powerName;

private String powerType;

private String menu; //菜單

private Set<RolePower> rolePowers;

private Set<ActionUrl> actionUrls; //用戶角色

@Id

@Column(name = "POWER_ID", insertable = false, updatable = false, nullable = false, unique = true)

@GeneratedValue(strategy=GenerationType.AUTO)

public int getPowerId() {

return powerId;

}


public void setPowerId(int powerId) {

this.powerId = powerId;

}


@Column(name="POWER_NAME", nullable = false, length = 50)

public String getPowerName() {

return powerName;

}


public void setPowerName(String powerName) {

this.powerName = powerName;

}


@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "power")

public Set<RolePower> getRolePowers() {

return rolePowers;

}


public void setRolePowers(Set<RolePower> rolePowers) {

this.rolePowers = rolePowers;

}


@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "power")

public Set<ActionUrl> getActionUrls() {

return actionUrls;

}


public void setActionUrls(Set<ActionUrl> actionUrls) {

this.actionUrls = actionUrls;

}



@Column(name="POWER_TYPE", nullable = false, length = 10)

public String getPowerType() {

return powerType;

}


public void setPowerType(String powerType) {

this.powerType = powerType;

}


@Column(name="POWER_MENU", nullable = true, length = 10)

public String getMenu() {

return menu;

}


public void setMenu(String menu) {

this.menu = menu;

}

}


Role - Power 中間表,因為他們是多對多的關系

package com.txb.model;


import java.io.Serializable;


import javax.persistence.*;



/**

 * The persistent class for the rose_power database table.

 * 

 */

@Entity

@Table(name="TB_ROLE_POWER")

public class RolePower implements Serializable {

private int rpid;

private Power power;

private Role role;


public RolePower() {

}


@Id

@Column(name = "RP_ID", insertable = false, updatable = false, nullable = false, unique = true)

@GeneratedValue(strategy=GenerationType.AUTO)

public int getRpid() {

return this.rpid;

}


public void setRpid(int rpid) {

this.rpid = rpid;

}


@ManyToOne

@JoinColumn(name="POWER_ID")

public Power getPower() {

return this.power;

}


public void setPower(Power power) {

this.power = power;

}


@ManyToOne

@JoinColumn(name="ROLE_ID")

public Role getRole() {

return role;

}


public void setRole(Role role) {

this.role = role;

}

}



(PowerUrl 表,這個表是用來記錄每一個action請求,判斷該用戶所擁有的權限是否能執行對應的action請求)

package com.txb.model;


import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.JoinColumn;

import javax.persistence.ManyToOne;

import javax.persistence.Table;


@Entity

@Table(name="TB_ACTION_URL")

public class ActionUrl {


private Power power;

private String url;

private String actionName;

private int aId;


@ManyToOne

@JoinColumn(name="POWER_ID")

public Power getPower() {

return power;

}


public void setPower(Power power) {

this.power = power;

}


@Column(name="URL", nullable = false, length = 50)

public String getUrl() {

return url;

}


public void setUrl(String url) {

this.url = url;

}


@Column(name="ACTION_NAME", nullable = false, length = 50)

public String getActionName() {

return actionName;

}



public void setActionName(String actionName) {

this.actionName = actionName;

}


@Id

@Column(name = "A_ID", insertable = false, updatable = false, nullable = false, unique = true)

@GeneratedValue(strategy=GenerationType.AUTO)

public int getaId() {

return aId;

}


public void setaId(int aId) {

this.aId = aId;

}

}


到此權限數據庫就已經設計完畢,下一篇給大家介紹后臺邏輯部分




向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

青铜峡市| 玉环县| 自治县| 闸北区| 永寿县| 山阳县| 南雄市| 佳木斯市| 观塘区| 雷州市| 三河市| 张家口市| 宜阳县| 福海县| 大安市| 柳林县| 黄平县| 克拉玛依市| 辽阳县| 上蔡县| 都匀市| 临湘市| 盐亭县| 济源市| 蒙城县| 平定县| 海兴县| 沧源| 黄龙县| 屏边| 阳江市| 海伦市| 精河县| 万源市| 克什克腾旗| 桦川县| 横山县| 罗定市| 五寨县| 仁寿县| 南涧|