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
4877c269
Commit
4877c269
authored
Dec 28, 2021
by
haoyanbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
赛事管理
parent
754b285d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
598 additions
and
413 deletions
+598
-413
org_match.go
app/operate/apis/org_match.go
+225
-94
org_season.go
app/operate/apis/org_season.go
+80
-65
org_match_team_player.go
app/operate/models/org_match_team_player.go
+21
-22
org_match.go
app/operate/router/org_match.go
+5
-5
org_match.go
app/operate/service/dto/org_match.go
+112
-103
org_match_team_player.go
app/operate/service/dto/org_match_team_player.go
+103
-98
org_season.go
app/operate/service/dto/org_season.go
+5
-0
org_match_team_player.go
app/operate/service/org_match_team_player.go
+47
-26
No files found.
app/operate/apis/org_match.go
View file @
4877c269
package
apis
import
(
"fmt"
"fmt"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
...
...
@@ -28,18 +30,18 @@ type OrgMatch struct {
// @Router /api/v1/org-match [get]
// @Security Bearer
func
(
e
OrgMatch
)
GetPage
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchGetPageReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgMatchGetPageReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
list
:=
make
([]
models
.
OrgMatch
,
0
)
...
...
@@ -48,7 +50,7 @@ func (e OrgMatch) GetPage(c *gin.Context) {
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
...
...
@@ -65,7 +67,7 @@ func (e OrgMatch) GetPage(c *gin.Context) {
func
(
e
OrgMatch
)
Get
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchGetReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
...
...
@@ -80,11 +82,91 @@ func (e OrgMatch) Get(c *gin.Context) {
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
//e.Error(500, err, fmt.Sprintf("获取比赛失败,\r\n失败信息 %s", err.Error()))
//return
}
//联赛级别列表
sOrgLeague
:=
service
.
OrgLeague
{}
listOrgLeague
:=
make
([]
models
.
OrgLeague
,
0
)
var
countOrgLeague
int64
=
0
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgLeague
.
Service
)
.
Errors
reqOrgLeague
:=
new
(
dto
.
OrgLeagueGetPageReq
)
reqOrgLeague
.
PageIndex
=
1
reqOrgLeague
.
PageSize
=
999
err
=
sOrgLeague
.
GetPage
(
reqOrgLeague
,
p
,
&
listOrgLeague
,
&
countOrgLeague
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取联赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
//赛季列表
sOrgSeason
:=
service
.
OrgSeason
{}
listOrgSeason
:=
make
([]
models
.
OrgSeason
,
0
)
var
countOrgSeason
int64
=
0
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgSeason
.
Service
)
.
Errors
reqOrgSeason
:=
new
(
dto
.
OrgSeasonGetPageReq
)
reqOrgSeason
.
PageIndex
=
1
reqOrgSeason
.
PageSize
=
999
err
=
sOrgSeason
.
GetPage
(
reqOrgSeason
,
p
,
&
listOrgSeason
,
&
countOrgSeason
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取联赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
//赛区列表
sOrgDivision
:=
service
.
OrgDivision
{}
listOrgDivision
:=
make
([]
models
.
OrgDivision
,
0
)
var
countOrgDivision
int64
=
0
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgDivision
.
Service
)
.
Errors
reqOrgDivision
:=
new
(
dto
.
OrgDivisionGetPageReq
)
reqOrgDivision
.
PageIndex
=
1
reqOrgDivision
.
PageSize
=
999
err
=
sOrgDivision
.
GetPage
(
reqOrgDivision
,
p
,
&
listOrgDivision
,
&
countOrgDivision
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取联赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
//球队列表
sOrgTeam
:=
service
.
OrgTeam
{}
listOrgTeam
:=
make
([]
models
.
OrgTeam
,
0
)
var
countOrgTeam
int64
=
0
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgTeam
.
Service
)
.
Errors
reqOrgTeam
:=
new
(
dto
.
OrgTeamGetPageReq
)
reqOrgTeam
.
PageIndex
=
1
reqOrgTeam
.
PageSize
=
999
err
=
sOrgTeam
.
GetPage
(
reqOrgTeam
,
p
,
&
listOrgTeam
,
&
countOrgTeam
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取联赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
:=
dto
.
OrgMatchGetReply
{
OrgMatch
:
object
,
OrgLeagueList
:
listOrgLeague
,
OrgSeasonList
:
listOrgSeason
,
OrgDivisionList
:
listOrgDivision
,
OrgTeamList
:
listOrgTeam
,
}
e
.
OK
(
object
,
"查询成功"
)
e
.
OK
(
reply
,
"查询成功"
)
}
// Insert <赛事>创建比赛
...
...
@@ -98,25 +180,25 @@ func (e OrgMatch) Get(c *gin.Context) {
// @Router /api/v1/org-match [post]
// @Security Bearer
func
(
e
OrgMatch
)
Insert
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchInsertReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgMatchInsertReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
// 设置创建人
req
.
SetCreateBy
(
user
.
GetUserId
(
c
))
err
=
s
.
Insert
(
&
req
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建比赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"创建成功"
)
...
...
@@ -133,27 +215,27 @@ func (e OrgMatch) Insert(c *gin.Context) {
// @Router /api/v1/org-match/{id} [put]
// @Security Bearer
func
(
e
OrgMatch
)
Update
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchUpdateReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgMatchUpdateReq
{}
s
:=
service
.
OrgMatch
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
.
SetUpdateBy
(
user
.
GetUserId
(
c
))
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Update
(
&
req
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"修改比赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
}
// Delete <赛事>删除比赛
...
...
@@ -165,18 +247,18 @@ func (e OrgMatch) Update(c *gin.Context) {
// @Router /api/v1/org-match [delete]
// @Security Bearer
func
(
e
OrgMatch
)
Delete
(
c
*
gin
.
Context
)
{
s
:=
service
.
OrgMatch
{}
req
:=
dto
.
OrgMatchDeleteReq
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
s
:=
service
.
OrgMatch
{}
req
:=
dto
.
OrgMatchDeleteReq
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
// req.SetUpdateBy(user.GetUserId(c))
p
:=
actions
.
GetPermissionFromContext
(
c
)
...
...
@@ -184,23 +266,22 @@ func (e OrgMatch) Delete(c *gin.Context) {
err
=
s
.
Remove
(
&
req
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"删除比赛失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"删除成功"
)
e
.
OK
(
req
.
GetId
(),
"删除成功"
)
}
// Get <赛事>获取比赛所有球员
// @Summary <赛事>获取比赛所有球员
// @Description <赛事>获取比赛所有球员
// @Tags <赛事>比赛
// @Param id path string false "id"
// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}"
// @Router /api/v1/org-match/get-player
s
/{id} [get]
// @Router /api/v1/org-match/get-player/{id} [get]
// @Security Bearer
func
(
e
OrgMatch
)
GetPlayer
s
(
c
*
gin
.
Context
)
{
req
:=
dto
.
Org
MatchGet
Req
{}
s
:=
service
.
Org
Match
{}
func
(
e
OrgMatch
)
GetPlayer
(
c
*
gin
.
Context
)
{
req
:=
dto
.
Org
PlayerGetPage
Req
{}
s
:=
service
.
Org
Player
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
...
...
@@ -211,16 +292,21 @@ func (e OrgMatch) GetPlayers(c *gin.Context) {
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
var
object
models
.
OrgMatch
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
list
:=
make
([]
models
.
OrgPlayer
,
0
)
var
count
int64
req
.
PageIndex
=
1
req
.
PageSize
=
999
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取
比赛
失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取
球员
失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
e
.
OK
(
object
,
"查询成功"
)
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
()
,
"查询成功"
)
}
// Get <赛事>获取比赛已设置球员
...
...
@@ -229,11 +315,11 @@ func (e OrgMatch) GetPlayers(c *gin.Context) {
// @Tags <赛事>比赛
// @Param id path string false "id"
// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}"
// @Router /api/v1/org-match/get-player
s
-is-set/{id} [get]
// @Router /api/v1/org-match/get-player-is-set/{id} [get]
// @Security Bearer
func
(
e
OrgMatch
)
GetPlayer
s
IsSet
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatch
Get
Req
{}
s
:=
service
.
OrgMatch
{}
func
(
e
OrgMatch
)
GetPlayerIsSet
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatch
TeamPlayerGetPage
Req
{}
s
:=
service
.
OrgMatch
TeamPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
...
...
@@ -244,16 +330,21 @@ func (e OrgMatch) GetPlayersIsSet(c *gin.Context) {
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
var
object
models
.
OrgMatch
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
list
:=
make
([]
models
.
OrgMatchTeamPlayer
,
0
)
var
count
int64
req
.
PageIndex
=
1
req
.
PageSize
=
999
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取比赛
球员数据
失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
e
.
OK
(
object
,
"查询成功"
)
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
()
,
"查询成功"
)
}
// Update <赛事>修改比赛球员
...
...
@@ -262,13 +353,13 @@ func (e OrgMatch) GetPlayersIsSet(c *gin.Context) {
// @Tags <赛事>比赛
// @Accept application/json
// @Product application/json
// @Param data body dto.
OrgMatchUpdate
Req true "body"
// @Param data body dto.
UpdateOrgMatchTeamPlayer
Req true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/org-match/update-player
s
/{id} [put]
// @Router /api/v1/org-match/update-player/{id} [put]
// @Security Bearer
func
(
e
OrgMatch
)
UpdatePlayer
s
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchUpdate
Req
{}
s
:=
service
.
OrgMatch
{}
func
(
e
OrgMatch
)
UpdatePlayer
(
c
*
gin
.
Context
)
{
req
:=
dto
.
UpdateOrgMatchTeamPlayer
Req
{}
s
:=
service
.
OrgMatch
TeamPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
...
...
@@ -279,15 +370,55 @@ func (e OrgMatch) UpdatePlayers(c *gin.Context) {
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
.
SetUpdateBy
(
user
.
GetUserId
(
c
))
p
:=
actions
.
GetPermissionFromContext
(
c
)
playersIds
:=
strings
.
Split
(
req
.
PlayersIds
,
","
)
err
=
s
.
Update
(
&
req
,
p
)
sOrgPlayer
:=
service
.
OrgPlayer
{}
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"修改比赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
p
:=
actions
.
GetPermissionFromContext
(
c
)
for
_
,
v
:=
range
playersIds
{
var
orgPlayer
models
.
OrgPlayer
id
,
_
:=
strconv
.
Atoi
(
v
)
err
=
sOrgPlayer
.
Get
(
&
dto
.
OrgPlayerGetReq
{
Id
:
id
},
p
,
&
orgPlayer
)
if
err
!=
nil
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerInsertReq
{
MatchId
:
req
.
MatchId
,
ClubId
:
orgPlayer
.
ClubId
,
TeamId
:
orgPlayer
.
TeamId
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
Position
:
orgPlayer
.
Position
,
}
err
=
s
.
Insert
(
&
orgMatchPlayer
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建比赛球员数据 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
}
else
{
orgMatchPlayer
:=
dto
.
OrgMatchTeamPlayerUpdateReq
{
MatchId
:
req
.
MatchId
,
ClubId
:
orgPlayer
.
ClubId
,
TeamId
:
orgPlayer
.
TeamId
,
PlayerName
:
orgPlayer
.
PlayerName
,
PlayerNumber
:
orgPlayer
.
PlayerNumber
,
Position
:
orgPlayer
.
Position
,
}
err
=
s
.
Update
(
&
orgMatchPlayer
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建比赛球员数据 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
}
}
e
.
OK
(
1
,
"修改成功"
)
}
// Update <赛事>修改比赛球员数据
...
...
@@ -296,13 +427,13 @@ func (e OrgMatch) UpdatePlayers(c *gin.Context) {
// @Tags <赛事>比赛
// @Accept application/json
// @Product application/json
// @Param data body dto.OrgMatchUpdateReq true "body"
// @Param data body dto.OrgMatch
TeamPlayer
UpdateReq true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/org-match/update-player
s
-data/{id} [put]
// @Router /api/v1/org-match/update-player-data/{id} [put]
// @Security Bearer
func
(
e
OrgMatch
)
UpdatePlayer
s
Data
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatchUpdateReq
{}
s
:=
service
.
OrgMatch
{}
func
(
e
OrgMatch
)
UpdatePlayerData
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgMatch
TeamPlayer
UpdateReq
{}
s
:=
service
.
OrgMatch
TeamPlayer
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
...
...
@@ -318,8 +449,8 @@ func (e OrgMatch) UpdatePlayersData(c *gin.Context) {
err
=
s
.
Update
(
&
req
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"修改比赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"修改比赛
球员数据
失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
}
\ No newline at end of file
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
}
app/operate/apis/org_season.go
View file @
4877c269
package
apis
import
(
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
...
...
@@ -28,18 +27,18 @@ type OrgSeason struct {
// @Router /api/v1/org-season [get]
// @Security Bearer
func
(
e
OrgSeason
)
GetPage
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgSeasonGetPageReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgSeasonGetPageReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
p
:=
actions
.
GetPermissionFromContext
(
c
)
list
:=
make
([]
models
.
OrgSeason
,
0
)
...
...
@@ -48,7 +47,7 @@ func (e OrgSeason) GetPage(c *gin.Context) {
err
=
s
.
GetPage
(
&
req
,
p
,
&
list
,
&
count
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取赛季 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
PageOK
(
list
,
int
(
count
),
req
.
GetPageIndex
(),
req
.
GetPageSize
(),
"查询成功"
)
...
...
@@ -65,11 +64,7 @@ func (e OrgSeason) GetPage(c *gin.Context) {
func
(
e
OrgSeason
)
Get
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgSeasonGetReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
...
...
@@ -80,11 +75,31 @@ func (e OrgSeason) Get(c *gin.Context) {
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Get
(
&
req
,
p
,
&
object
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取赛季失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
//
e.Error(500, err, fmt.Sprintf("获取赛季失败,\r\n失败信息 %s", err.Error()))
//
return
}
e
.
OK
(
object
,
"查询成功"
)
//联赛级别列表
sOrgLeague
:=
service
.
OrgLeague
{}
listOrgLeague
:=
make
([]
models
.
OrgLeague
,
0
)
var
countOrgLeague
int64
=
0
err
=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
MakeService
(
&
sOrgLeague
.
Service
)
.
Errors
reqOrgLeague
:=
new
(
dto
.
OrgLeagueGetPageReq
)
reqOrgLeague
.
PageIndex
=
1
reqOrgLeague
.
PageSize
=
999
err
=
sOrgLeague
.
GetPage
(
reqOrgLeague
,
p
,
&
listOrgLeague
,
&
countOrgLeague
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"获取联赛 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
}
reply
:=
dto
.
OrgSeasonGetReply
{
OrgLeagueList
:
listOrgLeague
,
OrgSeason
:
object
}
e
.
OK
(
reply
,
"查询成功"
)
}
// Insert <赛事>创建赛季
...
...
@@ -98,25 +113,25 @@ func (e OrgSeason) Get(c *gin.Context) {
// @Router /api/v1/org-season [post]
// @Security Bearer
func
(
e
OrgSeason
)
Insert
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgSeasonInsertReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgSeasonInsertReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
// 设置创建人
req
.
SetCreateBy
(
user
.
GetUserId
(
c
))
err
=
s
.
Insert
(
&
req
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"创建赛季 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"创建成功"
)
...
...
@@ -133,27 +148,27 @@ func (e OrgSeason) Insert(c *gin.Context) {
// @Router /api/v1/org-season/{id} [put]
// @Security Bearer
func
(
e
OrgSeason
)
Update
(
c
*
gin
.
Context
)
{
req
:=
dto
.
OrgSeasonUpdateReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
:=
dto
.
OrgSeasonUpdateReq
{}
s
:=
service
.
OrgSeason
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
req
.
SetUpdateBy
(
user
.
GetUserId
(
c
))
p
:=
actions
.
GetPermissionFromContext
(
c
)
err
=
s
.
Update
(
&
req
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"修改赛季 失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
e
.
OK
(
req
.
GetId
(),
"修改成功"
)
}
// Delete 删除赛季
...
...
@@ -165,18 +180,18 @@ func (e OrgSeason) Update(c *gin.Context) {
// @Router /api/v1/org-season [delete]
// @Security Bearer
func
(
e
OrgSeason
)
Delete
(
c
*
gin
.
Context
)
{
s
:=
service
.
OrgSeason
{}
req
:=
dto
.
OrgSeasonDeleteReq
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
s
:=
service
.
OrgSeason
{}
req
:=
dto
.
OrgSeasonDeleteReq
{}
err
:=
e
.
MakeContext
(
c
)
.
MakeOrm
()
.
Bind
(
&
req
)
.
MakeService
(
&
s
.
Service
)
.
Errors
if
err
!=
nil
{
e
.
Logger
.
Error
(
err
)
e
.
Error
(
500
,
err
,
err
.
Error
())
return
}
// req.SetUpdateBy(user.GetUserId(c))
p
:=
actions
.
GetPermissionFromContext
(
c
)
...
...
@@ -184,7 +199,7 @@ func (e OrgSeason) Delete(c *gin.Context) {
err
=
s
.
Remove
(
&
req
,
p
)
if
err
!=
nil
{
e
.
Error
(
500
,
err
,
fmt
.
Sprintf
(
"删除赛季失败,
\r\n
失败信息 %s"
,
err
.
Error
()))
return
return
}
e
.
OK
(
req
.
GetId
(),
"删除成功"
)
}
\ No newline at end of file
e
.
OK
(
req
.
GetId
(),
"删除成功"
)
}
app/operate/models/org_match_team_player.go
View file @
4877c269
package
models
import
(
// "gorm.io/gorm"
// "gorm.io/gorm"
"go-admin/common/models"
)
type
OrgMatchTeamPlayer
struct
{
models
.
Model
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
ClubId
string
`json:"clubId" gorm:"type:bigint(20);comment:ClubId"`
TeamId
string
`json:"teamId" gorm:"type:bigint(20);comment:TeamId"`
PlayerName
string
`json:"playerName" gorm:"type:varchar(60);comment:球员名称"`
PlayerNumber
string
`json:"playerNumber" gorm:"type:varchar(60);comment:球员号码"`
Position
string
`json:"position" gorm:"type:varchar(60);comment:场上位置"`
Scoring
string
`json:"scoring" gorm:"type:bigint(20);comment:得分"`
Rebound
string
`json:"rebound" gorm:"type:bigint(20);comment:篮板"`
Assist
string
`json:"assist" gorm:"type:bigint(20);comment:助攻"`
Steal
string
`json:"steal" gorm:"type:bigint(20);comment:抢断"`
FreeThrow
string
`json:"freeThrow" gorm:"type:bigint(20);comment:罚球"`
BlockShot
string
`json:"blockShot" gorm:"type:bigint(20);comment:盖帽"`
Foul
string
`json:"foul" gorm:"type:bigint(20);comment:犯规"`
TwoPointShot
string
`json:"twoPointShot" gorm:"type:bigint(20);comment:2分进球数量"`
ThreePointShot
string
`json:"threePointShot" gorm:"type:bigint(20);comment:3分进球数量"`
models
.
ModelTime
models
.
ControlBy
models
.
Model
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
ClubId
string
`json:"clubId" gorm:"type:bigint(20);comment:ClubId"`
TeamId
string
`json:"teamId" gorm:"type:bigint(20);comment:TeamId"`
PlayerName
string
`json:"playerName" gorm:"type:varchar(60);comment:球员名称"`
PlayerNumber
string
`json:"playerNumber" gorm:"type:varchar(60);comment:球员号码"`
Position
string
`json:"position" gorm:"type:varchar(60);comment:场上位置"`
Scoring
string
`json:"scoring" gorm:"type:bigint(20);comment:得分"`
Rebound
string
`json:"rebound" gorm:"type:bigint(20);comment:篮板"`
Assist
string
`json:"assist" gorm:"type:bigint(20);comment:助攻"`
Steal
string
`json:"steal" gorm:"type:bigint(20);comment:抢断"`
FreeThrow
string
`json:"freeThrow" gorm:"type:bigint(20);comment:罚球"`
BlockShot
string
`json:"blockShot" gorm:"type:bigint(20);comment:盖帽"`
Foul
string
`json:"foul" gorm:"type:bigint(20);comment:犯规"`
TwoPointShot
string
`json:"twoPointShot" gorm:"type:bigint(20);comment:2分进球数量"`
ThreePointShot
string
`json:"threePointShot" gorm:"type:bigint(20);comment:3分进球数量"`
models
.
ModelTime
models
.
ControlBy
}
func
(
OrgMatchTeamPlayer
)
TableName
()
string
{
return
"org_match_team_player"
return
"org_match_team_player"
}
func
(
e
*
OrgMatchTeamPlayer
)
Generate
()
models
.
ActiveRecord
{
...
...
@@ -39,4 +38,4 @@ func (e *OrgMatchTeamPlayer) Generate() models.ActiveRecord {
func
(
e
*
OrgMatchTeamPlayer
)
GetId
()
interface
{}
{
return
e
.
Id
}
\ No newline at end of file
}
app/operate/router/org_match.go
View file @
4877c269
...
...
@@ -22,9 +22,9 @@ func registerOrgMatchRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl
r
.
POST
(
""
,
api
.
Insert
)
r
.
PUT
(
"/:id"
,
api
.
Update
)
r
.
DELETE
(
""
,
api
.
Delete
)
r
.
GET
(
"/get-player
s/:id"
,
api
.
GetPlayers
)
r
.
GET
(
"/get-player
s-is-set/:id"
,
api
.
GetPlayers
IsSet
)
r
.
PUT
(
"/update-player
s/:id"
,
api
.
UpdatePlayers
)
r
.
PUT
(
"/update-player
s-date/:id"
,
api
.
UpdatePlayers
Data
)
r
.
GET
(
"/get-player
/:id"
,
api
.
GetPlayer
)
r
.
GET
(
"/get-player
-is-set/:id"
,
api
.
GetPlayer
IsSet
)
r
.
PUT
(
"/update-player
/:id"
,
api
.
UpdatePlayer
)
r
.
PUT
(
"/update-player
-data/:id"
,
api
.
UpdatePlayer
Data
)
}
}
\ No newline at end of file
}
app/operate/service/dto/org_match.go
View file @
4877c269
...
...
@@ -8,33 +8,41 @@ import (
)
type
OrgMatchGetPageReq
struct
{
dto
.
Pagination
`search:"-"`
OrgMatchOrder
dto
.
Pagination
`search:"-"`
OrgMatchOrder
}
type
OrgMatchOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_match"`
LeagueId
string
`form:"leagueIdOrder" search:"type:order;column:league_id;table:org_match"`
DivisionId
string
`form:"divisionIdOrder" search:"type:order;column:division_id;table:org_match"`
SeasonId
string
`form:"seasonIdOrder" search:"type:order;column:season_id;table:org_match"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club_id;table:org_match"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team_id;table:org_match"`
Status
string
`form:"statusOrder" search:"type:order;column:status;table:org_match"`
Rounds
string
`form:"roundsOrder" search:"type:order;column:rounds;table:org_match"`
Grouping
string
`form:"groupingOrder" search:"type:order;column:grouping;table:org_match"`
MatchStartTime
time
.
Time
`form:"matchStartTimeOrder" search:"type:order;column:match_start_time;table:org_match"`
MatchEndTime
time
.
Time
`form:"matchEndTimeOrder" search:"type:order;column:match_end_time;table:org_match"`
TeamAId
string
`form:"teamAIdOrder" search:"type:order;column:team_a_id;table:org_match"`
TeamBId
string
`form:"teamBIdOrder" search:"type:order;column:team_b_id;table:org_match"`
TeamAScore
string
`form:"teamAScoreOrder" search:"type:order;column:team_a_score;table:org_match"`
TeamBScore
string
`form:"teamBScoreOrder" search:"type:order;column:team_b_score;table:org_match"`
TeamAIntegral
string
`form:"teamAIntegralOrder" search:"type:order;column:team_a_integral;table:org_match"`
TeamBIntegral
string
`form:"teamBIntegralOrder" search:"type:order;column:team_b_integral;table:org_match"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:create_by;table:org_match"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:update_by;table:org_match"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:created_at;table:org_match"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:updated_at;table:org_match"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_match"`
type
OrgMatchGetReply
struct
{
OrgMatch
models
.
OrgMatch
`form:"orgMatch"`
OrgLeagueList
[]
models
.
OrgLeague
`form:"orgLeagueList"`
OrgSeasonList
[]
models
.
OrgSeason
`form:"orgSeasonList"`
OrgDivisionList
[]
models
.
OrgDivision
`form:"orgDivisionList"`
OrgTeamList
[]
models
.
OrgTeam
`form:"orgTeamList"`
}
type
OrgMatchOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_match"`
LeagueId
string
`form:"leagueIdOrder" search:"type:order;column:league_id;table:org_match"`
DivisionId
string
`form:"divisionIdOrder" search:"type:order;column:division_id;table:org_match"`
SeasonId
string
`form:"seasonIdOrder" search:"type:order;column:season_id;table:org_match"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club_id;table:org_match"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team_id;table:org_match"`
Status
string
`form:"statusOrder" search:"type:order;column:status;table:org_match"`
Rounds
string
`form:"roundsOrder" search:"type:order;column:rounds;table:org_match"`
Grouping
string
`form:"groupingOrder" search:"type:order;column:grouping;table:org_match"`
MatchStartTime
time
.
Time
`form:"matchStartTimeOrder" search:"type:order;column:match_start_time;table:org_match"`
MatchEndTime
time
.
Time
`form:"matchEndTimeOrder" search:"type:order;column:match_end_time;table:org_match"`
TeamAId
string
`form:"teamAIdOrder" search:"type:order;column:team_a_id;table:org_match"`
TeamBId
string
`form:"teamBIdOrder" search:"type:order;column:team_b_id;table:org_match"`
TeamAScore
string
`form:"teamAScoreOrder" search:"type:order;column:team_a_score;table:org_match"`
TeamBScore
string
`form:"teamBScoreOrder" search:"type:order;column:team_b_score;table:org_match"`
TeamAIntegral
string
`form:"teamAIntegralOrder" search:"type:order;column:team_a_integral;table:org_match"`
TeamBIntegral
string
`form:"teamBIntegralOrder" search:"type:order;column:team_b_integral;table:org_match"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:create_by;table:org_match"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:update_by;table:org_match"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:created_at;table:org_match"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:updated_at;table:org_match"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_match"`
}
func
(
m
*
OrgMatchGetPageReq
)
GetNeedSearch
()
interface
{}
{
...
...
@@ -42,46 +50,46 @@ func (m *OrgMatchGetPageReq) GetNeedSearch() interface{} {
}
type
OrgMatchInsertReq
struct
{
Id
int
`json:"-" comment:""`
//
LeagueId
string
`json:"leagueId" comment:""`
DivisionId
string
`json:"divisionId" comment:""`
SeasonId
string
`json:"seasonId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
Status
string
`json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
Rounds
string
`json:"rounds" comment:"轮次"`
Grouping
string
`json:"grouping" comment:"分组"`
MatchStartTime
time
.
Time
`json:"matchStartTime" comment:"比赛开始时间"`
MatchEndTime
time
.
Time
`json:"matchEndTime" comment:"比赛结束时间"`
TeamAId
string
`json:"teamAId" comment:"a队id"`
TeamBId
string
`json:"teamBId" comment:"b队id"`
TeamAScore
string
`json:"teamAScore" comment:"a队比分"`
TeamBScore
string
`json:"teamBScore" comment:"b队比分"`
TeamAIntegral
string
`json:"teamAIntegral" comment:"a队积分"`
TeamBIntegral
string
`json:"teamBIntegral" comment:"a队积分"`
common
.
ControlBy
Id
int
`json:"-" comment:""`
//
LeagueId
string
`json:"leagueId" comment:""`
DivisionId
string
`json:"divisionId" comment:""`
SeasonId
string
`json:"seasonId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
Status
string
`json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
Rounds
string
`json:"rounds" comment:"轮次"`
Grouping
string
`json:"grouping" comment:"分组"`
MatchStartTime
time
.
Time
`json:"matchStartTime" comment:"比赛开始时间"`
MatchEndTime
time
.
Time
`json:"matchEndTime" comment:"比赛结束时间"`
TeamAId
string
`json:"teamAId" comment:"a队id"`
TeamBId
string
`json:"teamBId" comment:"b队id"`
TeamAScore
string
`json:"teamAScore" comment:"a队比分"`
TeamBScore
string
`json:"teamBScore" comment:"b队比分"`
TeamAIntegral
string
`json:"teamAIntegral" comment:"a队积分"`
TeamBIntegral
string
`json:"teamBIntegral" comment:"a队积分"`
common
.
ControlBy
}
func
(
s
*
OrgMatchInsertReq
)
Generate
(
model
*
models
.
OrgMatch
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueId
=
s
.
LeagueId
model
.
DivisionId
=
s
.
DivisionId
model
.
SeasonId
=
s
.
SeasonId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
Status
=
s
.
Status
model
.
Rounds
=
s
.
Rounds
model
.
Grouping
=
s
.
Grouping
model
.
MatchStartTime
=
s
.
MatchStartTime
model
.
MatchEndTime
=
s
.
MatchEndTime
model
.
TeamAId
=
s
.
TeamAId
model
.
TeamBId
=
s
.
TeamBId
model
.
TeamAScore
=
s
.
TeamAScore
model
.
TeamBScore
=
s
.
TeamBScore
model
.
TeamAIntegral
=
s
.
TeamAIntegral
model
.
TeamBIntegral
=
s
.
TeamBIntegral
func
(
s
*
OrgMatchInsertReq
)
Generate
(
model
*
models
.
OrgMatch
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueId
=
s
.
LeagueId
model
.
DivisionId
=
s
.
DivisionId
model
.
SeasonId
=
s
.
SeasonId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
Status
=
s
.
Status
model
.
Rounds
=
s
.
Rounds
model
.
Grouping
=
s
.
Grouping
model
.
MatchStartTime
=
s
.
MatchStartTime
model
.
MatchEndTime
=
s
.
MatchEndTime
model
.
TeamAId
=
s
.
TeamAId
model
.
TeamBId
=
s
.
TeamBId
model
.
TeamAScore
=
s
.
TeamAScore
model
.
TeamBScore
=
s
.
TeamBScore
model
.
TeamAIntegral
=
s
.
TeamAIntegral
model
.
TeamBIntegral
=
s
.
TeamBIntegral
}
func
(
s
*
OrgMatchInsertReq
)
GetId
()
interface
{}
{
...
...
@@ -89,46 +97,46 @@ func (s *OrgMatchInsertReq) GetId() interface{} {
}
type
OrgMatchUpdateReq
struct
{
Id
int
`uri:"id" comment:""`
//
LeagueId
string
`json:"leagueId" comment:""`
DivisionId
string
`json:"divisionId" comment:""`
SeasonId
string
`json:"seasonId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
Status
string
`json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
Rounds
string
`json:"rounds" comment:"轮次"`
Grouping
string
`json:"grouping" comment:"分组"`
MatchStartTime
time
.
Time
`json:"matchStartTime" comment:"比赛开始时间"`
MatchEndTime
time
.
Time
`json:"matchEndTime" comment:"比赛结束时间"`
TeamAId
string
`json:"teamAId" comment:"a队id"`
TeamBId
string
`json:"teamBId" comment:"b队id"`
TeamAScore
string
`json:"teamAScore" comment:"a队比分"`
TeamBScore
string
`json:"teamBScore" comment:"b队比分"`
TeamAIntegral
string
`json:"teamAIntegral" comment:"a队积分"`
TeamBIntegral
string
`json:"teamBIntegral" comment:"a队积分"`
common
.
ControlBy
Id
int
`uri:"id" comment:""`
//
LeagueId
string
`json:"leagueId" comment:""`
DivisionId
string
`json:"divisionId" comment:""`
SeasonId
string
`json:"seasonId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
Status
string
`json:"status" comment:"比赛状态 1 未开始 2 比赛中 3 已结束"`
Rounds
string
`json:"rounds" comment:"轮次"`
Grouping
string
`json:"grouping" comment:"分组"`
MatchStartTime
time
.
Time
`json:"matchStartTime" comment:"比赛开始时间"`
MatchEndTime
time
.
Time
`json:"matchEndTime" comment:"比赛结束时间"`
TeamAId
string
`json:"teamAId" comment:"a队id"`
TeamBId
string
`json:"teamBId" comment:"b队id"`
TeamAScore
string
`json:"teamAScore" comment:"a队比分"`
TeamBScore
string
`json:"teamBScore" comment:"b队比分"`
TeamAIntegral
string
`json:"teamAIntegral" comment:"a队积分"`
TeamBIntegral
string
`json:"teamBIntegral" comment:"a队积分"`
common
.
ControlBy
}
func
(
s
*
OrgMatchUpdateReq
)
Generate
(
model
*
models
.
OrgMatch
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueId
=
s
.
LeagueId
model
.
DivisionId
=
s
.
DivisionId
model
.
SeasonId
=
s
.
SeasonId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
Status
=
s
.
Status
model
.
Rounds
=
s
.
Rounds
model
.
Grouping
=
s
.
Grouping
model
.
MatchStartTime
=
s
.
MatchStartTime
model
.
MatchEndTime
=
s
.
MatchEndTime
model
.
TeamAId
=
s
.
TeamAId
model
.
TeamBId
=
s
.
TeamBId
model
.
TeamAScore
=
s
.
TeamAScore
model
.
TeamBScore
=
s
.
TeamBScore
model
.
TeamAIntegral
=
s
.
TeamAIntegral
model
.
TeamBIntegral
=
s
.
TeamBIntegral
func
(
s
*
OrgMatchUpdateReq
)
Generate
(
model
*
models
.
OrgMatch
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
LeagueId
=
s
.
LeagueId
model
.
DivisionId
=
s
.
DivisionId
model
.
SeasonId
=
s
.
SeasonId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
Status
=
s
.
Status
model
.
Rounds
=
s
.
Rounds
model
.
Grouping
=
s
.
Grouping
model
.
MatchStartTime
=
s
.
MatchStartTime
model
.
MatchEndTime
=
s
.
MatchEndTime
model
.
TeamAId
=
s
.
TeamAId
model
.
TeamBId
=
s
.
TeamBId
model
.
TeamAScore
=
s
.
TeamAScore
model
.
TeamBScore
=
s
.
TeamBScore
model
.
TeamAIntegral
=
s
.
TeamAIntegral
model
.
TeamBIntegral
=
s
.
TeamBIntegral
}
func
(
s
*
OrgMatchUpdateReq
)
GetId
()
interface
{}
{
...
...
@@ -137,8 +145,9 @@ func (s *OrgMatchUpdateReq) GetId() interface{} {
// OrgMatchGetReq 功能获取请求参数
type
OrgMatchGetReq
struct
{
Id
int
`uri:"id"`
Id
int
`uri:"id"`
}
func
(
s
*
OrgMatchGetReq
)
GetId
()
interface
{}
{
return
s
.
Id
}
...
...
@@ -150,4 +159,4 @@ type OrgMatchDeleteReq struct {
func
(
s
*
OrgMatchDeleteReq
)
GetId
()
interface
{}
{
return
s
.
Ids
}
\ No newline at end of file
}
app/operate/service/dto/org_match_team_player.go
View file @
4877c269
...
...
@@ -8,32 +8,36 @@ import (
)
type
OrgMatchTeamPlayerGetPageReq
struct
{
dto
.
Pagination
`search:"-"`
OrgMatchTeamPlayerOrder
dto
.
Pagination
`search:"-"`
OrgMatchTeamPlayerOrder
}
type
UpdateOrgMatchTeamPlayerReq
struct
{
MatchId
string
`json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
PlayersIds
string
`form:"playersIds"`
}
type
OrgMatchTeamPlayerOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_match_team_player"`
MatchId
string
`form:"matchIdOrder" search:"type:order;column:match_
id;table:org_match_team_player"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club
_id;table:org_match_team_player"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team
_id;table:org_match_team_player"`
PlayerName
string
`form:"playerNameOrder" search:"type:order;column:player_name
;table:org_match_team_player"`
PlayerNumber
string
`form:"playerNumberOrder" search:"type:order;column:player_number
;table:org_match_team_player"`
Position
string
`form:"positionOrder" search:"type:order;column:position
;table:org_match_team_player"`
Scoring
string
`form:"scoringOrder" search:"type:order;column:scoring
;table:org_match_team_player"`
Rebound
string
`form:"reboundOrder" search:"type:order;column:rebound
;table:org_match_team_player"`
Assist
string
`form:"assistOrder" search:"type:order;column:assist
;table:org_match_team_player"`
Steal
string
`form:"stealOrder" search:"type:order;column:steal
;table:org_match_team_player"`
FreeThrow
string
`form:"freeThrowOrder" search:"type:order;column:free_throw
;table:org_match_team_player"`
BlockShot
string
`form:"blockShotOrder" search:"type:order;column:block_shot
;table:org_match_team_player"`
Foul
string
`form:"foulOrder" search:"type:order;column:foul
;table:org_match_team_player"`
TwoPointShot
string
`form:"twoPointShotOrder" search:"type:order;column:two_point_shot
;table:org_match_team_player"`
ThreePointShot
string
`form:"threePointShotOrder" search:"type:order;column:three
_point_shot;table:org_match_team_player"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:create_by
;table:org_match_team_player"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:upd
ate_by;table:org_match_team_player"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:created_at
;table:org_match_team_player"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:upd
ated_at;table:org_match_team_player"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:dele
ted_at;table:org_match_team_player"`
type
OrgMatchTeamPlayerOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:
id;table:org_match_team_player"`
MatchId
string
`form:"matchIdOrder" search:"type:order;column:match
_id;table:org_match_team_player"`
ClubId
string
`form:"clubIdOrder" search:"type:order;column:club
_id;table:org_match_team_player"`
TeamId
string
`form:"teamIdOrder" search:"type:order;column:team_id
;table:org_match_team_player"`
PlayerName
string
`form:"playerNameOrder" search:"type:order;column:player_name
;table:org_match_team_player"`
PlayerNumber
string
`form:"playerNumberOrder" search:"type:order;column:player_number
;table:org_match_team_player"`
Position
string
`form:"positionOrder" search:"type:order;column:position
;table:org_match_team_player"`
Scoring
string
`form:"scoringOrder" search:"type:order;column:scoring
;table:org_match_team_player"`
Rebound
string
`form:"reboundOrder" search:"type:order;column:rebound
;table:org_match_team_player"`
Assist
string
`form:"assistOrder" search:"type:order;column:assist
;table:org_match_team_player"`
Steal
string
`form:"stealOrder" search:"type:order;column:steal
;table:org_match_team_player"`
FreeThrow
string
`form:"freeThrowOrder" search:"type:order;column:free_throw
;table:org_match_team_player"`
BlockShot
string
`form:"blockShotOrder" search:"type:order;column:block_shot
;table:org_match_team_player"`
Foul
string
`form:"foulOrder" search:"type:order;column:foul
;table:org_match_team_player"`
TwoPointShot
string
`form:"twoPointShotOrder" search:"type:order;column:two
_point_shot;table:org_match_team_player"`
ThreePointShot
string
`form:"threePointShotOrder" search:"type:order;column:three_point_shot
;table:org_match_team_player"`
CreateBy
string
`form:"createByOrder" search:"type:order;column:cre
ate_by;table:org_match_team_player"`
UpdateBy
string
`form:"updateByOrder" search:"type:order;column:update_by
;table:org_match_team_player"`
CreatedAt
time
.
Time
`form:"createdAtOrder" search:"type:order;column:cre
ated_at;table:org_match_team_player"`
UpdatedAt
time
.
Time
`form:"updatedAtOrder" search:"type:order;column:upda
ted_at;table:org_match_team_player"`
DeletedAt
time
.
Time
`form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_match_team_player"`
}
func
(
m
*
OrgMatchTeamPlayerGetPageReq
)
GetNeedSearch
()
interface
{}
{
...
...
@@ -41,44 +45,44 @@ func (m *OrgMatchTeamPlayerGetPageReq) GetNeedSearch() interface{} {
}
type
OrgMatchTeamPlayerInsertReq
struct
{
Id
int
`json:"-" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
Position
string
`json:"position" comment:"场上位置"`
Scoring
string
`json:"scoring" comment:"得分"`
Rebound
string
`json:"rebound" comment:"篮板"`
Assist
string
`json:"assist" comment:"助攻"`
Steal
string
`json:"steal" comment:"抢断"`
FreeThrow
string
`json:"freeThrow" comment:"罚球"`
BlockShot
string
`json:"blockShot" comment:"盖帽"`
Foul
string
`json:"foul" comment:"犯规"`
TwoPointShot
string
`json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot
string
`json:"threePointShot" comment:"3分进球数量"`
common
.
ControlBy
Id
int
`json:"-" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
Position
string
`json:"position" comment:"场上位置"`
Scoring
string
`json:"scoring" comment:"得分"`
Rebound
string
`json:"rebound" comment:"篮板"`
Assist
string
`json:"assist" comment:"助攻"`
Steal
string
`json:"steal" comment:"抢断"`
FreeThrow
string
`json:"freeThrow" comment:"罚球"`
BlockShot
string
`json:"blockShot" comment:"盖帽"`
Foul
string
`json:"foul" comment:"犯规"`
TwoPointShot
string
`json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot
string
`json:"threePointShot" comment:"3分进球数量"`
common
.
ControlBy
}
func
(
s
*
OrgMatchTeamPlayerInsertReq
)
Generate
(
model
*
models
.
OrgMatchTeamPlayer
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
MatchId
=
s
.
MatchId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Scoring
=
s
.
Scoring
model
.
Rebound
=
s
.
Rebound
model
.
Assist
=
s
.
Assist
model
.
Steal
=
s
.
Steal
model
.
FreeThrow
=
s
.
FreeThrow
model
.
BlockShot
=
s
.
BlockShot
model
.
Foul
=
s
.
Foul
model
.
TwoPointShot
=
s
.
TwoPointShot
model
.
ThreePointShot
=
s
.
ThreePointShot
func
(
s
*
OrgMatchTeamPlayerInsertReq
)
Generate
(
model
*
models
.
OrgMatchTeamPlayer
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
MatchId
=
s
.
MatchId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Scoring
=
s
.
Scoring
model
.
Rebound
=
s
.
Rebound
model
.
Assist
=
s
.
Assist
model
.
Steal
=
s
.
Steal
model
.
FreeThrow
=
s
.
FreeThrow
model
.
BlockShot
=
s
.
BlockShot
model
.
Foul
=
s
.
Foul
model
.
TwoPointShot
=
s
.
TwoPointShot
model
.
ThreePointShot
=
s
.
ThreePointShot
}
func
(
s
*
OrgMatchTeamPlayerInsertReq
)
GetId
()
interface
{}
{
...
...
@@ -86,44 +90,44 @@ func (s *OrgMatchTeamPlayerInsertReq) GetId() interface{} {
}
type
OrgMatchTeamPlayerUpdateReq
struct
{
Id
int
`uri:"id" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
Position
string
`json:"position" comment:"场上位置"`
Scoring
string
`json:"scoring" comment:"得分"`
Rebound
string
`json:"rebound" comment:"篮板"`
Assist
string
`json:"assist" comment:"助攻"`
Steal
string
`json:"steal" comment:"抢断"`
FreeThrow
string
`json:"freeThrow" comment:"罚球"`
BlockShot
string
`json:"blockShot" comment:"盖帽"`
Foul
string
`json:"foul" comment:"犯规"`
TwoPointShot
string
`json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot
string
`json:"threePointShot" comment:"3分进球数量"`
common
.
ControlBy
Id
int
`uri:"id" comment:""`
//
MatchId
string
`json:"matchId" comment:""`
ClubId
string
`json:"clubId" comment:""`
TeamId
string
`json:"teamId" comment:""`
PlayerName
string
`json:"playerName" comment:"球员名称"`
PlayerNumber
string
`json:"playerNumber" comment:"球员号码"`
Position
string
`json:"position" comment:"场上位置"`
Scoring
string
`json:"scoring" comment:"得分"`
Rebound
string
`json:"rebound" comment:"篮板"`
Assist
string
`json:"assist" comment:"助攻"`
Steal
string
`json:"steal" comment:"抢断"`
FreeThrow
string
`json:"freeThrow" comment:"罚球"`
BlockShot
string
`json:"blockShot" comment:"盖帽"`
Foul
string
`json:"foul" comment:"犯规"`
TwoPointShot
string
`json:"twoPointShot" comment:"2分进球数量"`
ThreePointShot
string
`json:"threePointShot" comment:"3分进球数量"`
common
.
ControlBy
}
func
(
s
*
OrgMatchTeamPlayerUpdateReq
)
Generate
(
model
*
models
.
OrgMatchTeamPlayer
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
MatchId
=
s
.
MatchId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Scoring
=
s
.
Scoring
model
.
Rebound
=
s
.
Rebound
model
.
Assist
=
s
.
Assist
model
.
Steal
=
s
.
Steal
model
.
FreeThrow
=
s
.
FreeThrow
model
.
BlockShot
=
s
.
BlockShot
model
.
Foul
=
s
.
Foul
model
.
TwoPointShot
=
s
.
TwoPointShot
model
.
ThreePointShot
=
s
.
ThreePointShot
func
(
s
*
OrgMatchTeamPlayerUpdateReq
)
Generate
(
model
*
models
.
OrgMatchTeamPlayer
)
{
if
s
.
Id
==
0
{
model
.
Model
=
common
.
Model
{
Id
:
s
.
Id
}
}
model
.
MatchId
=
s
.
MatchId
model
.
ClubId
=
s
.
ClubId
model
.
TeamId
=
s
.
TeamId
model
.
PlayerName
=
s
.
PlayerName
model
.
PlayerNumber
=
s
.
PlayerNumber
model
.
Position
=
s
.
Position
model
.
Scoring
=
s
.
Scoring
model
.
Rebound
=
s
.
Rebound
model
.
Assist
=
s
.
Assist
model
.
Steal
=
s
.
Steal
model
.
FreeThrow
=
s
.
FreeThrow
model
.
BlockShot
=
s
.
BlockShot
model
.
Foul
=
s
.
Foul
model
.
TwoPointShot
=
s
.
TwoPointShot
model
.
ThreePointShot
=
s
.
ThreePointShot
}
func
(
s
*
OrgMatchTeamPlayerUpdateReq
)
GetId
()
interface
{}
{
...
...
@@ -132,8 +136,9 @@ func (s *OrgMatchTeamPlayerUpdateReq) GetId() interface{} {
// OrgMatchTeamPlayerGetReq 功能获取请求参数
type
OrgMatchTeamPlayerGetReq
struct
{
Id
int
`uri:"id"`
Id
int
`uri:"id"`
}
func
(
s
*
OrgMatchTeamPlayerGetReq
)
GetId
()
interface
{}
{
return
s
.
Id
}
...
...
@@ -145,4 +150,4 @@ type OrgMatchTeamPlayerDeleteReq struct {
func
(
s
*
OrgMatchTeamPlayerDeleteReq
)
GetId
()
interface
{}
{
return
s
.
Ids
}
\ No newline at end of file
}
app/operate/service/dto/org_season.go
View file @
4877c269
...
...
@@ -12,6 +12,11 @@ type OrgSeasonGetPageReq struct {
OrgSeasonOrder
}
type
OrgSeasonGetReply
struct
{
OrgSeason
models
.
OrgSeason
`form:"orgSeason"`
OrgLeagueList
[]
models
.
OrgLeague
`form:"orgLeagueList"`
}
type
OrgSeasonOrder
struct
{
Id
int
`form:"idOrder" search:"type:order;column:id;table:org_season"`
LeagueId
string
`form:"leagueIdOrder" search:"type:order;column:league_id;table:org_season"`
DivisionId
string
`form:"divisionIdOrder" search:"type:order;column:division_id;table:org_season"`
...
...
app/operate/service/org_match_team_player.go
View file @
4877c269
...
...
@@ -3,7 +3,7 @@ package service
import
(
"errors"
"github.com/go-admin-team/go-admin-core/sdk/service"
"github.com/go-admin-team/go-admin-core/sdk/service"
"gorm.io/gorm"
"go-admin/app/operate/models"
...
...
@@ -59,9 +59,9 @@ func (e *OrgMatchTeamPlayer) Get(d *dto.OrgMatchTeamPlayerGetReq, p *actions.Dat
// Insert 创建OrgMatchTeamPlayer对象
func
(
e
*
OrgMatchTeamPlayer
)
Insert
(
c
*
dto
.
OrgMatchTeamPlayerInsertReq
)
error
{
var
err
error
var
data
models
.
OrgMatchTeamPlayer
c
.
Generate
(
&
data
)
var
err
error
var
data
models
.
OrgMatchTeamPlayer
c
.
Generate
(
&
data
)
err
=
e
.
Orm
.
Create
(
&
data
)
.
Error
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchTeamPlayerService Insert error:%s
\r\n
"
,
err
)
...
...
@@ -72,22 +72,22 @@ func (e *OrgMatchTeamPlayer) Insert(c *dto.OrgMatchTeamPlayerInsertReq) error {
// Update 修改OrgMatchTeamPlayer对象
func
(
e
*
OrgMatchTeamPlayer
)
Update
(
c
*
dto
.
OrgMatchTeamPlayerUpdateReq
,
p
*
actions
.
DataPermission
)
error
{
var
err
error
var
data
=
models
.
OrgMatchTeamPlayer
{}
e
.
Orm
.
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
First
(
&
data
,
c
.
GetId
())
c
.
Generate
(
&
data
)
var
err
error
var
data
=
models
.
OrgMatchTeamPlayer
{}
e
.
Orm
.
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
First
(
&
data
,
c
.
GetId
())
c
.
Generate
(
&
data
)
db
:=
e
.
Orm
.
Save
(
&
data
)
if
db
.
Error
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchTeamPlayerService Save error:%s
\r\n
"
,
err
)
return
err
}
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权更新该数据"
)
}
return
nil
db
:=
e
.
Orm
.
Save
(
&
data
)
if
db
.
Error
!=
nil
{
e
.
Log
.
Errorf
(
"OrgMatchTeamPlayerService Save error:%s
\r\n
"
,
err
)
return
err
}
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权更新该数据"
)
}
return
nil
}
// Remove 删除OrgMatchTeamPlayer
...
...
@@ -99,11 +99,32 @@ func (e *OrgMatchTeamPlayer) Remove(d *dto.OrgMatchTeamPlayerDeleteReq, p *actio
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
Delete
(
&
data
,
d
.
GetId
())
if
err
:=
db
.
Error
;
err
!=
nil
{
e
.
Log
.
Errorf
(
"Service RemoveOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
return
err
}
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权删除该数据"
)
}
e
.
Log
.
Errorf
(
"Service RemoveOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
return
err
}
if
db
.
RowsAffected
==
0
{
return
errors
.
New
(
"无权删除该数据"
)
}
return
nil
}
\ No newline at end of file
}
// Insert 创建OrgMatchTeamPlayer对象
func
(
e
*
OrgMatchTeamPlayer
)
IsBeing
(
d
*
dto
.
OrgMatchTeamPlayerGetReq
,
p
*
actions
.
DataPermission
,
model
*
models
.
OrgMatchTeamPlayer
)
error
{
var
data
models
.
OrgMatchTeamPlayer
err
:=
e
.
Orm
.
Model
(
&
data
)
.
Scopes
(
actions
.
Permission
(
data
.
TableName
(),
p
),
)
.
First
(
model
,
d
.
GetId
())
.
Error
if
err
!=
nil
&&
errors
.
Is
(
err
,
gorm
.
ErrRecordNotFound
)
{
err
=
errors
.
New
(
"查看对象不存在或无权查看"
)
e
.
Log
.
Errorf
(
"Service GetOrgMatchTeamPlayer error:%s
\r\n
"
,
err
)
return
err
}
if
err
!=
nil
{
e
.
Log
.
Errorf
(
"db error:%s"
,
err
)
return
err
}
return
nil
}
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