userandright

package module
v0.0.0-...-a6a33e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleRight

type SimpleRight struct {
	RightId        string `json:"rightId" gorm:"column:right_id; type:varchar; NOT NULL" defaultData:"''" comment:"权限编号"`
	English        string `json:"english" gorm:"column:english; type:varchar" defaultData:"''" comment:"权限标识名称"`
	ControllerPath string `json:"controllerPath" gorm:"column:controller_path; type:varchar" comment:"URL路径值"`
}

简化的权限信息实体

type UserAndRight

type UserAndRight struct {
	UserAndRightBase
}

*

  • 用户权限表'UserAndRight'表结构体
  • 警告:非数据库字段禁止在此添加,应该创建扩展结构体中添加
  • @author HuangXinBian

func (UserAndRight) New

func (UserAndRight) New() dbinfo.Entity

*

  • 创建结构实体,并赋予默认值

type UserAndRightBase

type UserAndRightBase struct {
	Id           int64     `json:"id" gorm:"column:id; type:bigintAUTO_INCREMENT; NOT NULL; primary_key" defaultData:"0" comment:"记录编号"`
	UserId       string    `json:"userId" gorm:"column:user_id; type:varchar; NOT NULL" defaultData:"''" comment:"用户编号"`
	RightId      string    `json:"rightId" gorm:"column:right_id; type:varchar; NOT NULL" defaultData:"''" comment:"权限编号"`
	Type         int       `json:"type" gorm:"column:type; type:int; DEFAULT '1'" defaultData:"1" comment:"权限类型"`
	Memo         string    `json:"memo" gorm:"column:memo; type:varchar" defaultData:"''" comment:"备注"`
	Creator      string    `json:"creator" gorm:"column:creator; type:varchar; NOT NULL; DEFAULT '00000000'" defaultData:"'00000000'" comment:"创建者"`
	CreateDate   time.Time `` /* 127-byte string literal not displayed */
	Modifieder   string    `` /* 131-byte string literal not displayed */
	ModifiedDate time.Time `` /* 131-byte string literal not displayed */
	State        int       `json:"state" gorm:"column:state; type:int; NOT NULL; DEFAULT '1'" defaultData:"1" comment:"状态"`
	Rank         int       `json:"rank" gorm:"column:rank; type:int; NOT NULL; DEFAULT '1'" defaultData:"1" comment:"序号"`
	Edition      int       `json:"edition" gorm:"column:edition; type:int; NOT NULL; DEFAULT '1'" defaultData:"1" comment:"版本号"`
}

*

  • 用户权限表'user_and_right'表结构体
  • 警告:非数据库字段禁止在此添加,应该创建扩展结构体中添加
  • @author HuangXinBian

func (UserAndRightBase) BaseColumnNames

func (UserAndRightBase) BaseColumnNames() string

*

  • 结构体的属性名串(首字母小写)
  • @return

func (UserAndRightBase) BaseEntity

func (UserAndRightBase) BaseEntity() dbinfo.Entity

*

  • 取基础实体,用于在子类(嵌套结构体)时同样获得基类

func (UserAndRightBase) GetDataInfo

func (UserAndRightBase) GetDataInfo(name string) *dbinfo.DataInfo

*

  • 取数据结构信息
  • @param name 属性名
  • @return

func (UserAndRightBase) New

*

  • 创建结构实体
  • @return

func (UserAndRightBase) OwnerName

func (entity UserAndRightBase) OwnerName() string

*

  • 结构体映射库名,去除'Dev_'等前缀
  • @return

func (UserAndRightBase) OwnerTable

func (entity UserAndRightBase) OwnerTable() string

*

  • 结构体映射表名,无库名
  • @return

func (UserAndRightBase) TableInfo

func (UserAndRightBase) TableInfo() *dbinfo.TableInfo

*

  • 结构体映射表简化信息
  • @return

func (UserAndRightBase) TableName

func (entity UserAndRightBase) TableName() string

*

  • 结构体映射表名,处理结构体名称与表名不一致的情况
  • @return

type UserAndRightController

type UserAndRightController struct {
	app.ControllerBaseFunc                     //通用控制层接口方法
	ModuleEntity           UserAndRight        //对应模块数据实体
	ModuleService          UserAndRightService //对应模块业务实体
	ModuleDao              UserAndRightDao     //对应的数据处理实体
}

@Controller 用户权限控制器

func (UserAndRightController) Add

func (control UserAndRightController) Add(ctx ginutil.Context) interface{}

#region @Api {title=新增} @param {name=data dataType=json paramType=body explain=UserAndRight结构数据 explainType=UserAndRight required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回对象} @RequestMapping {name=Add type=POST value=/user/and/right/add} #endregion

func (UserAndRightController) CheckRepeatCombination

func (control UserAndRightController) CheckRepeatCombination() []string

-- 检查待新增内容是否存在重复数据(单独字段重复即重复)集合 --//

func (UserAndRightController) CheckRight

func (control UserAndRightController) CheckRight(ctx ginutil.Context) interface{}

#region @Api {title=权限验证 explain=验证指定用户是否有访问指定url的权限(内部拦截器用)} @param {name=UserId dataType=string paramType=query explain=用户编号 required=false} @param {name=url dataType=string paramType=query explain=权限值 required=true} @RequestMapping {name=FindByPage type=POST value=/user/and/right/check/right} #endregion

func (UserAndRightController) Del

func (control UserAndRightController) Del(ctx ginutil.Context) interface{}

#region @Api {title=删除数据} @param {name=id dataType=int64 paramType=query explain=记录编号 required=true} @param {name=edition dataType=int paramType=query explain=版本号 required=true} @return {type=json explainType=MsgEntity<int> explain=返回影响数} @RequestMapping {name=Del type=POST value=/user/and/right/del} #endregion

func (UserAndRightController) Edit

func (control UserAndRightController) Edit(ctx ginutil.Context) interface{}

#region @Api {title=修改数据} @param {name=data dataType=json paramType=body explain=UserAndRight结构数据 explainType=UserAndRight required=true} @return {type=json explainType=MsgEntity<int> explain=返回码值} @RequestMapping {name=Edit type=POST value=/user/and/right/edit} #endregion

func (UserAndRightController) FindAll

func (control UserAndRightController) FindAll(ctx ginutil.Context) interface{}

#region @Api {title=查询全部} @param {name=data dataType=json paramType=body explain=map[string]interface结构数据 explainType=UserAndRight required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回数组[]map[string]interface} @RequestMapping {name=FindAll type=POST value=/user/and/right/find/all} #endregion

func (UserAndRightController) FindByDate

func (control UserAndRightController) FindByDate(ctx ginutil.Context) interface{}

#region @Api {title=查询指定时间内数据} @param {name=dateSt dataType=string paramType=query explain=格式:YYYY-MM-DD HH:mm:ss required=true} @param {name=dateEd dataType=string paramType=query explain=格式:YYYY-MM-DD HH:mm:ss required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回数组[]map[string]interface} @RequestMapping {name=FindByDate type=POST value=/user/and/right/find/date} #endregion

func (UserAndRightController) FindById

func (control UserAndRightController) FindById(ctx ginutil.Context) interface{}

#region @Api {title=根据记录编号取对象} @param {name=id dataType=int64 paramType=query explain=记录编号 required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回对象} @RequestMapping {name=FindById type=POST value=/user/and/right/find/id} #endregion

func (UserAndRightController) FindByKey

func (control UserAndRightController) FindByKey(ctx ginutil.Context) interface{}

#region @Api {title=根据关键值取对象集合} @param {name=data dataType=json paramType=body explain=UserAndRight结构数据 explainType=UserAndRight required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回数组[]map[string]interface} @RequestMapping {name=FindByKey type=POST value=/user/and/right/find/key} #endregion

