123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- package dto
- import (
- "cold-delivery/app/admin/model"
- dto2 "cold-delivery/common/dto"
- model2 "cold-delivery/common/model"
- )
- type SysUserGetPageReq struct {
- dto2.Pagination `search:"-"`
- Username string `form:"username" search:"type:contains;column:username;table:sys_user" comment:"用户名"`
- Name string `form:"name" search:"type:contains;column:nick_name;table:sys_user" comment:"昵称"`
- Type int `form:"type" search:"type:exact;column:type;table:sys_user" comment:"状态"`
- SysUserOrder
- }
- type SysUserOrder struct {
- //UserIdOrder string `search:"type:order;column:id;table:sys_user" form:"userIdOrder"`
- //UsernameOrder string `search:"type:order;column:username;table:sys_user" form:"usernameOrder"`
- //StatusOrder string `search:"type:order;column:status;table:sys_user" form:"statusOrder"`
- CreatedAtOrder string `search:"type:order;column:created_at;table:sys_user" form:"createdAtOrder" default:"desc"`
- }
- type SysUserGetPageByDeptIdReq struct {
- dto2.Pagination `search:"-"`
- Username string `form:"username" search:"type:contains;column:username;table:sys_user" comment:"用户名"`
- Name string `form:"name" search:"type:contains;column:nick_name;table:sys_user" comment:"昵称"`
- Type int `form:"type" search:"type:exact;column:type;table:sys_user" comment:"类型"`
- CompanyId int `form:"companyId" search:"-" comment:"公司id"`
- SysUserOrder
- }
- func (m *SysUserGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
- func (m *SysUserGetPageByDeptIdReq) GetNeedSearch() interface{} {
- return *m
- }
- type ResetSysUserPwdReq struct {
- Id int `json:"id" example:"1" vd:"$>0"` // 用户ID
- Password string `json:"password" example:"123456" vd:"len($)>0"` // 密码
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *ResetSysUserPwdReq) GetId() interface{} {
- return s.Id
- }
- func (s *ResetSysUserPwdReq) Generate(userModel *model.SysUser) {
- if s.Id != 0 {
- userModel.Id = s.Id
- }
- userModel.Password = s.Password
- if s.ControlBy.UpdateBy != 0 {
- userModel.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- userModel.CreateBy = s.CreateBy
- }
- }
- type UpdateSysUserStatusReq struct {
- Id int `json:"id" example:"1" vd:"$>0"` // 用户ID
- Status string `json:"status" example:"2" vd:"len($)>0"` // 状态 1-停用 2-正常
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *UpdateSysUserStatusReq) GetId() interface{} {
- return s.Id
- }
- func (s *UpdateSysUserStatusReq) Generate(userModel *model.SysUser) {
- if s.Id != 0 {
- userModel.Id = s.Id
- }
- userModel.Status = s.Status
- if s.ControlBy.UpdateBy != 0 {
- userModel.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- userModel.CreateBy = s.CreateBy
- }
- }
- type SysUserInsertReq struct {
- Id int `json:"id" swaggerignore:"true" comment:"用户ID"` // 用户ID
- Username string `json:"username" example:"username" vd:"@:len($)>0;msg:'用户名不能为空'"` // 用户名
- Password string `json:"password" example:"123456" vd:"@:len($)>5;msg:'密码格式不正确'"` // 密码
- Name string `json:"name" vd:"@:len($)>0;msg:'姓名不能为空'"` // 姓名
- Phone string `json:"phone" vd:"regexp('^1[3-9]\\d{9}$');msg:'电话号码格式不正确'"` // 电话号码
- RoleId int `json:"roleId" example:"1" swaggerignore:"true"` // 角色id
- DeptId int `json:"deptId" example:"1"` // 机构id
- Status string `json:"status" example:"2" swaggerignore:"true"` // 状态 // 货车司机绑定《道路运输从业人员从业资格证》信息
- Type int `json:"type" example:"2"` // 管理员1 门店管理员2 配送员3
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *SysUserInsertReq) Generate(userModel *model.SysUser) {
- if s.Id != 0 {
- userModel.Id = s.Id
- }
- userModel.Username = s.Username
- userModel.Password = s.Password
- userModel.NickName = s.Name
- userModel.Phone = s.Phone
- userModel.DeptId = s.DeptId
- userModel.RoleId = s.RoleId
- userModel.Status = "2"
- userModel.Type = s.Type
- userModel.UserType = model.UserTypeSys
- if s.ControlBy.UpdateBy != 0 {
- userModel.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- userModel.CreateBy = s.CreateBy
- }
- }
- func (s *SysUserInsertReq) GetId() interface{} {
- return s.Id
- }
- type SysUserUpdateReq struct {
- Id int `json:"id" comment:"用户ID"` // 用户ID
- Name string `json:"name" vd:"@:len($)>0;msg:'姓名不能为空'"` // 姓名
- Phone string `json:"phone"` // 电话号码
- Type int `json:"type" example:"2"` // 管理员1 仓管2 司机3
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *SysUserUpdateReq) Generate(userModel *model.SysUser) {
- if s.Id != 0 {
- userModel.Id = s.Id
- }
- userModel.NickName = s.Name
- userModel.Phone = s.Phone
- userModel.Type = s.Type
- if s.ControlBy.UpdateBy != 0 {
- userModel.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- userModel.CreateBy = s.CreateBy
- }
- }
- func (s *SysUserUpdateReq) GetId() interface{} {
- return s.Id
- }
- type SysUserGetReq struct {
- Id int `uri:"id"`
- }
- func (s *SysUserGetReq) GetId() interface{} {
- return s.Id
- }
- type SysUserDeleteReq struct {
- Id int `json:"id"`
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *SysUserDeleteReq) GetId() interface{} {
- return s.Id
- }
- type SysUserById struct {
- dto2.ObjectById
- model2.ControlBy `swaggerignore:"true"`
- }
- func (s *SysUserById) GetIds() interface{} {
- return s.Ids
- }
- func (s *SysUserById) GetId() interface{} {
- if len(s.Ids) > 0 {
- s.Ids = append(s.Ids, s.Id)
- return s.Ids
- }
- return s.Id
- }
- func (s *SysUserById) GenerateM() (model2.ActiveRecord, error) {
- return &model.SysUser{}, nil
- }
- // PassWord 密码
- type SysUserPassWord struct {
- NewPassword string `json:"newPassword" example:"123456" vd:"len($)>0"` // 新密码
- OldPassword string `json:"oldPassword" example:"12345678" vd:"len($)>0"` // 旧密码
- }
- type SysUserGetSMSVerifyCodeReq struct {
- Phone string `form:"phone" example:"13912345678"` //手机号
- }
|