Skip to content

Instantly share code, notes, and snippets.

@gudaoxuri
Last active March 30, 2016 08:25
Show Gist options
  • Save gudaoxuri/eef778faa110dd46f123cdd81b48925e to your computer and use it in GitHub Desktop.
Save gudaoxuri/eef778faa110dd46f123cdd81b48925e to your computer and use it in GitHub Desktop.
ez-framework auth service model
/**
* 账号实体
*/
@Entity("Account")
case class EZ_Account() extends SecureModel with StatusModel {
@Unique
@Require
@Label("Code") // organization_code@login_id
@BeanProperty var code: String = _
@Require
@Label("Login Id") // 不能包含@
@BeanProperty var login_id: String = _
@Require
@Label("Name")
@BeanProperty var name: String = _
@Label("Image")
@BeanProperty var image: String = ""
@Require
@Label("Password")
@BeanProperty var password: String = _
// 此字段不为空时保存或更新账户时不对密码做加密
@Ignore var exchange_pwd: String = ""
@Require
@Label("Email")
@BeanProperty var email: String = _
@Label("Ext Id") // 用于关联其它对象以扩展属性,扩展Id多为业务系统用户信息表的主键
@BeanProperty var ext_id: String = ""
@Label("Ext Info")
@BeanProperty var ext_info: Map[String, Any] = Map()
@Label("OAuth Info") // key=oauth服务标记,value=openid
@BeanProperty var oauth: Map[String, String] = Map()
@BeanProperty var organization_code: String = ServiceAdapter.defaultOrganizationCode
@BeanProperty var role_codes: List[String] = List[String]()
}
/**
* 组织(租户)实体
*/
@Entity("Organization")
case class EZ_Organization() extends BaseModel with SecureModel with StatusModel {
@Unique
@Require
@Label("Code")
@BeanProperty var code: String = _
@Require
@Label("Name")
@BeanProperty var name: String = _
@Label("Image")
@BeanProperty var image: String = ""
}
/**
* 角色实体
*/
@Entity("Role")
case class EZ_Role() extends BaseModel with SecureModel with StatusModel {
@Unique
@Require
@Label("Code") // organization_code@flag
@BeanProperty var code: String = _
@Require
@Label("Flag")
@BeanProperty var flag: String = _
@Require
@Label("Name")
@BeanProperty var name: String = _
@BeanProperty var resource_codes: List[String] = List[String]()
@BeanProperty var organization_code: String = ServiceAdapter.defaultOrganizationCode
}
/**
* 资源实体
*/
@Entity("Resource")
case class EZ_Resource() extends BaseModel with SecureModel with StatusModel {
@Unique
@Require
@Label("Code") // method@uri
@BeanProperty var code: String = _
@Require
@Label("Method")
@BeanProperty var method: String = _
@Require
@Label("URI")
@BeanProperty var uri: String = _
@Require
@Label("Name")
@BeanProperty var name: String = _
}
/**
* 菜单实体
*/
@Entity("Menu")
case class EZ_Menu() extends SecureModel with StatusModel {
@Unique
@Label("Code") // organization_code@uri
@BeanProperty var code: String = _
@Require
@Label("URI")
@BeanProperty var uri: String = _
@Require
@Label("Name")
@BeanProperty var name: String = _
@BeanProperty var icon: String = ""
@BeanProperty var translate: String = ""
@BeanProperty var role_codes: List[String] = List[String]()
@BeanProperty var parent_code: String = ""
@BeanProperty var sort: Int = 0
@BeanProperty var organization_code: String = ServiceAdapter.defaultOrganizationCode
}
/**
* Token VO
*
* @param token token
* @param login_id 登录id
* @param name 姓名
* @param email email
* @param image 头像
* @param organization_code 组织编码
* @param role_codes 角色编码列表
* @param ext_id 扩展ID
* @param ext_info 扩展信息
*/
case class Token_Info_VO(
token: String,
login_id: String,
name: String,
email: String,
image: String,
organization_code: String,
role_codes: List[String],
ext_id: String,
ext_info: Map[String, Any])
/**
* 账号 VO
*
* 用于显示或添加、更新账号信息
*/
case class Account_VO() {
// 数据库id,不能更改
var id: String = _
// 登录id,不能更改
var login_id: String = _
// 姓名
var name: String = _
// 头像
var image: String = _
// Email
var email: String = _
// 当前密码,更新时需要验证
var current_password: String = _
// 新密码,如果需要更改密码时填写
var new_password: String = _
// 组织编码,不能更改
var organization_code: String = _
// 扩展ID,不能更改
var ext_id: String = _
// 扩展信息
var ext_info: Map[String, Any] = _
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment