Documentation ¶
Index ¶
- type SimpleRight
- type UserAndRight
- type UserAndRightBase
- func (UserAndRightBase) BaseColumnNames() string
- func (UserAndRightBase) BaseEntity() dbinfo.Entity
- func (UserAndRightBase) GetDataInfo(name string) *dbinfo.DataInfo
- func (UserAndRightBase) New() dbinfo.Entity
- func (UserAndRightBase) OwnerName() string
- func (UserAndRightBase) OwnerTable() string
- func (UserAndRightBase) TableName() string
- type UserAndRightController
- func (control UserAndRightController) Add(ctx ginutil.Context) interface{}
- func (control UserAndRightController) CheckRepeatCombination() []string
- func (control UserAndRightController) CheckRight(ctx ginutil.Context) interface{}
- func (control UserAndRightController) Del(ctx ginutil.Context) interface{}
- func (control UserAndRightController) Edit(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindAll(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindByDate(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindById(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindByKey(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindByPage(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindByRow(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindEnglishByUserId(ctx ginutil.Context) interface{}
- func (control UserAndRightController) FindRightId(ctx ginutil.Context) interface{}
- func (control UserAndRightController) LastTime(ctx ginutil.Context) interface{}
- func (control UserAndRightController) RegisterUrl()
- type UserAndRightDao
- type UserAndRightService
- func (service UserAndRightService) CheckRight(ctx ginutil.Context, sUserId, url string) *msgentity.MsgEntity
- func (service UserAndRightService) FindEnglishByUserId(sUserId string) *msgentity.MsgEntity
- func (service UserAndRightService) FindRightId(sUserId string) *msgentity.MsgEntity
- func (service UserAndRightService) LastTime(ctx ginutil.Context, sUserId string) *msgentity.MsgEntity
- func (service UserAndRightService) LoadRight(sUserId string) *msgentity.MsgEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleRight ¶
type SimpleRight struct { GsRightId string `json:"sRightId" gorm:"column:sRightId; type:varchar"` //用户编号 GsEnglish string `json:"sEnglish" gorm:"column:sEnglish; type:varchar"` //权限标识名称 GsControllerPath string `json:"sControllerPath" gorm:"column:sControllerPath; type:varchar"` //URL路径值 }
简化的权限信息实体
type UserAndRight ¶
type UserAndRight struct {
UserAndRightBase
}
*
- 用户权限表'UserAndRight'表结构体
- 警告:非数据库字段禁止在此添加,应该创建扩展结构体中添加
- @author HuangXinBian
type UserAndRightBase ¶
type UserAndRightBase struct { GiId int64 `json:"iId" gorm:"column:iId; type:bigintAUTO_INCREMENT; NOT NULL; primary_key"` //记录编号 GsUserId string `json:"sUserId" gorm:"column:sUserId; type:varchar; NOT NULL"` //用户编号 GsRightId string `json:"sRightId" gorm:"column:sRightId; type:varchar; NOT NULL"` //权限编号 GiType int `json:"iType" gorm:"column:iType; type:int; DEFAULT '1'"` //权限类型 GsMemo string `json:"sMemo" gorm:"column:sMemo; type:varchar"` //备注 GsCreator string `json:"sCreator" gorm:"column:sCreator; type:varchar; NOT NULL; DEFAULT '00000000'"` //创建者 GdCreateDate time.Time `json:"dCreateDate" gorm:"column:dCreateDate; type:datetime; NOT NULL"` //创建时间 GsModifieder string `json:"sModifieder" gorm:"column:sModifieder; type:varchar; NOT NULL; DEFAULT '00000000'"` //修改人 GdModifiedDate time.Time `json:"dModifiedDate" gorm:"column:dModifiedDate; type:datetime; NOT NULL"` //修改时间 GiState int `json:"iState" gorm:"column:iState; type:int; NOT NULL; DEFAULT '1'"` //状态 GiIndex int `json:"iIndex" gorm:"column:iIndex; type:int; NOT NULL; DEFAULT '1'"` //序号 GiVersion int `json:"iVersion" gorm:"column:iVersion; type:int; NOT NULL; DEFAULT '1'"` //版本号 }
*
- 用户权限表'UserAndRight'表结构体
- 警告:非数据库字段禁止在此添加,应该创建扩展结构体中添加
- @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) OwnerName ¶
func (UserAndRightBase) OwnerName() string
*
- 结构体映射库名,去除'Dev_'等前缀
- @return
func (UserAndRightBase) OwnerTable ¶
func (UserAndRightBase) OwnerTable() string
*
- 结构体映射表名,无库名
- @return
func (UserAndRightBase) TableName ¶
func (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
-- 检查待新增内容是否存在重复数据(单独字段重复即重复)集合,注意:int必须是1、10、100、1000 --//
func (UserAndRightController) CheckRight ¶
func (control UserAndRightController) CheckRight(ctx ginutil.Context) interface{}
#region @Api {title=权限验证 explain=验证指定用户是否有访问指定url的权限(内部拦截器用)} @param {name=sUserId 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=iId dataType=int64 paramType=query explain=记录编号 required=true} @param {name=iVersion 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=sDateSt dataType=string paramType=query explain=格式:YYYY-MM-DD HH:mm:ss required=true} @param {name=sDateEd 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=iId 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=iId 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=sUserId 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=sUserId 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=sUserId 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, sUserId, url string) *msgentity.MsgEntity
*
- 验证指定用户是否有访问指定url的权限
- @param sUserId 验证的用户
- @param url 请求验证的权限(URL地址)
- @return
func (UserAndRightService) FindEnglishByUserId ¶
func (service UserAndRightService) FindEnglishByUserId(sUserId string) *msgentity.MsgEntity
*
- 根据用户取权限标识字符串(一个权限标识代表了多个可访问的url路径)
- @param sUserId
- @return
func (UserAndRightService) FindRightId ¶
func (service UserAndRightService) FindRightId(sUserId string) *msgentity.MsgEntity
*
- 根据用户查询用户所拥有的权限编号集合
- @param sUserId
- @return