org_player.go 7.45 KB
Newer Older
haoyanbin's avatar
1  
haoyanbin committed
1 2 3
package dto

import (
haoyanbin's avatar
1  
haoyanbin committed
4
	"go-admin/app/operate/models"
haoyanbin's avatar
1  
haoyanbin committed
5 6
	"go-admin/common/dto"
	common "go-admin/common/models"
haoyanbin's avatar
haoyanbin committed
7
	"golang.org/x/crypto/bcrypt"
haoyanbin's avatar
1  
haoyanbin committed
8 9 10 11
	"time"
)

type OrgPlayerGetPageReq struct {
haoyanbin's avatar
haoyanbin committed
12
	dto.Pagination `search:"-"`
haoyanbin's avatar
haoyanbin committed
13
	TeamId         string `form:"teamId"  search:"-"`
haoyanbin's avatar
haoyanbin committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
	TeamName       string `form:"teamName"  search:"type:contains;column:team_name;table:ot" comment:""`
	PlayerName     string `form:"playerName"  search:"type:contains;column:player_name;table:op" comment:""`
	Status         string `form:"status"  search:"type:exact;column:status;table:op" comment:""`
}
type OrgPlayerGetPageReply struct {
	Id           string `json:"id" comment:"球队id"` //球队id
	ClubId       string `json:"clubId" comment:"俱乐部id"`
	ClubName     string `json:"clubName" comment:"俱乐部名称"`
	TeamId       string `json:"teamId" comment:"球队id"`
	TeamName     string `json:"teamName" comment:"球队名称"`
	PlayerName   string `json:"playerName" comment:"球员名称"`
	PlayerNameEn string `json:"playerNameEn" comment:"球员名称英文"`
	PlayerNumber string `json:"playerNumber" comment:"球衣号"`
	Position     string `json:"position" comment:"场上位置"`
	Sex          string `json:"sex" comment:"性别"`
	Status       string `json:"status" comment:"状态"`
haoyanbin's avatar
1  
haoyanbin committed
30 31
}

haoyanbin's avatar
haoyanbin committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
type OrgPlayerOrder struct {
	Id           int       `form:"idOrder"  search:"type:order;column:id;table:org_player"`
	ClubId       string    `form:"clubIdOrder"  search:"type:order;column:club_id;table:org_player"`
	TeamId       string    `form:"teamIdOrder"  search:"type:order;column:team_id;table:org_player"`
	PlayerName   string    `form:"playerNameOrder"  search:"type:order;column:player_name;table:org_player"`
	IdCard       string    `form:"idCardOrder"  search:"type:order;column:id_card;table:org_player"`
	Sex          string    `form:"sexOrder"  search:"type:order;column:sex;table:org_player"`
	PlayerNumber string    `form:"playerNumberOrder"  search:"type:order;column:player_number;table:org_player"`
	Position     string    `form:"positionOrder"  search:"type:order;column:position;table:org_player"`
	PlayerImg    string    `form:"playerImgOrder"  search:"type:order;column:player_img;table:org_player"`
	PlayerUserId string    `form:"playerUserIdOrder"  search:"type:order;column:player_user_id;table:org_player"`
	ShareConf    string    `form:"shareConfOrder"  search:"type:order;column:share_conf;table:org_player"`
	CreateBy     string    `form:"createByOrder"  search:"type:order;column:create_by;table:org_player"`
	UpdateBy     string    `form:"updateByOrder"  search:"type:order;column:update_by;table:org_player"`
	CreatedAt    time.Time `form:"createdAtOrder"  search:"type:order;column:created_at;table:org_player"`
	UpdatedAt    time.Time `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:org_player"`
	DeletedAt    time.Time `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:org_player"`
haoyanbin's avatar
1  
haoyanbin committed
49 50 51 52 53 54 55
}

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

