org_user.go 3.42 KB
Newer Older
haoyanbin's avatar
haoyanbin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
package dto

import (
	"go-admin/app/admin/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
	"strconv"
)

type OrgUserGetPageReq struct {
	dto.Pagination `search:"-"`
	NickName       string `form:"nickName"  search:"type:contains;column:nick_name;table:su" comment:"姓名"`     //姓名
	Username       string `form:"username"  search:"type:contains;column:username;table:su" comment:"账号(手机号)"` //账号(手机号)
	Status         string `form:"status"  search:"type:exact;column:status;table:su" comment:"状态"`             //状态 1 离职 2 在职
	RoleId         string `form:"roleId"  search:"type:exact;column:role_id;table:su" comment:"角色"`            //角色
}

type OrgUserGetPageReply struct {
	UserId   string `json:"userId"`
	RoleName string `json:"roleName"`
	NickName string `json:"nickName"`
	Username string `json:"username"`
	RoleId   string `json:"roleId"`
	Status   string `json:"status"`
}

func (m *OrgUserGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type OrgUserInsertReq struct {
	UserId     int    `json:"-" comment:""` //
	RoleId     string `json:"roleId" comment:"角色id"`
	NickName   string `json:"nickName" comment:"姓名"`
	NickNameEn string `json:"nickNameEn" comment:"姓名"`
	Username   string `json:"username" comment:"账号"`
haoyanbin's avatar
1  
haoyanbin committed
37 38
	Status     string `json:"status" comment:"状态" default:"2"`
	UserType   string `json:"userType" comment:"类型" default:"2"`
haoyanbin's avatar
haoyanbin committed
39 40 41 42 43 44 45 46 47 48 49
	common.ControlBy
}

func (s *OrgUserInsertReq) Generate(model *models.SysUser) {
	model.UserId = s.UserId
	model.NickName = s.NickName
	model.NickNameEn = s.NickNameEn
	model.Username = s.Username
	model.RoleId, _ = strconv.Atoi(s.RoleId)
	model.Status = "2"
	model.Password = Pwd("123456")
haoyanbin's avatar
1  
haoyanbin committed
50
	model.UserType = "2"
haoyanbin's avatar
haoyanbin committed
51 52 53 54 55 56 57
}

func (s *OrgUserInsertReq) GetId() interface{} {
	return s.UserId
}

type OrgUserUpdateReq struct {
haoyanbin's avatar
haoyanbin committed
58
	UserId     int    `uri:"userId" comment:""` //
haoyanbin's avatar
haoyanbin committed
59 60 61 62
	RoleId     string `json:"roleId" comment:"角色id"`
	NickName   string `json:"nickName" comment:"姓名"`
	NickNameEn string `json:"nickNameEn" comment:"姓名"`
	Username   string `json:"username" comment:"账号"`
haoyanbin's avatar
haoyanbin committed
63
	Status     string `json:"status" comment:"状态" default:"2"`
haoyanbin's avatar
haoyanbin committed
64 65 66 67
	common.ControlBy
}

type OrgUserUpdateStatusReq struct {
haoyanbin's avatar
haoyanbin committed
68 69 70 71 72 73 74
	UserId int    `json:"userId" comment:""`             //
	Status string `json:"status" comment:"状态 1 离职 2 在职"` //状态 1 离职 2 在职
	common.ControlBy
}

type ResetPwdReq struct {
	UserId int    `json:"userId" comment:""`             //
haoyanbin's avatar
haoyanbin committed
75 76 77 78 79 80 81 82 83 84
	Status string `json:"status" comment:"状态 1 离职 2 在职"` //状态 1 离职 2 在职
	common.ControlBy
}

func (s *OrgUserUpdateReq) Generate(model *models.SysUser) {
	model.UserId = s.UserId
	model.NickName = s.NickName
	model.NickNameEn = s.NickNameEn
	model.Username = s.Username
	model.RoleId, _ = strconv.Atoi(s.RoleId)
haoyanbin's avatar
haoyanbin committed
85
	model.Status = s.Status
haoyanbin's avatar
haoyanbin committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
	model.Password = Pwd("123456")
}

func (s *OrgUserUpdateReq) GetId() interface{} {
	return s.UserId
}

// OrgTeamUserGetReq 功能获取请求参数
type OrgUserGetReq struct {
	Id int `uri:"id"`
}

type OrgUserGetReply struct {
	UserId   string `json:"userId"`
	NickName string `json:"nickName"`
	RoleId   string `json:"roleId"`
	RoleName string `json:"roleName"`
	Username string `json:"username"`
}

func (s *OrgUserGetReq) GetId() interface{} {
	return s.Id
}

// OrgTeamUserDeleteReq 功能删除请求参数
type OrgUserDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *OrgUserDeleteReq) GetId() interface{} {
	return s.Ids
}