Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nbya
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoyanbin
nbya
Commits
1475ff59
Commit
1475ff59
authored
Jan 07, 2022
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
赛事球员
parent
16f22790
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
191 additions
and
127 deletions
+191
-127
org_match.go
app/operate/apis/org_match.go
+32
-9
org_match_team_player.go
app/operate/models/org_match_team_player.go
+2
-4
org_match.go
app/operate/router/org_match.go
+1
-1
org_match_team_player.go
app/operate/service/dto/org_match_team_player.go
+16
-3
org_player.go
app/operate/service/dto/org_player.go
+75
-73
org_match_team_player.go
app/operate/service/org_match_team_player.go
+14
-10
org_player.go
app/operate/service/org_player.go
+27
-27
match.go
common/dto/match.go
+24
-0
No files found.
app/operate/apis/org_match.go
View file @
1475ff59
...
@@ -56,9 +56,9 @@ func (e OrgMatch) GetPage(c *gin.Context) {
...
@@ -56,9 +56,9 @@ func (e OrgMatch) GetPage(c *gin.Context) {
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
}
}
// Get <赛事>获取比赛
列表搜索数据
// Get <赛事>获取比赛
附加数据(比赛详情,联赛,赛区,赛季,球队)
// @Summary <赛事>获取比赛
列表搜索数据
// @Summary <赛事>获取比赛
附加数据(比赛详情,联赛,赛区,赛季,球队)
// @Description <赛事>获取比赛
列表搜索数据
// @Description <赛事>获取比赛
附加数据(比赛详情,联赛,赛区,赛季,球队)
// @Tags <赛事>比赛
// @Tags <赛事>比赛
// @Param id path string false "id"
// @Param id path string false "id"
// @Success 200 {string} string {data=models.OrgMatchGetInfoReq} "{"code": 200, "data": [...]}"
// @Success 200 {string} string {data=models.OrgMatchGetInfoReq} "{"code": 200, "data": [...]}"
...
@@ -341,7 +341,7 @@ func (e OrgMatch) Delete(c *gin.Context) {
...
@@ -341,7 +341,7 @@ func (e OrgMatch) Delete(c *gin.Context) {
// @Tags <赛事>比赛
// @Tags <赛事>比赛
// @Param id path string false "id"
// @Param id path string false "id"
// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}"
// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}"
// @Router /api/v1/org-match/get-player
/{id}
[get]
// @Router /api/v1/org-match/get-player [get]
// @Security Bearer
// @Security Bearer
func
(
e
OrgMatch
)
GetPlayer
(
c
*
gin
.
Context
)
{
func
(
e
OrgMatch
)
GetPlayer
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgPlayerGetPageReq
{}
req
:=
dto
.
OrgPlayerGetPageReq
{}
...
@@ -445,38 +445,45 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
...
@@ -445,38 +445,45 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
}
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
p
:=
actions
.
GetPermissionFromContext
(
c
)
teamId
:=
""
for
_
,
v
:=
range
playersIds
{
for
_
,
v
:=
range
playersIds
{
orgPlayer
:=
new
(
models
.
OrgPlayer
)
orgPlayer
:=
new
(
models
.
OrgPlayer
)
id
,
_
:=
strconv
.
Atoi
(
v
)
id
,
_
:=
strconv
.
Atoi
(
v
)
reqOrgPlayer
:=
new
(
dto
.
OrgPlayerGetReq
)
reqOrgPlayer
:=
new
(
dto
.
OrgPlayerGetReq
)
reqOrgPlayer
.
Id
=
id
reqOrgPlayer
.
Id
=
id
err
=
sOrgPlayer
.
Get
(
reqOrgPlayer
,
p
,
orgPlayer
)
_
=
sOrgPlayer
.
Get
(
reqOrgPlayer
,
p
,
orgPlayer
)
//if orgPlayer.Id == 0 {
//if orgPlayer.Id == 0 {
// e.Error(500, err, "球员不存在")
// e.Error(500, err, "球员不存在")
// return
// return
//}
//}
teamId
=
orgPlayer
.
TeamId
if
err
!=
nil
{
err
,
playerId
:=
s
.
IsBeing
(
req
.
MatchId
,
req
.
Rounds
,
v
)
if
playerId
==
0
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerInsertReq
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerInsertReq
{
MatchId
:
req
.
MatchId
,
MatchId
:
req
.
MatchId
,
Rounds
:
req
.
Rounds
,
ClubId
:
orgPlayer
.
ClubId
,
ClubId
:
orgPlayer
.
ClubId
,
TeamId
:
orgPlayer
.
TeamId
,
TeamId
:
orgPlayer
.
TeamId
,
OtherTeamId
:
req
.
OtherTeamId
,
PlayerId
:
v
,
PlayerId
:
v
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
Position
:
orgPlayer
.
Position
,
Position
:
orgPlayer
.
Position
,
}
}
err
=
s
.
Insert
(
&
orgMatchPlayer
)
err
OrgMatchPlayer
:
=
s
.
Insert
(
&
orgMatchPlayer
)
if
err
!=
nil
{
if
err
OrgMatchPlayer
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建比赛球员数据 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建比赛球员数据 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
}
}
else
{
}
else
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerUpdateReq
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerUpdateReq
{
Id
:
playerId
,
MatchId
:
req
.
MatchId
,
MatchId
:
req
.
MatchId
,
Rounds
:
req
.
Rounds
,
ClubId
:
orgPlayer
.
ClubId
,
ClubId
:
orgPlayer
.
ClubId
,
TeamId
:
orgPlayer
.
TeamId
,
TeamId
:
orgPlayer
.
TeamId
,
OtherTeamId
:
req
.
OtherTeamId
,
PlayerId
:
v
,
PlayerId
:
v
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
...
@@ -490,6 +497,22 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
...
@@ -490,6 +497,22 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
}
}
}
}
reqRemovePlayers
:=
new
(
dto
.
OrgMatchTeamPlayerDeleteReq
)
reqRemovePlayers
.
MatchId
=
req
.
MatchId
reqRemovePlayers
.
Rounds
=
req
.
Rounds
reqRemovePlayers
.
TeamId
=
teamId
delPlayerIds
:=
""
for
_
,
v
:=
range
playersIds
{
delPlayerIds
+=
"'"
+
v
+
"',"
}
delPlayerIds
=
strings
.
Trim
(
delPlayerIds
,
","
)
reqRemovePlayers
.
Ids
=
delPlayerIds
err
=
s
.
Remove
(
reqRemovePlayers
,
p
)
//if err != nil {
// e.Error(500, err, fmt.Sprintf("删除比赛球员数据失败,\r\n失败信息 %s", err.Error()))
// return
//}
e
.
OK
(
1
,
"修改成功"
)
e
.
OK
(
1
,
"修改成功"
)
}
}
...
...
app/operate/models/org_match_team_player.go
View file @
1475ff59
...
@@ -9,9 +9,10 @@ import (
...
@@ -9,9 +9,10 @@ import (
type
OrgMatchTeamPlayer
struct
{
type
OrgMatchTeamPlayer
struct
{
models
.
Model
models
.
Model
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
Rounds
string
`json:"rounds"
comment:"
轮次"`
Rounds
string
`json:"rounds"
gorm:"type:bigint(20);comment:
轮次"`
ClubId
string
`json:"clubId" gorm:"type:bigint(20);comment:ClubId"`
ClubId
string
`json:"clubId" gorm:"type:bigint(20);comment:ClubId"`
TeamId
string
`json:"teamId" gorm:"type:bigint(20);comment:TeamId"`
TeamId
string
`json:"teamId" gorm:"type:bigint(20);comment:TeamId"`
OtherTeamId
string
`json:"otherTeamId" gorm:"type:bigint(20);comment:OtherTeamId"`
PlayerId
string
`json:"playerId" gorm:"type:bigint(20);comment:PlayerId"`
PlayerId
string
`json:"playerId" gorm:"type:bigint(20);comment:PlayerId"`
PlayerName
string
`json:"playerName" gorm:"type:varchar(60);comment:球员名称"`
PlayerName
string
`json:"playerName" gorm:"type:varchar(60);comment:球员名称"`
PlayerNumber
string
`json:"playerNumber" gorm:"type:varchar(60);comment:球员号码"`
PlayerNumber
string
`json:"playerNumber" gorm:"type:varchar(60);comment:球员号码"`
...
@@ -25,9 +26,6 @@ type OrgMatchTeamPlayer struct {
...
@@ -25,9 +26,6 @@ type OrgMatchTeamPlayer struct {
Foul
string
`json:"foul" gorm:"type:bigint(20);comment:犯规"`
Foul
string
`json:"foul" gorm:"type:bigint(20);comment:犯规"`
TwoPointShot
string
`json:"twoPointShot" gorm:"type:bigint(20);comment:2分进球数量"`
TwoPointShot
string
`json:"twoPointShot" gorm:"type:bigint(20);comment:2分进球数量"`
ThreePointShot
string
`json:"threePointShot" gorm:"type:bigint(20);comment:3分进球数量"`
ThreePointShot
string
`json:"threePointShot" gorm:"type:bigint(20);comment:3分进球数量"`
Grouping
string
`json:"grouping" comment:"分组"`
OtherTeam
string
`json:"otherTeam" comment:"对方球队"`
models
.
ModelTime
models
.
ModelTime
models
.
ControlBy
models
.
ControlBy
}
}
...
...
app/operate/router/org_match.go
View file @
1475ff59
...
@@ -23,7 +23,7 @@ func registerOrgMatchRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl
...
@@ -23,7 +23,7 @@ func registerOrgMatchRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl
r
.
POST
(
""
,
api
.
Insert
)
r
.
POST
(
""
,
api
.
Insert
)
r
.
PUT
(
"/:id"
,
api
.
Update
)
r
.
PUT
(
"/:id"
,
api
.
Update
)
r
.
DELETE
(
""
,
api
.
Delete
)
r
.
DELETE
(
""
,
api
.
Delete
)
r
.
GET
(
"/get-player
/:id
"
,
api
.
GetPlayer
)
r
.
GET
(
"/get-player"
,
api
.
GetPlayer
)
r
.
GET
(
"/get-player-is-set/:id"
,
api
.
GetPlayerIsSet
)
r
.
GET
(
"/get-player-is-set/:id"
,
api
.
GetPlayerIsSet
)
r
.
PUT
(
"/update-player/:id"
,
api
.
UpdatePlayer
)
r
.
PUT
(
"/update-player/:id"
,
api
.
UpdatePlayer
)
r
.
PUT
(
"/update-player-data/:id"
,
api
.
UpdatePlayerData
)
r
.
PUT
(
"/update-player-data/:id"
,
api
.
UpdatePlayerData
)
...
...
app/operate/service/dto/org_match_team_player.go
View file @
1475ff59
...
@@ -12,8 +12,10 @@ type OrgMatchTeamPlayerGetPageReq struct {
...
@@ -12,8 +12,10 @@ type OrgMatchTeamPlayerGetPageReq struct {
OrgMatchTeamPlayerOrder
OrgMatchTeamPlayerOrder
}
}
type
UpdateOrgMatchTeamPlayerReq
struct
{
type
UpdateOrgMatchTeamPlayerReq
struct
{
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
MatchId
string
`json:"matchId"`
PlayersIds
string
`json:"playersIds"`
Rounds
string
`json:"rounds"`
OtherTeamId
string
`json:"otherTeamId"`
PlayersIds
string
`json:"playersIds"`
}
}
type
OrgMatchTeamPlayerOrder
struct
{
type
OrgMatchTeamPlayerOrder
struct
{
...
@@ -48,8 +50,10 @@ func (m *OrgMatchTeamPlayerGetPageReq) GetNeedSearch() interface{} {
...
@@ -48,8 +50,10 @@ func (m *OrgMatchTeamPlayerGetPageReq) GetNeedSearch() interface{} {
type
OrgMatchTeamPlayerInsertReq
struct
{
type
OrgMatchTeamPlayerInsertReq
struct
{
Id
int
`json:"-" comment:""`
//
Id
int
`json:"-" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
MatchId
string
`json:"matchId" comment:""`
Rounds
string
`json:"rounds" comment:""`
ClubId
string
`json:"clubId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
TeamId
string
`json:"teamId" comment:""`
OtherTeamId
string
`json:"otherTeamId" comment:""`
PlayerId
string
`json:"playerId" comment:""`
PlayerId
string
`json:"playerId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
...
@@ -71,8 +75,10 @@ func (s *OrgMatchTeamPlayerInsertReq) Generate(model *models.OrgMatchTeamPlayer)
...
@@ -71,8 +75,10 @@ func (s *OrgMatchTeamPlayerInsertReq) Generate(model *models.OrgMatchTeamPlayer)
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
}
model
.
MatchId
=
s
.
MatchId
model
.
MatchId
=
s
.
MatchId
model
.
Rounds
=
s
.
Rounds
model
.
ClubId
=
s
.
ClubId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
TeamId
=
s
.
TeamId
model
.
OtherTeamId
=
s
.
OtherTeamId
model
.
PlayerId
=
s
.
PlayerId
model
.
PlayerId
=
s
.
PlayerId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
PlayerNumber
=
s
.
PlayerNumber
...
@@ -95,8 +101,10 @@ func (s *OrgMatchTeamPlayerInsertReq) GetId() interface{} {
...
@@ -95,8 +101,10 @@ func (s *OrgMatchTeamPlayerInsertReq) GetId() interface{} {
type
OrgMatchTeamPlayerUpdateReq
struct
{
type
OrgMatchTeamPlayerUpdateReq
struct
{
Id
int
`uri:"id" comment:""`
//
Id
int
`uri:"id" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
MatchId
string
`json:"matchId" comment:""`
Rounds
string
`json:"rounds" comment:""`
ClubId
string
`json:"clubId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
TeamId
string
`json:"teamId" comment:""`
OtherTeamId
string
`json:"otherTeamId" comment:""`
PlayerId
string
`json:"playerId" comment:""`
PlayerId
string
`json:"playerId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
...
@@ -118,8 +126,10 @@ func (s *OrgMatchTeamPlayerUpdateReq) Generate(model *models.OrgMatchTeamPlayer)
...
@@ -118,8 +126,10 @@ func (s *OrgMatchTeamPlayerUpdateReq) Generate(model *models.OrgMatchTeamPlayer)
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
}
model
.
MatchId
=
s
.
MatchId
model
.
MatchId
=
s
.
MatchId
model
.
Rounds
=
s
.
Rounds
model
.
ClubId
=
s
.
ClubId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
TeamId
=
s
.
TeamId
model
.
OtherTeamId
=
s
.
OtherTeamId
model
.
PlayerId
=
s
.
PlayerId
model
.
PlayerId
=
s
.
PlayerId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
PlayerNumber
=
s
.
PlayerNumber
...
@@ -150,7 +160,10 @@ func (s *OrgMatchTeamPlayerGetReq) GetId() interface{} {
...
@@ -150,7 +160,10 @@ func (s *OrgMatchTeamPlayerGetReq) GetId() interface{} {
// OrgMatchTeamPlayerDeleteReq 功能删除请求参数
// OrgMatchTeamPlayerDeleteReq 功能删除请求参数
type
OrgMatchTeamPlayerDeleteReq
struct
{
type
OrgMatchTeamPlayerDeleteReq
struct
{
Ids
[]
int
`json:"ids"`
MatchId
string
`json:"matchId"`
Rounds
string
`json:"rounds"`
TeamId
string
`json:"teamId"`
Ids
string
`json:"ids"`
}
}
func
(
s
*
OrgMatchTeamPlayerDeleteReq
)
GetId
()
interface
{}
{
func
(
s
*
OrgMatchTeamPlayerDeleteReq
)
GetId
()
interface
{}
{
...
...
app/operate/service/dto/org_player.go
View file @
1475ff59
...
@@ -8,27 +8,28 @@ import (
...
@@ -8,27 +8,28 @@ import (
)
)
type
OrgPlayerGetPageReq
struct
{
type
OrgPlayerGetPageReq
struct
{
dto
.
Pagination
`search:"-"`
dto
.
Pagination
`search:"-"`
OrgPlayerOrder
TeamId
string
`form:"teamId" search:"type:exact;column:team_id;table:org_player" comment:""`
OrgPlayerOrder
}
}
type
OrgPlayerOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_player"`
type
OrgPlayerOrder
struct
{
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club_
id;table:org_player"`
Id
int
`form:"idOrder" search:"type:order;column:
id;table:org_player"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team
_id;table:org_player"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club
_id;table:org_player"`
PlayerName
string
`form:"playerNameOrder" search:"type:order;column:player_name
;table:org_player"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team_id
;table:org_player"`
IdCard
string
`form:"idCardOrder" search:"type:order;column:id_card
;table:org_player"`
PlayerName
string
`form:"playerNameOrder" search:"type:order;column:player_name
;table:org_player"`
Sex
string
`form:"sexOrder" search:"type:order;column:sex
;table:org_player"`
IdCard
string
`form:"idCardOrder" search:"type:order;column:id_card
;table:org_player"`
PlayerNumber
string
`form:"playerNumberOrder" search:"type:order;column:player_number
;table:org_player"`
Sex
string
`form:"sexOrder" search:"type:order;column:sex
;table:org_player"`
Position
string
`form:"positionOrder" search:"type:order;column:position
;table:org_player"`
PlayerNumber
string
`form:"playerNumberOrder" search:"type:order;column:player_number
;table:org_player"`
PlayerImg
string
`form:"playerImgOrder" search:"type:order;column:player_img
;table:org_player"`
Position
string
`form:"positionOrder" search:"type:order;column:position
;table:org_player"`
PlayerUserId
string
`form:"playerUserIdOrder" search:"type:order;column:player_user_id
;table:org_player"`
PlayerImg
string
`form:"playerImgOrder" search:"type:order;column:player_img
;table:org_player"`
ShareConf
string
`form:"shareConfOrder" search:"type:order;column:share_conf
;table:org_player"`
PlayerUserId
string
`form:"playerUserIdOrder" search:"type:order;column:player_user_id
;table:org_player"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:create_by
;table:org_player"`
ShareConf
string
`form:"shareConfOrder" search:"type:order;column:share_conf
;table:org_player"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:upd
ate_by;table:org_player"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:cre
ate_by;table:org_player"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:created_at
;table:org_player"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:update_by
;table:org_player"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:upd
ated_at;table:org_player"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:cre
ated_at;table:org_player"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:dele
ted_at;table:org_player"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:upda
ted_at;table:org_player"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_player"`
}
}
func
(
m
*
OrgPlayerGetPageReq
)
GetNeedSearch
()
interface
{}
{
func
(
m
*
OrgPlayerGetPageReq
)
GetNeedSearch
()
interface
{}
{
...
@@ -36,34 +37,34 @@ func (m *OrgPlayerGetPageReq) GetNeedSearch() interface{} {
...
@@ -36,34 +37,34 @@ func (m *OrgPlayerGetPageReq) GetNeedSearch() interface{} {
}
}
type
OrgPlayerInsertReq
struct
{
type
OrgPlayerInsertReq
struct
{
Id
int
`json:"-" comment:""`
//
Id
int
`json:"-" comment:""`
//
ClubId
string
`json:"clubId" comment:"org_club表id"`
ClubId
string
`json:"clubId" comment:"org_club表id"`
TeamId
string
`json:"teamId" comment:"org_team表id"`
TeamId
string
`json:"teamId" comment:"org_team表id"`
PlayerName
string
`json:"playerName" comment:"球员姓名"`
PlayerName
string
`json:"playerName" comment:"球员姓名"`
IdCard
string
`json:"idCard" comment:"身份证号"`
IdCard
string
`json:"idCard" comment:"身份证号"`
Sex
string
`json:"sex" comment:"性别"`
Sex
string
`json:"sex" comment:"性别"`
PlayerNumber
string
`json:"playerNumber" comment:"球衣号码"`
PlayerNumber
string
`json:"playerNumber" comment:"球衣号码"`
Position
string
`json:"position" comment:"场上位置"`
Position
string
`json:"position" comment:"场上位置"`
PlayerImg
string
`json:"playerImg" comment:"球员照片"`
PlayerImg
string
`json:"playerImg" comment:"球员照片"`
PlayerUserId
string
`json:"playerUserId" comment:"org_player_user表id"`
PlayerUserId
string
`json:"playerUserId" comment:"org_player_user表id"`
ShareConf
string
`json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
ShareConf
string
`json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
common
.
ControlBy
common
.
ControlBy
}
}
func
(
s
*
OrgPlayerInsertReq
)
Generate
(
model
*
models
.
OrgPlayer
)
{
func
(
s
*
OrgPlayerInsertReq
)
Generate
(
model
*
models
.
OrgPlayer
)
{
if
s
.
Id
==
0
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
}
model
.
ClubId
=
s
.
ClubId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerName
=
s
.
PlayerName
model
.
IdCard
=
s
.
IdCard
model
.
IdCard
=
s
.
IdCard
model
.
Sex
=
s
.
Sex
model
.
Sex
=
s
.
Sex
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Position
=
s
.
Position
model
.
PlayerImg
=
s
.
PlayerImg
model
.
PlayerImg
=
s
.
PlayerImg
model
.
PlayerUserId
=
s
.
PlayerUserId
model
.
PlayerUserId
=
s
.
PlayerUserId
model
.
ShareConf
=
s
.
ShareConf
model
.
ShareConf
=
s
.
ShareConf
}
}
func
(
s
*
OrgPlayerInsertReq
)
GetId
()
interface
{}
{
func
(
s
*
OrgPlayerInsertReq
)
GetId
()
interface
{}
{
...
@@ -71,34 +72,34 @@ func (s *OrgPlayerInsertReq) GetId() interface{} {
...
@@ -71,34 +72,34 @@ func (s *OrgPlayerInsertReq) GetId() interface{} {
}
}
type
OrgPlayerUpdateReq
struct
{
type
OrgPlayerUpdateReq
struct
{
Id
int
`uri:"id" comment:""`
//
Id
int
`uri:"id" comment:""`
//
ClubId
string
`json:"clubId" comment:"org_club表id"`
ClubId
string
`json:"clubId" comment:"org_club表id"`
TeamId
string
`json:"teamId" comment:"org_team表id"`
TeamId
string
`json:"teamId" comment:"org_team表id"`
PlayerName
string
`json:"playerName" comment:"球员姓名"`
PlayerName
string
`json:"playerName" comment:"球员姓名"`
IdCard
string
`json:"idCard" comment:"身份证号"`
IdCard
string
`json:"idCard" comment:"身份证号"`
Sex
string
`json:"sex" comment:"性别"`
Sex
string
`json:"sex" comment:"性别"`
PlayerNumber
string
`json:"playerNumber" comment:"球衣号码"`
PlayerNumber
string
`json:"playerNumber" comment:"球衣号码"`
Position
string
`json:"position" comment:"场上位置"`
Position
string
`json:"position" comment:"场上位置"`
PlayerImg
string
`json:"playerImg" comment:"球员照片"`
PlayerImg
string
`json:"playerImg" comment:"球员照片"`
PlayerUserId
string
`json:"playerUserId" comment:"org_player_user表id"`
PlayerUserId
string
`json:"playerUserId" comment:"org_player_user表id"`
ShareConf
string
`json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
ShareConf
string
`json:"shareConf" comment:"分享功能 1 开启 2 关闭"`
common
.
ControlBy
common
.
ControlBy
}
}
func
(
s
*
OrgPlayerUpdateReq
)
Generate
(
model
*
models
.
OrgPlayer
)
{
func
(
s
*
OrgPlayerUpdateReq
)
Generate
(
model
*
models
.
OrgPlayer
)
{
if
s
.
Id
==
0
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
}
model
.
ClubId
=
s
.
ClubId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerName
=
s
.
PlayerName
model
.
IdCard
=
s
.
IdCard
model
.
IdCard
=
s
.
IdCard
model
.
Sex
=
s
.
Sex
model
.
Sex
=
s
.
Sex
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Position
=
s
.
Position
model
.
PlayerImg
=
s
.
PlayerImg
model
.
PlayerImg
=
s
.
PlayerImg
model
.
PlayerUserId
=
s
.
PlayerUserId
model
.
PlayerUserId
=
s
.
PlayerUserId
model
.
ShareConf
=
s
.
ShareConf
model
.
ShareConf
=
s
.
ShareConf
}
}
func
(
s
*
OrgPlayerUpdateReq
)
GetId
()
interface
{}
{
func
(
s
*
OrgPlayerUpdateReq
)
GetId
()
interface
{}
{
...
@@ -107,8 +108,9 @@ func (s *OrgPlayerUpdateReq) GetId() interface{} {
...
@@ -107,8 +108,9 @@ func (s *OrgPlayerUpdateReq) GetId() interface{} {
// OrgPlayerGetReq 功能获取请求参数
// OrgPlayerGetReq 功能获取请求参数
type
OrgPlayerGetReq
struct
{
type
OrgPlayerGetReq
struct
{
Id
int
`uri:"id"`
Id
int
`uri:"id"`
}
}
func
(
s
*
OrgPlayerGetReq
)
GetId
()
interface
{}
{
func
(
s
*
OrgPlayerGetReq
)
GetId
()
interface
{}
{
return
s
.
Id
return
s
.
Id
}
}
...
@@ -120,4 +122,4 @@ type OrgPlayerDeleteReq struct {
...
@@ -120,4 +122,4 @@ type OrgPlayerDeleteReq struct {
func
(
s
*
OrgPlayerDeleteReq
)
GetId
()
interface
{}
{
func
(
s
*
OrgPlayerDeleteReq
)
GetId
()
interface
{}
{
return
s
.
Ids
return
s
.
Ids
}
}
\ No newline at end of file
app/operate/service/org_match_team_player.go
View file @
1475ff59
...
@@ -81,7 +81,7 @@ func (e *OrgMatchTeamPlayer) Update(c *dto.OrgMatchTeamPlayerUpdateReq, p *actio
...
@@ -81,7 +81,7 @@ func (e *OrgMatchTeamPlayer) Update(c *dto.OrgMatchTeamPlayerUpdateReq, p *actio
)
.
First
(
&
data
,
c
.
GetId
())
)
.
First
(
&
data
,
c
.
GetId
())
c
.
Generate
(
&
data
)
c
.
Generate
(
&
data
)
db
:=
e
.
Orm
.
Save
(
&
data
)
db
:=
e
.
Orm
.
Updates
(
&
data
)
if
db
.
Error
!=
nil
{
if
db
.
Error
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchTeamPlayerService Save error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"OrgMatchTeamPlayerService Save error:%s
\r\n
"
,
err
)
return
err
return
err
...
@@ -99,7 +99,11 @@ func (e *OrgMatchTeamPlayer) Remove(d *dto.OrgMatchTeamPlayerDeleteReq, p *actio
...
@@ -99,7 +99,11 @@ func (e *OrgMatchTeamPlayer) Remove(d *dto.OrgMatchTeamPlayerDeleteReq, p *actio
db
:=
e
.
Orm
.
Model
(
&
data
)
.
db
:=
e
.
Orm
.
Model
(
&
data
)
.
Scopes
(
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
Delete
(
&
data
,
d
.
GetId
())
cDto
.
SetWhere
(
""
,
"match_id"
,
d
.
MatchId
),
cDto
.
SetWhere
(
""
,
"rounds"
,
d
.
Rounds
),
cDto
.
SetWhere
(
""
,
"team_id"
,
d
.
TeamId
),
cDto
.
SetWhereNotIn
(
""
,
"player_id"
,
d
.
Ids
),
)
.
Delete
(
&
data
)
if
err
:=
db
.
Error
;
err
!=
nil
{
if
err
:=
db
.
Error
;
err
!=
nil
{
e
.
Log
.
Errorf
(
"Service RemoveOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"Service RemoveOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
return
err
return
err
...
@@ -111,22 +115,22 @@ func (e *OrgMatchTeamPlayer) Remove(d *dto.OrgMatchTeamPlayerDeleteReq, p *actio
...
@@ -111,22 +115,22 @@ func (e *OrgMatchTeamPlayer) Remove(d *dto.OrgMatchTeamPlayerDeleteReq, p *actio
}
}
// Insert 创建OrgMatchTeamPlayer对象
// Insert 创建OrgMatchTeamPlayer对象
func
(
e
*
OrgMatchTeamPlayer
)
IsBeing
(
d
*
dto
.
OrgMatchTeamPlayerGetReq
,
p
*
actions
.
DataPermission
,
model
*
models
.
OrgMatchTeamPlayer
)
error
{
func
(
e
*
OrgMatchTeamPlayer
)
IsBeing
(
matchId
string
,
rounds
string
,
playerId
string
)
(
error
,
int
)
{
var
data
models
.
OrgMatchTeamPlayer
var
data
models
.
OrgMatchTeamPlayer
err
:=
e
.
Orm
.
Model
(
&
data
)
.
err
:=
e
.
Orm
.
Model
(
&
data
)
.
Scopes
(
Where
(
"match_id=?"
,
matchId
)
.
actions
.
Permission
(
data
.
TableName
(),
p
),
Where
(
"rounds=?"
,
rounds
)
.
)
.
Where
(
"player_id=?"
,
playerId
)
.
First
(
model
,
d
.
GetId
()
)
.
Error
First
(
&
data
)
.
Error
if
err
!=
nil
&&
errors
.
Is
(
err
,
gorm
.
ErrRecordNotFound
)
{
if
err
!=
nil
&&
errors
.
Is
(
err
,
gorm
.
ErrRecordNotFound
)
{
err
=
errors
.
New
(
"查看对象不存在或无权查看"
)
err
=
errors
.
New
(
"查看对象不存在或无权查看"
)
e
.
Log
.
Errorf
(
"Service GetOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"Service GetOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
return
err
return
err
,
0
}
}
if
err
!=
nil
{
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"db error:%s"
,
err
)
e
.
Log
.
Errorf
(
"db error:%s"
,
err
)
return
err
return
err
,
0
}
}
return
nil
return
nil
,
data
.
Id
}
}
app/operate/service/org_player.go
View file @
1475ff59
...
@@ -2,8 +2,7 @@ package service
...
@@ -2,8 +2,7 @@ package service
import
(
import
(
"errors"
"errors"
"github.com/go-admin-team/go-admin-core/sdk/service"
"github.com/go-admin-team/go-admin-core/sdk/service"
"gorm.io/gorm"
"gorm.io/gorm"
"go-admin/app/operate/models"
"go-admin/app/operate/models"
...
@@ -26,6 +25,7 @@ func (e *OrgPlayer) GetPage(c *dto.OrgPlayerGetPageReq, p *actions.DataPermissio
...
@@ -26,6 +25,7 @@ func (e *OrgPlayer) GetPage(c *dto.OrgPlayerGetPageReq, p *actions.DataPermissio
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
MakeCondition
(
c
.
GetNeedSearch
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
cDto
.
Paginate
(
c
.
GetPageSize
(),
c
.
GetPageIndex
()),
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
cDto
.
SetWhere
(
""
,
"team_id"
,
c
.
TeamId
),
)
.
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Find
(
list
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
count
)
.
Error
Count
(
count
)
.
Error
...
@@ -59,9 +59,9 @@ func (e *OrgPlayer) Get(d *dto.OrgPlayerGetReq, p *actions.DataPermission, model
...
@@ -59,9 +59,9 @@ func (e *OrgPlayer) Get(d *dto.OrgPlayerGetReq, p *actions.DataPermission, model
// Insert 创建OrgPlayer对象
// Insert 创建OrgPlayer对象
func
(
e
*
OrgPlayer
)
Insert
(
c
*
dto
.
OrgPlayerInsertReq
)
error
{
func
(
e
*
OrgPlayer
)
Insert
(
c
*
dto
.
OrgPlayerInsertReq
)
error
{
var
err
error
var
err
error
var
data
models
.
OrgPlayer
var
data
models
.
OrgPlayer
c
.
Generate
(
&
data
)
c
.
Generate
(
&
data
)
err
=
e
.
Orm
.
Create
(
&
data
)
.
Error
err
=
e
.
Orm
.
Create
(
&
data
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgPlayerService Insert error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"OrgPlayerService Insert error:%s
\r\n
"
,
err
)
...
@@ -72,22 +72,22 @@ func (e *OrgPlayer) Insert(c *dto.OrgPlayerInsertReq) error {
...
@@ -72,22 +72,22 @@ func (e *OrgPlayer) Insert(c *dto.OrgPlayerInsertReq) error {
// Update 修改OrgPlayer对象
// Update 修改OrgPlayer对象
func
(
e
*
OrgPlayer
)
Update
(
c
*
dto
.
OrgPlayerUpdateReq
,
p
*
actions
.
DataPermission
)
error
{
func
(
e
*
OrgPlayer
)
Update
(
c
*
dto
.
OrgPlayerUpdateReq
,
p
*
actions
.
DataPermission
)
error
{
var
err
error
var
err
error
var
data
=
models
.
OrgPlayer
{}
var
data
=
models
.
OrgPlayer
{}
e
.
Orm
.
Scopes
(
e
.
Orm
.
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
First
(
&
data
,
c
.
GetId
())
)
.
First
(
&
data
,
c
.
GetId
())
c
.
Generate
(
&
data
)
c
.
Generate
(
&
data
)
db
:=
e
.
Orm
.
Save
(
&
data
)
db
:=
e
.
Orm
.
Save
(
&
data
)
if
db
.
Error
!=
nil
{
if
db
.
Error
!=
nil
{
e
.
Log
.
Errorf
(
"OrgPlayerService Save error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"OrgPlayerService Save error:%s
\r\n
"
,
err
)
return
err
return
err
}
}
if
db
.
RowsAffected
==
0
{
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权更新该数据"
)
return
errors
.
New
(
"无权更新该数据"
)
}
}
return
nil
return
nil
}
}
// Remove 删除OrgPlayer
// Remove 删除OrgPlayer
...
@@ -99,11 +99,11 @@ func (e *OrgPlayer) Remove(d *dto.OrgPlayerDeleteReq, p *actions.DataPermission)
...
@@ -99,11 +99,11 @@ func (e *OrgPlayer) Remove(d *dto.OrgPlayerDeleteReq, p *actions.DataPermission)
actions
.
Permission
(
data
.
TableName
(),
p
),
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
Delete
(
&
data
,
d
.
GetId
())
)
.
Delete
(
&
data
,
d
.
GetId
())
if
err
:=
db
.
Error
;
err
!=
nil
{
if
err
:=
db
.
Error
;
err
!=
nil
{
e
.
Log
.
Errorf
(
"Service RemoveOrgPlayer error:%s
\r\n
"
,
err
)
e
.
Log
.
Errorf
(
"Service RemoveOrgPlayer error:%s
\r\n
"
,
err
)
return
err
return
err
}
}
if
db
.
RowsAffected
==
0
{
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权删除该数据"
)
return
errors
.
New
(
"无权删除该数据"
)
}
}
return
nil
return
nil
}
}
\ No newline at end of file
common/dto/match.go
View file @
1475ff59
...
@@ -64,3 +64,27 @@ func SetWhere(tableName string, fieldName string, fieldValue string) func(db *go
...
@@ -64,3 +64,27 @@ func SetWhere(tableName string, fieldName string, fieldValue string) func(db *go
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" = ?"
,
fieldValue
)
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" = ?"
,
fieldValue
)
}
}
}
}
func
SetWhereIn
(
tableName
string
,
fieldName
string
,
fieldValue
string
)
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
if
fieldValue
==
"0"
||
fieldValue
==
""
{
return
db
}
if
tableName
==
""
{
return
db
.
Where
(
fieldName
+
" in ("
+
fieldValue
+
")"
)
}
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" in ("
+
fieldValue
+
")"
)
}
}
func
SetWhereNotIn
(
tableName
string
,
fieldName
string
,
fieldValue
string
)
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
if
fieldValue
==
"0"
||
fieldValue
==
""
{
return
db
}
if
tableName
==
""
{
return
db
.
Where
(
fieldName
+
" not in ("
+
fieldValue
+
")"
)
}
return
db
.
Where
(
tableName
+
"."
+
fieldName
+
" not in ("
+
fieldValue
+
")"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment