1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package model
- import (
- "ulink-admin/pkg/base"
- )
- type SysRole struct {
- base.BaseModel `xorm:"extends"`
- RoleName string `excel:"name=角色名称" xorm:"varchar(64)" json:"roleName" binding:"required"`
- RoleKey string `excel:"name=角色权限" xorm:"varchar(64)" json:"roleKey" binding:"required"`
- RoleSort int `excel:"name=角色排序" xorm:"int" json:"roleSort" `
- DataScope string `excel:"-" json:"dataScope"`
- MenuCheckStrictly bool `excel:"-" json:"menuCheckStrictly"`
- DeptCheckStrictly bool `excel:"-" json:"deptCheckStrictly"`
- Status string `excel:"name=角色状态,format=0=正常,1=停用" xorm:"char(1)" json:"status"`
- DelFlag string `excel:"" xorm:"char(1)" json:"delFlag"`
- Remark string `excel:"" json:"remark" binding:"required" msg:"备注不能为空"`
- Rights []string `xorm:"longtext json" excel:"" json:"rights" `
- CompanyId int64 `excel:"name=公司Id" xorm:"bigint(20)" json:"companyId" `
- MenuIds []int64 `xorm:"-" json:"menuIds"`
- DeptIds []int64 `xorm:"-" json:"deptIds"`
- }
- func (r SysRole) TableName() string {
- return "sys_role"
- }
- func (r *SysRole) Key() int64 {
- return r.Id
- }
- func (r *SysRole) BeforeUpdate() {
- user := base.GetCurUser()
- if user != nil {
- r.UpdateBy = user.Name
- }
- if user.ComponyId > 0 {
- r.CompanyId = user.ComponyId
- }
- }
- func (r *SysRole) BeforeInsert() {
- user := base.GetCurUser()
- if user != nil {
- r.CreateBy = user.Name
- r.UpdateBy = user.Name
- }
- if user != nil && user.ComponyId > 0 {
- r.CompanyId = user.ComponyId
- }
- }
- func (r *SysRole) Model() interface{} {
- return r
- }
|