func (UserAndRightController) FindByPage

func (control UserAndRightController) FindByPage(ctx ginutil.Context) interface{}

#region @Api {title=查询分页数据} @param {name=data dataType=json paramType=body explain=FindByPageParam结构数据 explainType=FindByPageParam<UserAndRight> required=true} @return {type=json explainType=MsgEntity<Page<UserAndRight>> explain=返回分页数据} @RequestMapping {name=FindByPage type=POST value=/user/and/right/find/page} #endregion

func (UserAndRightController) FindByRow

func (control UserAndRightController) FindByRow(ctx ginutil.Context) interface{}

#region @Api {title=根据记录编号查询符合分页数据的某条记录} @param {name=id dataType=int64 paramType=query explain=记录编号 required=true} @return {type=json explainType=MsgEntity<UserAndRight> explain=返回数组[]map[string]interface} @RequestMapping {name=FindByRow type=POST value=/user/and/right/find/page/row} #endregion

func (UserAndRightController) FindEnglishByUserId

func (control UserAndRightController) FindEnglishByUserId(ctx ginutil.Context) interface{}

#region @Api {title=查询权限标识字符串 explain=根据用户取权限标识字符串(一个权限标识代表了多个可访问的url路径)} @param {name=UserId dataType=string paramType=query explain=用户编号 required=true} @RequestMapping {name=FindByPage type=POST value=/user/and/right/find/english} #endregion

func (UserAndRightController) FindRightId

func (control UserAndRightController) FindRightId(ctx ginutil.Context) interface{}

#region @Api {title=查询用户权限 explain=根据用户查询用户所拥有的权限编号集合} @param {name=UserId dataType=string paramType=query explain=用户编号 required=true} @RequestMapping {name=FindByPage type=POST value=/user/and/right/find/rightid} #endregion

func (UserAndRightController) LastTime

func (control UserAndRightController) LastTime(ctx ginutil.Context) interface{}

#region @Api {title=缓存权限时间 explain=根据用户查询用户所拥有的权限的最后更新时间} @param {name=UserId dataType=string paramType=query explain=用户编号 required=true} @RequestMapping {name=FindByPage type=POST value=/user/and/right/lasttime} #endregion

func (UserAndRightController) RegisterUrl

func (control UserAndRightController) RegisterUrl()

接口注册

type UserAndRightDao

type UserAndRightDao struct {
	app.DaoBaseFunc
}

*

  • 用户权限表UserAndRight表基本业务操作结构体

type UserAndRightService

type UserAndRightService struct {
	app.ServiceBaseFunc
}

func (UserAndRightService) CheckRight

func (service UserAndRightService) CheckRight(ctx ginutil.Context, UserId, url string) *msgentity.MsgEntity

*

  • 验证指定用户是否有访问指定url的权限
  • @param UserId 验证的用户
  • @param url 请求验证的权限(URL地址)
  • @return

func (UserAndRightService) FindEnglishByUserId

func (service UserAndRightService) FindEnglishByUserId(UserId string) *msgentity.MsgEntity

*

  • 根据用户取权限标识字符串(一个权限标识代表了多个可访问的url路径)
  • @param UserId
  • @return

func (UserAndRightService) FindRightId

func (service UserAndRightService) FindRightId(UserId string) *msgentity.MsgEntity

*

  • 根据用户查询用户所拥有的权限编号集合
  • @param UserId
  • @return

func (UserAndRightService) LastTime

func (service UserAndRightService) LastTime(ctx ginutil.Context, UserId string) *msgentity.MsgEntity

*

  • 根据用户查询用户所拥有的权限的最后更新时间
  • @param UserId
  • @return

func (UserAndRightService) LoadRight

func (service UserAndRightService) LoadRight(UserId string) *msgentity.MsgEntity

*

  • 读取指定用户的权限,并返回权限集合
  • @param UserId
  • @return

Directories

Path Synopsis
entity module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL