loginuser

package module
v0.0.0-...-4fd775f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginUser

type LoginUser struct {
	LoginUserBase
	GsStateText string `json:"sStateText" gorm:"<-:false;column:sStateText"` //状态(枚举,1:启用;2:禁用)
}

*

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

func (LoginUser) New

func (LoginUser) New() dbinfo.Entity

*

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

type LoginUserBase

type LoginUserBase struct {
	GsId           string    `json:"sId" gorm:"column:sId; type:varchar; NOT NULL; primary_key"`                        //表编号
	GsName         string    `json:"sName" gorm:"column:sName; type:varchar; NOT NULL"`                                 //名称
	GsNo           string    `json:"sNo" gorm:"column:sNo; type:varchar; NOT NULL"`                                     //标识(组合唯一)
	GsPass         string    `json:"sPass" gorm:"column:sPass; type:varchar; NOT NULL"`                                 //密码
	GsType         string    `json:"sType" gorm:"column:sType; type:varchar; NOT NULL; DEFAULT '管理员'"`                  //类型
	GsOwner        string    `json:"sOwner" gorm:"column:sOwner; type:varchar; DEFAULT 'BaseSystem.LoginUser'"`         //来源
	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'"`                      //状态(枚举,1:启用;2:禁用)
	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'"`                  //版本号
}

*

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

func (LoginUserBase) BaseColumnNames

func (LoginUserBase) BaseColumnNames() string

*

  • 结构体映射表的字段名串
  • @return

func (LoginUserBase) BaseEntity

func (LoginUserBase) BaseEntity() dbinfo.Entity

*

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

func (LoginUserBase) GetDataInfo

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

*

  • 取数据结构信息
  • @param name 字段名
  • @return

func (LoginUserBase) New

func (LoginUserBase) New() dbinfo.Entity

*

  • 创建结构实体
  • @return

func (LoginUserBase) OwnerName

func (LoginUserBase) OwnerName() string

*

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

func (LoginUserBase) OwnerTable

func (LoginUserBase) OwnerTable() string

*

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

func (LoginUserBase) TableName

func (LoginUserBase) TableName() string

*

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

type LoginUserController

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

@Controller 用户表控制器

func (LoginUserController) Add

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

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

func (LoginUserController) CheckRepeatAlone

func (control LoginUserController) CheckRepeatAlone() map[string]int

-- 检查待新增内容是否存在重复数据(单独字段重复即重复)集合,注意:int必须是1、10、100、1000 --//

func (LoginUserController) Del

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

#region @Api {title=删除数据} @param {name=sId dataType=string paramType=query explain=记录编号 required=true} @param {name=iVersion dataType=int paramType=query explain=版本号 required=true} @return {type=MsgEntity explain=返回影响数} @RequestMapping {name=Del type=POST value=/login/user/del} #endregion

func (LoginUserController) Edit

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

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

func (LoginUserController) EditPass

func (control LoginUserController) EditPass(ctx ginutil.Context) interface{}

#region @Api {title=修改当前用户密码} @param {name=sOldPass dataType=string paramType=query explain=旧密码 required=true} @param {name=sNewPass dataType=string paramType=query explain=新密码 required=true} @return {type=json explainType=MsgEntity<int> explain=返回码值} @RequestMapping {name=EditPass type=POST value=/login/user/password/edit} #endregion

func (LoginUserController) EditUserHead

func (control LoginUserController) EditUserHead(ctx ginutil.Context) interface{}

#region @Api {title=设置用户头像} @param {name=sHead dataType=string paramType=query explain=Base64图片 required=true} @return {type=json explainType=MsgEntity<int> explain=返回码值} @RequestMapping {name=EditUserHead type=POST value=/login/user/edit/head} #endregion

func (LoginUserController) EditUserType

func (control LoginUserController) EditUserType(ctx ginutil.Context) interface{}

#region @Api {title=根据用户编号设置用户类型} @param {name=sId dataType=string paramType=query explain=用户编号 required=true} @param {name=sType dataType=string paramType=query explain=用户类型 required=true} @return {type=json explainType=MsgEntity<int> explain=返回码值} @RequestMapping {name=EditUserType type=POST value=/login/user/edit/type} #endregion

func (LoginUserController) FindAll

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

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

func (LoginUserController) FindByDate

func (control LoginUserController) 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=MsgEntity explain=返回数组[]map[string]interface} @RequestMapping {name=FindByDate type=POST value=/login/user/find/date} #endregion

func (LoginUserController) FindById

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

#region @Api {title=根据记录编号取对象} @param {name=sId dataType=string paramType=query explain=记录编号 required=true} @return {type=MsgEntity explain=返回对象} @RequestMapping {name=FindById type=POST value=/login/user/find/id} #endregion

func (LoginUserController) FindByKey

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

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

func (LoginUserController) FindByPage

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

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

func (LoginUserController) FindByRow

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

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

func (LoginUserController) LookHead

func (control LoginUserController) LookHead(ctx ginutil.Context) interface{}

#region @Api {title=取用户头像} @return {type=bit explainType=image/png explain=返回图片流} @RequestMapping {name=LookHead type=GET value=/login/user/head} #endregion

func (LoginUserController) RegisterUrl

func (control LoginUserController) RegisterUrl()

接口注册

func (LoginUserController) ResetPass

func (control LoginUserController) ResetPass(ctx ginutil.Context) interface{}

只有当前用户和管理员(admin)才能重置密码 #region @Api {title=重置密码} @param {name=sId dataType=string paramType=query explain=表编号 required=true} @param {name=sPass dataType=int paramType=query explain=新密码 required=true} @return {type=json explainType=MsgEntity<int> explain=返回码值} @RequestMapping {name=ResetPass type=POST value=/login/user/password/reset} #endregion

type LoginUserDao

type LoginUserDao struct {
	app.DaoBaseFunc
}

func (LoginUserDao) EditPass

func (dao LoginUserDao) EditPass(sDbName, sId, sNewPass, sOldPass, sModifieder, sOwner string, iVersion int64) *msgentity.MsgEntity

修改密码

func (LoginUserDao) EditUserType

func (dao LoginUserDao) EditUserType(sDbName, sId, sType, sOwner string) *msgentity.MsgEntity

根据用户编号设置用户类型

func (LoginUserDao) ResetPass

func (dao LoginUserDao) ResetPass(sDbName, sId, sNewPass, sModifieder, sOwner string, iVersion int64) *msgentity.MsgEntity

重置密码

type LoginUserService

type LoginUserService struct {
	app.ServiceBaseFunc
}

*

  • 用户表LoginUser表基本业务操作结构体

func (LoginUserService) Add

func (service LoginUserService) Add(ctx ginutil.Context, dbEntity dbinfo.Entity, params map[string]interface{}) *msgentity.MsgEntity

*

  • 新增
  • @param ctx Http请求对象
  • @param dbEntity 实体数据结构
  • @param params 数据
  • @return *msgentity.MsgEntity 返回执行结果

func (LoginUserService) Del

func (service LoginUserService) Del(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int) *msgentity.MsgEntity

*

  • 删除
  • @param entity 对象类型
  • @param id 记录编号值
  • @param iVersion 记录版本号
  • @return MsgEntity

func (LoginUserService) Edit

func (service LoginUserService) Edit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int, data map[string]interface{}) *msgentity.MsgEntity

*

  • 修改
  • @param entity 对象类型
  • @param id 记录编号值
  • @param iVersion 记录版本号
  • @param data 待更新的字段和值
  • @return *msgentity.MsgEntity 返回执行结果

func (LoginUserService) EditPass

func (service LoginUserService) EditPass(ctx ginutil.Context, entity dbinfo.Entity, sId, sOldPass, sNewPass, sOwner string) *msgentity.MsgEntity

*

  • 修改密码
  • @param ctx
  • @param entity
  • @param sId
  • @param sOldPass
  • @param sNewPass
  • @return MsgEntity

func (LoginUserService) EditUserHead

func (service LoginUserService) EditUserHead(currentUserId, sHead string) *msgentity.MsgEntity

设置用户头像

func (LoginUserService) EditUserType

func (service LoginUserService) EditUserType(currentUserId, sId, sType, sOwner string) *msgentity.MsgEntity

根据用户编号设置用户类型

func (LoginUserService) LookHead

func (service LoginUserService) LookHead(currentUserId string) *msgentity.MsgEntity

取用户头像

func (LoginUserService) MapToJson

func (service LoginUserService) MapToJson(m interface{}, v any) error

func (LoginUserService) ResetPass

func (service LoginUserService) ResetPass(currentUserId, sId, sPass, sOwner string) *msgentity.MsgEntity

重置密码

Directories

Path Synopsis
entity module

Jump to

Keyboard shortcuts

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