refactor🎨 核心业务结构调整

This commit is contained in:
zhangwenjian committed 2021-05-22 22:54:08 +08:00
1 parent 408dcc5057
commit e473f158e8
13 files changed
+406 -761

No files matched your search

+19 -22
View File
@@ -55,6 +55,7 @@ type SysUserControl struct {
PostId int `json:"postId" comment:"岗位"`
Remark string `json:"remark" comment:"备注"`
Status string `json:"status" comment:"状态"`
common.ControlBy
}
func (s *SysUserControl) Bind(ctx *gin.Context) error {
@@ -67,27 +68,22 @@ func (s *SysUserControl) Bind(ctx *gin.Context) error {
return err
}
func (s *SysUserControl) Generate() dto.Control {
cp := *s
return &cp
}
func (s *SysUserControl) GenerateM() (common.ActiveRecord, error) {
return &models.SysUser{
UserId: s.UserId,
Username: s.Username,
Password: s.Password,
NickName: s.NickName,
Phone: s.Phone,
RoleId: s.RoleId,
Avatar: s.Avatar,
Sex: s.Sex,
Email: s.Email,
DeptId: s.DeptId,
PostId: s.PostId,
Remark: s.Remark,
Status: s.Status,
}, nil
func (s *SysUserControl) Generate(model *models.SysUser) {
if s.UserId != 0 {
model.UserId = s.UserId
}
model.Username = s.Username
model.Password = s.Password
model.NickName = s.NickName
model.Phone = s.Phone
model.RoleId = s.RoleId
model.Avatar = s.Avatar
model.Sex = s.Sex
model.Email = s.Email
model.DeptId = s.DeptId
model.PostId = s.PostId
model.Remark = s.Remark
model.Status = s.Status
}
func (s *SysUserControl) GetId() interface{} {
@@ -96,6 +92,7 @@ func (s *SysUserControl) GetId() interface{} {
type SysUserById struct {
dto.ObjectById
common.ControlBy
}
func (s *SysUserById) Generate() dto.Control {
@@ -119,4 +116,4 @@ func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
type PassWord struct {
NewPassword string `json:"newPassword" binding:"required"`
OldPassword string `json:"oldPassword" binding:"required"`
}
}