type OrgPlayerInsertReq struct {
haoyanbin's avatar
haoyanbin committed
56 57 58 59 60 61 62 63 64 65 66
	Id           int    `json:"-" comment:""` //
	ClubId       string `json:"clubId" comment:"org_club表id"`
	TeamId       string `json:"teamId" comment:"org_team表id"`
	PlayerName   string `json:"playerName" comment:"球员姓名"`
	IdCard       string `json:"idCard" comment:"身份证号"`
	Sex          string `json:"sex" comment:"性别"`
	PlayerNumber string `json:"playerNumber" comment:"球衣号码"`
	Position     string `json:"position" comment:"场上位置"`
	PlayerImg    string `json:"playerImg" comment:"球员照片"`
	PlayerUserId string `json:"playerUserId" comment:"org_player_user表id"`
	ShareConf    string `json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
haoyanbin's avatar
haoyanbin committed
67 68
	PlayerNameEn string `json:"playerNameEn" comment:"球员名称英文"`
	Username     string `json:"username" comment:"账号"`
haoyanbin's avatar
haoyanbin committed
69
	common.ControlBy
haoyanbin's avatar
1  
haoyanbin committed
70 71
}

haoyanbin's avatar
haoyanbin committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85
func (s *OrgPlayerInsertReq) Generate(model *models.OrgPlayer) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.ClubId = s.ClubId
	model.TeamId = s.TeamId
	model.PlayerName = s.PlayerName
	model.IdCard = s.IdCard
	model.Sex = s.Sex
	model.PlayerNumber = s.PlayerNumber
	model.Position = s.Position
	model.PlayerImg = s.PlayerImg
	model.PlayerUserId = s.PlayerUserId
	model.ShareConf = s.ShareConf
haoyanbin's avatar
1  
haoyanbin committed
86 87 88 89 90 91 92
}

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

type OrgPlayerUpdateReq struct {
haoyanbin's avatar
haoyanbin committed
93 94 95 96 97 98 99 100 101 102 103
	Id           int    `uri:"id" comment:""` //
	ClubId       string `json:"clubId" comment:"org_club表id"`
	TeamId       string `json:"teamId" comment:"org_team表id"`
	PlayerName   string `json:"playerName" comment:"球员姓名"`
	IdCard       string `json:"idCard" comment:"身份证号"`
	Sex          string `json:"sex" comment:"性别"`
	PlayerNumber string `json:"playerNumber" comment:"球衣号码"`
	Position     string `json:"position" comment:"场上位置"`
	PlayerImg    string `json:"playerImg" comment:"球员照片"`
	PlayerUserId string `json:"playerUserId" comment:"org_player_user表id"`
	ShareConf    string `json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
haoyanbin's avatar
haoyanbin committed
104 105
	PlayerNameEn string `json:"playerNameEn" comment:"球员名称英文"`
	Username     string `json:"username" comment:"账号"`
haoyanbin's avatar
haoyanbin committed
106 107 108 109 110 111
	Status       string `json:"status" comment:"状态 1 离队 2 在队"` //状态 1 离队 2 在队
	common.ControlBy
}
type OrgPlayerUpdateStatusReq struct {
	Id     int    `json:"id" comment:""`                 //
	Status string `json:"status" comment:"状态 1 离队 2 在队"` //状态 1 离队 2 在队
haoyanbin's avatar
haoyanbin committed
112
	common.ControlBy
haoyanbin's avatar
1  
haoyanbin committed
113 114
}

haoyanbin's avatar
haoyanbin committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128
func (s *OrgPlayerUpdateReq) Generate(model *models.OrgPlayer) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.ClubId = s.ClubId
	model.TeamId = s.TeamId
	model.PlayerName = s.PlayerName
	model.IdCard = s.IdCard
	model.Sex = s.Sex
	model.PlayerNumber = s.PlayerNumber
	model.Position = s.Position
	model.PlayerImg = s.PlayerImg
	model.PlayerUserId = s.PlayerUserId
	model.ShareConf = s.ShareConf
haoyanbin's avatar
haoyanbin committed
129
	model.Status = s.Status
haoyanbin's avatar
1  
haoyanbin committed
130 131 132 133 134 135 136 137
}

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

// OrgPlayerGetReq 功能获取请求参数
type OrgPlayerGetReq struct {
haoyanbin's avatar
haoyanbin committed
138
	Id int `uri:"id"`
haoyanbin's avatar
1  
haoyanbin committed
139
}
haoyanbin's avatar
haoyanbin committed
140

haoyanbin's avatar
haoyanbin committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
type OrgPlayerGetReply struct {
	Id           int    `json:"id" comment:"球员id"`
	ClubId       string `json:"clubId" comment:"俱乐部id"`
	ClubName     string `json:"clubName" comment:"俱乐部名称"`
	TeamId       string `json:"teamId" comment:"球队id"`
	TeamName     string `json:"teamName" comment:"球队名称"`
	PlayerName   string `json:"playerName" comment:"球员名称"`
	PlayerNameEn string `json:"playerNameEn" comment:"球员名称英文"`
	IdCard       string `json:"idCard" comment:"身份证号"`
	Sex          string `json:"sex" comment:"性别"`
	PlayerNumber string `json:"playerNumber" comment:"球衣号"`
	Position     string `json:"position" comment:"场上位置"`
	PlayerImg    string `json:"playerImg" comment:"球员照片"`
	Username     string `json:"username" comment:"账号"`
	ShareConf    string `json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
haoyanbin's avatar
haoyanbin committed
156
	Status       string `json:"status" comment:"状态 1 离队 2 在队"` //1 离队 2 在队
haoyanbin's avatar
haoyanbin committed
157 158
}

haoyanbin's avatar
1  
haoyanbin committed
159 160 161 162 163 164 165 166 167 168 169
func (s *OrgPlayerGetReq) GetId() interface{} {
	return s.Id
}

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

func (s *OrgPlayerDeleteReq) GetId() interface{} {
	return s.Ids
haoyanbin's avatar
haoyanbin committed
170
}
haoyanbin's avatar
haoyanbin committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

func Pwd(password string) string {
	if password == "" {
		return ""
	}

	var hash []byte
	var err error
	if hash, err = bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost); err != nil {
		return ""
	} else {
		return string(hash)

	}
}