Commit 4691a15e authored by haoyanbin's avatar haoyanbin

影像维护

parent 4877c269
......@@ -355,7 +355,7 @@ func (e OrgMatch) GetPlayerIsSet(c *gin.Context) {
// @Product application/json
// @Param data body dto.UpdateOrgMatchTeamPlayerReq true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/org-match/update-player/{id} [put]
// @Router /api/v1/org-match/update-player [put]
// @Security Bearer
func (e OrgMatch) UpdatePlayer(c *gin.Context) {
req := dto.UpdateOrgMatchTeamPlayerReq{}
......@@ -373,7 +373,7 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
playersIds := strings.Split(req.PlayersIds, ",")
sOrgPlayer := service.OrgPlayer{}
err = e.MakeContext(c).MakeOrm().MakeService(&s.Service).Errors
err = e.MakeContext(c).MakeOrm().MakeService(&sOrgPlayer.Service).Errors
if err != nil {
e.Logger.Error(err)
e.Error(500, err, err.Error())
......@@ -382,15 +382,23 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
p := actions.GetPermissionFromContext(c)
for _, v := range playersIds {
var orgPlayer models.OrgPlayer
orgPlayer := new(models.OrgPlayer)
id, _ := strconv.Atoi(v)
err = sOrgPlayer.Get(&dto.OrgPlayerGetReq{Id: id}, p, &orgPlayer)
reqOrgPlayer := new(dto.OrgPlayerGetReq)
reqOrgPlayer.Id = id
err = sOrgPlayer.Get(reqOrgPlayer, p, orgPlayer)
//if orgPlayer.Id == 0 {
// e.Error(500, err, "球员不存在")
// return
//}
if err != nil {
orgMatchPlayer := dto.OrgMatchTeamPlayerInsertReq{
MatchId: req.MatchId,
ClubId: orgPlayer.ClubId,
TeamId: orgPlayer.TeamId,
PlayerId: v,
PlayerName: orgPlayer.PlayerName,
PlayerNumber: orgPlayer.PlayerNumber,
Position: orgPlayer.Position,
......@@ -405,6 +413,7 @@ func (e OrgMatch) UpdatePlayer(c *gin.Context) {
MatchId: req.MatchId,
ClubId: orgPlayer.ClubId,
TeamId: orgPlayer.TeamId,
PlayerId: v,
PlayerName: orgPlayer.PlayerName,
PlayerNumber: orgPlayer.PlayerNumber,
Position: orgPlayer.Position,
......
package apis
import (
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
......@@ -28,27 +28,27 @@ type OrgMatchEvaluate struct {
// @Router /api/v1/org-match-evaluate [get]
// @Security Bearer
func (e OrgMatchEvaluate) GetPage(c *gin.Context) {
req := dto.OrgMatchEvaluateGetPageReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluateGetPageReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluate, 0)
list := make([]dto.OrgMatchEvaluateGetPageReply, 0)
var count int64
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(), "查询成功")
......@@ -78,7 +78,7 @@ func (e OrgMatchEvaluate) GetPageMatch(c *gin.Context) {
}
p := actions.GetPermissionFromContext(c)
list := make([]models.OrgMatchEvaluate, 0)
list := make([]dto.OrgMatchEvaluateGetPageReply, 0)
var count int64
err = s.GetPage(&req, p, &list, &count)
......@@ -101,7 +101,7 @@ func (e OrgMatchEvaluate) GetPageMatch(c *gin.Context) {
func (e OrgMatchEvaluate) Get(c *gin.Context) {
req := dto.OrgMatchEvaluateGetReq{}
s := service.OrgMatchEvaluate{}
err := e.MakeContext(c).
err := e.MakeContext(c).
MakeOrm().
Bind(&req).
MakeService(&s.Service).
......@@ -117,10 +117,10 @@ func (e OrgMatchEvaluate) Get(c *gin.Context) {
err = s.Get(&req, p, &object)
if err != nil {
e.Error(500, err, fmt.Sprintf("获取比赛球员信息失败,\r\n失败信息 %s", err.Error()))
return
return
}
e.OK( object, "查询成功")
e.OK(object, "查询成功")
}
// Update <赛事>赛后评价影像维护
......@@ -134,28 +134,29 @@ func (e OrgMatchEvaluate) Get(c *gin.Context) {
// @Router /api/v1/org-match-evaluate/{id} [put]
// @Security Bearer
func (e OrgMatchEvaluate) Update(c *gin.Context) {
req := dto.OrgMatchEvaluateUpdateReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluateUpdateReq{}
s := service.OrgMatchEvaluate{}
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(), "修改成功")
}
// Update <赛事>赛后评价影像维护
// @Summary <赛事>赛后评价影像维护
// @Description <赛事>赛后评价影像维护
......@@ -187,5 +188,5 @@ func (e OrgMatchEvaluate) Status(c *gin.Context) {
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(), "修改成功")
}
package apis
import (
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
......@@ -28,27 +28,27 @@ type OrgTeamMatchEvaluate struct {
// @Router /api/v1/org-team-match-evaluate [get]
// @Security Bearer
func (e OrgTeamMatchEvaluate) GetPage(c *gin.Context) {
req := dto.OrgMatchEvaluateGetPageReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluateGetPageReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluate, 0)
list := make([]dto.OrgMatchEvaluateGetPageReply, 0)
var count int64
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(), "查询成功")
......@@ -78,7 +78,7 @@ func (e OrgTeamMatchEvaluate) GetPageMatch(c *gin.Context) {
}
p := actions.GetPermissionFromContext(c)
list := make([]models.OrgMatchEvaluate, 0)
list := make([]dto.OrgMatchEvaluateGetPageReply, 0)
var count int64
err = s.GetPage(&req, p, &list, &count)
......@@ -101,7 +101,7 @@ func (e OrgTeamMatchEvaluate) GetPageMatch(c *gin.Context) {
func (e OrgTeamMatchEvaluate) Get(c *gin.Context) {
req := dto.OrgMatchEvaluateGetReq{}
s := service.OrgMatchEvaluate{}
err := e.MakeContext(c).
err := e.MakeContext(c).
MakeOrm().
Bind(&req).
MakeService(&s.Service).
......@@ -117,10 +117,10 @@ func (e OrgTeamMatchEvaluate) Get(c *gin.Context) {
err = s.Get(&req, p, &object)
if err != nil {
e.Error(500, err, fmt.Sprintf("获取比赛球员信息失败,\r\n失败信息 %s", err.Error()))
return
return
}
e.OK( object, "查询成功")
e.OK(object, "查询成功")
}
// Update <球队>修改评价
......@@ -134,25 +134,25 @@ func (e OrgTeamMatchEvaluate) Get(c *gin.Context) {
// @Router /api/v1/org-match-evaluate/{id} [put]
// @Security Bearer
func (e OrgTeamMatchEvaluate) Update(c *gin.Context) {
req := dto.OrgMatchEvaluateUpdateReq{}
s := service.OrgMatchEvaluate{}
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.OrgMatchEvaluateUpdateReq{}
s := service.OrgMatchEvaluate{}
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(), "修改成功")
}
package models
import (
// "gorm.io/gorm"
// "gorm.io/gorm"
"go-admin/common/models"
)
type OrgMatchEvaluate struct {
models.Model
TeamUserId string `json:"teamUserId" gorm:"type:bigint(20);comment:org_team_user表id(教练id)"`
PlayerId string `json:"playerId" gorm:"type:bigint(20);comment:org_player表id(球员id)"`
Content string `json:"content" gorm:"type:text;comment:教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" gorm:"type:varchar(255);comment:精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" gorm:"type:varchar(255);comment:精彩时刻图标题"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" gorm:"type:varchar(255);comment:精彩时刻视频"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" gorm:"type:varchar(255);comment:精彩时刻视频标题"`
models.ModelTime
models.ControlBy
models.Model
Rounds string `json:"rounds" gorm:"type:bigint(20);comment:Rounds"`
TeamUserId string `json:"teamUserId" gorm:"type:bigint(20);comment:org_team_user表id(教练id)"`
PlayerId string `json:"playerId" gorm:"type:bigint(20);comment:org_player表id(球员id)"`
Content string `json:"content" gorm:"type:text;comment:教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" gorm:"type:varchar(255);comment:精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" gorm:"type:varchar(255);comment:精彩时刻视频"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" gorm:"type:varchar(255);comment:精彩时刻图标题"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" gorm:"type:varchar(255);comment:精彩时刻视频标题"`
MvStatus string `json:"mvStatus" gorm:"type:bigint(20);comment:视频维护状态 1 待维护 2 维护完成 3 驳回 4 维护完成"`
Status string `json:"status" gorm:"type:bigint(20);comment:发布状态 1 待审核 3 驳回 4 发布完成"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:驳回原因"`
models.ModelTime
models.ControlBy
}
func (OrgMatchEvaluate) TableName() string {
return "org_match_evaluate"
return "org_match_evaluate"
}
func (e *OrgMatchEvaluate) Generate() models.ActiveRecord {
......@@ -31,4 +35,4 @@ func (e *OrgMatchEvaluate) Generate() models.ActiveRecord {
func (e *OrgMatchEvaluate) GetId() interface{} {
return e.Id
}
\ No newline at end of file
}
......@@ -11,6 +11,7 @@ type OrgMatchTeamPlayer struct {
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"`
PlayerId string `json:"playerId" gorm:"type:bigint(20);comment:PlayerId"`
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:场上位置"`
......
package models
import (
// "gorm.io/gorm"
// "gorm.io/gorm"
"go-admin/common/models"
)
type OrgPlayer struct {
models.Model
ClubId string `json:"clubId" gorm:"type:bigint(20);comment:org_club表id"`
TeamId string `json:"teamId" gorm:"type:bigint(20);comment:org_team表id"`
PlayerName string `json:"playerName" gorm:"type:varchar(60);comment:球员姓名"`
IdCard string `json:"idCard" gorm:"type:varchar(60);comment:身份证号"`
Sex string `json:"sex" gorm:"type:varchar(20);comment:性别"`
PlayerNumber string `json:"playerNumber" gorm:"type:varchar(20);comment:球衣号码"`
Position string `json:"position" gorm:"type:varchar(60);comment:场上位置"`
PlayerImg string `json:"playerImg" gorm:"type:varchar(255);comment:球员照片"`
PlayerUserId string `json:"playerUserId" gorm:"type:bigint(20);comment:org_player_user表id"`
ShareConf string `json:"shareConf" gorm:"type:tinyint(1);comment:分享功能 1 开启 2 关闭"`
models.ModelTime
models.ControlBy
models.Model
ClubId string `json:"clubId" gorm:"type:bigint(20);comment:org_club表id"`
TeamId string `json:"teamId" gorm:"type:bigint(20);comment:org_team表id"`
PlayerName string `json:"playerName" gorm:"type:varchar(60);comment:球员姓名"`
IdCard string `json:"idCard" gorm:"type:varchar(60);comment:身份证号"`
Sex string `json:"sex" gorm:"type:varchar(20);comment:性别"`
PlayerNumber string `json:"playerNumber" gorm:"type:varchar(20);comment:球衣号码"`
Position string `json:"position" gorm:"type:varchar(60);comment:场上位置"`
PlayerImg string `json:"playerImg" gorm:"type:varchar(255);comment:球员照片"`
PlayerUserId string `json:"playerUserId" gorm:"type:bigint(20);comment:org_player_user表id"`
ShareConf string `json:"shareConf" gorm:"type:tinyint(1);comment:分享功能 1 开启 2 关闭"`
models.ModelTime
models.ControlBy
}
func (OrgPlayer) TableName() string {
return "org_player"
return "org_player"
}
func (e *OrgPlayer) Generate() models.ActiveRecord {
......@@ -34,4 +34,4 @@ func (e *OrgPlayer) Generate() models.ActiveRecord {
func (e *OrgPlayer) GetId() interface{} {
return e.Id
}
\ No newline at end of file
}
......@@ -8,24 +8,49 @@ import (
)
type OrgMatchEvaluateGetPageReq struct {
dto.Pagination `search:"-"`
OrgMatchEvaluateOrder
dto.Pagination `search:"-"`
LeagueId string `form:"leagueId" search:"type:exact;column:league_id;table:om" comment:""`
DivisionId string `form:"divisionId" search:"type:exact;column:division_id;table:om" comment:""`
SeasonId string `form:"seasonId" search:"type:exact;column:season_id;table:om" comment:""`
Rounds string `form:"rounds" search:"type:exact;column:rounds;table:omtp" comment:""`
PlayerName string `form:"playerName" search:"type:exact;column:player_name;table:omtp" comment:""`
MvStatus string `form:"mvStatus" search:"type:exact;column:mv_status;table:ome" comment:"视频维护状态 1 待维护 2 维护完成 3 驳回 4 维护完成"`
Status string `form:"status" search:"type:exact;column:status;table:ome" comment:"发布状态 1 待审核 3 驳回 4 发布完成"`
OrgMatchEvaluateOrder
}
type OrgMatchEvaluateOrder struct {Id int `form:"idOrder" search:"type:order;column:id;table:org_match_evaluate"`
TeamUserId string `form:"teamUserIdOrder" search:"type:order;column:team_user_id;table:org_match_evaluate"`
PlayerId string `form:"playerIdOrder" search:"type:order;column:player_id;table:org_match_evaluate"`
Content string `form:"contentOrder" search:"type:order;column:content;table:org_match_evaluate"`
WonderfulMomentImg string `form:"wonderfulMomentImgOrder" search:"type:order;column:wonderful_moment_img;table:org_match_evaluate"`
WonderfulMomentMv string `form:"wonderfulMomentMvOrder" search:"type:order;column:wonderful_moment_mv;table:org_match_evaluate"`
WonderfulMomentImgTitle string `form:"wonderfulMomentImgTitleOrder" search:"type:order;column:wonderful_moment_img_title;table:org_match_evaluate"`
WonderfulMomentMvTitle string `form:"wonderfulMomentMvTitleOrder" search:"type:order;column:wonderful_moment_mv_title;table:org_match_evaluate"`
CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:org_match_evaluate"`
UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:org_match_evaluate"`
CreatedAt time.Time `form:"createdAtOrder" search:"type:order;column:created_at;table:org_match_evaluate"`
UpdatedAt time.Time `form:"updatedAtOrder" search:"type:order;column:updated_at;table:org_match_evaluate"`
DeletedAt time.Time `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_match_evaluate"`
type OrgMatchEvaluateGetPageReply struct {
Id string `json:"id"`
LeagueName string `json:"leagueName"`
DivisionName string `json:"divisionName"`
SeasonName string `json:"seasonName"`
Rounds string `json:"rounds"`
PlayerName string `json:"playerName"`
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"`
MvStatus string `json:"mvStatus" gorm:"type:bigint(20);comment:视频维护状态 1 待维护 2 维护完成 3 驳回 4 维护完成"`
Status string `json:"status" gorm:"type:bigint(20);comment:发布状态 1 待审核 3 驳回 4 发布完成"`
}
//ol.league_name, od.division_name, os.season_name, om.rounds, omtp.player_name, om.match_start_time, om.match_end_time, ome.mv_status, ome.status, ome.remark
type OrgMatchEvaluateOrder struct {
Id int `form:"idOrder" search:"type:order;column:id;table:org_match_evaluate"`
Rounds string `form:"roundsOrder" search:"type:order;column:rounds;table:org_match_evaluate"`
TeamUserId string `form:"teamUserIdOrder" search:"type:order;column:team_user_id;table:org_match_evaluate"`
PlayerId string `form:"playerIdOrder" search:"type:order;column:player_id;table:org_match_evaluate"`
Content string `form:"contentOrder" search:"type:order;column:content;table:org_match_evaluate"`
WonderfulMomentImg string `form:"wonderfulMomentImgOrder" search:"type:order;column:wonderful_moment_img;table:org_match_evaluate"`
WonderfulMomentMv string `form:"wonderfulMomentMvOrder" search:"type:order;column:wonderful_moment_mv;table:org_match_evaluate"`
WonderfulMomentImgTitle string `form:"wonderfulMomentImgTitleOrder" search:"type:order;column:wonderful_moment_img_title;table:org_match_evaluate"`
WonderfulMomentMvTitle string `form:"wonderfulMomentMvTitleOrder" search:"type:order;column:wonderful_moment_mv_title;table:org_match_evaluate"`
MvStatus string `form:"mvStatusOrder" search:"type:order;column:mv_status;table:org_match_evaluate"`
Status string `form:"statusOrder" search:"type:order;column:status;table:org_match_evaluate"`
Remark string `form:"remarkOrder" search:"type:order;column:remark;table:org_match_evaluate"`
CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:org_match_evaluate"`
UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:org_match_evaluate"`
CreatedAt time.Time `form:"createdAtOrder" search:"type:order;column:created_at;table:org_match_evaluate"`
UpdatedAt time.Time `form:"updatedAtOrder" search:"type:order;column:updated_at;table:org_match_evaluate"`
DeletedAt time.Time `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:org_match_evaluate"`
}
func (m *OrgMatchEvaluateGetPageReq) GetNeedSearch() interface{} {
......@@ -33,28 +58,36 @@ func (m *OrgMatchEvaluateGetPageReq) GetNeedSearch() interface{} {
}
type OrgMatchEvaluateInsertReq struct {
Id int `json:"-" comment:""` //
TeamUserId string `json:"teamUserId" comment:"org_team_user表id(教练id)"`
PlayerId string `json:"playerId" comment:"org_player表id(球员id)"`
Content string `json:"content" comment:"教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" comment:"精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" comment:"精彩时刻图标题"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" comment:"精彩时刻视频"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" comment:"精彩时刻视频标题"`
common.ControlBy
Id int `json:"-" comment:""` //
Rounds string `json:"rounds" comment:""`
TeamUserId string `json:"teamUserId" comment:"org_team_user表id(教练id)"`
PlayerId string `json:"playerId" comment:"org_player表id(球员id)"`
Content string `json:"content" comment:"教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" comment:"精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" comment:"精彩时刻视频"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" comment:"精彩时刻图标题"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" comment:"精彩时刻视频标题"`
MvStatus string `json:"mvStatus" comment:"视频维护状态 1 待维护 2 维护完成 3 驳回 4 维护完成"`
Status string `json:"status" comment:"发布状态 1 待审核 3 驳回 4 发布完成"`
Remark string `json:"remark" comment:"驳回原因"`
common.ControlBy
}
func (s *OrgMatchEvaluateInsertReq) Generate(model *models.OrgMatchEvaluate) {
if s.Id == 0 {
model.Model = common.Model{ Id: s.Id }
}
model.TeamUserId = s.TeamUserId
model.PlayerId = s.PlayerId
model.Content = s.Content
model.WonderfulMomentImg = s.WonderfulMomentImg
model.WonderfulMomentMv = s.WonderfulMomentMv
model.WonderfulMomentImgTitle = s.WonderfulMomentImgTitle
model.WonderfulMomentMvTitle = s.WonderfulMomentMvTitle
func (s *OrgMatchEvaluateInsertReq) Generate(model *models.OrgMatchEvaluate) {
if s.Id == 0 {
model.Model = common.Model{Id: s.Id}
}
model.Rounds = s.Rounds
model.TeamUserId = s.TeamUserId
model.PlayerId = s.PlayerId
model.Content = s.Content
model.WonderfulMomentImg = s.WonderfulMomentImg
model.WonderfulMomentMv = s.WonderfulMomentMv
model.WonderfulMomentImgTitle = s.WonderfulMomentImgTitle
model.WonderfulMomentMvTitle = s.WonderfulMomentMvTitle
model.MvStatus = s.MvStatus
model.Status = s.Status
model.Remark = s.Remark
}
func (s *OrgMatchEvaluateInsertReq) GetId() interface{} {
......@@ -62,28 +95,36 @@ func (s *OrgMatchEvaluateInsertReq) GetId() interface{} {
}
type OrgMatchEvaluateUpdateReq struct {
Id int `uri:"id" comment:""` //
TeamUserId string `json:"teamUserId" comment:"org_team_user表id(教练id)"`
PlayerId string `json:"playerId" comment:"org_player表id(球员id)"`
Content string `json:"content" comment:"教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" comment:"精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" comment:"精彩时刻图标题"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" comment:"精彩时刻视频"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" comment:"精彩时刻视频标题"`
common.ControlBy
Id int `uri:"id" comment:""` //
Rounds string `json:"rounds" comment:""`
TeamUserId string `json:"teamUserId" comment:"org_team_user表id(教练id)"`
PlayerId string `json:"playerId" comment:"org_player表id(球员id)"`
Content string `json:"content" comment:"教练评价内容"`
WonderfulMomentImg string `json:"wonderfulMomentImg" comment:"精彩时刻图"`
WonderfulMomentMv string `json:"wonderfulMomentMv" comment:"精彩时刻视频"`
WonderfulMomentImgTitle string `json:"wonderfulMomentImgTitle" comment:"精彩时刻图标题"`
WonderfulMomentMvTitle string `json:"wonderfulMomentMvTitle" comment:"精彩时刻视频标题"`
MvStatus string `json:"mvStatus" comment:"视频维护状态 1 待维护 2 维护完成 3 驳回 4 维护完成"`
Status string `json:"status" comment:"发布状态 1 待审核 3 驳回 4 发布完成"`
Remark string `json:"remark" comment:"驳回原因"`
common.ControlBy
}
func (s *OrgMatchEvaluateUpdateReq) Generate(model *models.OrgMatchEvaluate) {
if s.Id == 0 {
model.Model = common.Model{ Id: s.Id }
}
model.TeamUserId = s.TeamUserId
model.PlayerId = s.PlayerId
model.Content = s.Content
model.WonderfulMomentImg = s.WonderfulMomentImg
model.WonderfulMomentMv = s.WonderfulMomentMv
model.WonderfulMomentImgTitle = s.WonderfulMomentImgTitle
model.WonderfulMomentMvTitle = s.WonderfulMomentMvTitle
func (s *OrgMatchEvaluateUpdateReq) Generate(model *models.OrgMatchEvaluate) {
if s.Id == 0 {
model.Model = common.Model{Id: s.Id}
}
model.Rounds = s.Rounds
model.TeamUserId = s.TeamUserId
model.PlayerId = s.PlayerId
model.Content = s.Content
model.WonderfulMomentImg = s.WonderfulMomentImg
model.WonderfulMomentMv = s.WonderfulMomentMv
model.WonderfulMomentImgTitle = s.WonderfulMomentImgTitle
model.WonderfulMomentMvTitle = s.WonderfulMomentMvTitle
model.MvStatus = s.MvStatus
model.Status = s.Status
model.Remark = s.Remark
}
func (s *OrgMatchEvaluateUpdateReq) GetId() interface{} {
......@@ -92,8 +133,9 @@ func (s *OrgMatchEvaluateUpdateReq) GetId() interface{} {
// OrgMatchEvaluateGetReq 功能获取请求参数
type OrgMatchEvaluateGetReq struct {
Id int `uri:"id"`
Id int `uri:"id"`
}
func (s *OrgMatchEvaluateGetReq) GetId() interface{} {
return s.Id
}
......@@ -105,4 +147,4 @@ type OrgMatchEvaluateDeleteReq struct {
func (s *OrgMatchEvaluateDeleteReq) GetId() interface{} {
return s.Ids
}
\ No newline at end of file
}
......@@ -13,7 +13,7 @@ type OrgMatchTeamPlayerGetPageReq struct {
}
type UpdateOrgMatchTeamPlayerReq struct {
MatchId string `json:"matchId" gorm:"type:bigint(20);comment:MatchId"`
PlayersIds string `form:"playersIds"`
PlayersIds string `json:"playersIds"`
}
type OrgMatchTeamPlayerOrder struct {
......@@ -21,6 +21,7 @@ type OrgMatchTeamPlayerOrder struct {
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"`
PlayerId string `form:"playerIdOrder" search:"type:order;column:player_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"`
......@@ -49,6 +50,7 @@ type OrgMatchTeamPlayerInsertReq struct {
MatchId string `json:"matchId" comment:""`
ClubId string `json:"clubId" comment:""`
TeamId string `json:"teamId" comment:""`
PlayerId string `json:"playerId" comment:""`
PlayerName string `json:"playerName" comment:"球员名称"`
PlayerNumber string `json:"playerNumber" comment:"球员号码"`
Position string `json:"position" comment:"场上位置"`
......@@ -71,6 +73,7 @@ func (s *OrgMatchTeamPlayerInsertReq) Generate(model *models.OrgMatchTeamPlayer)
model.MatchId = s.MatchId
model.ClubId = s.ClubId
model.TeamId = s.TeamId
model.PlayerId = s.PlayerId
model.PlayerName = s.PlayerName
model.PlayerNumber = s.PlayerNumber
model.Position = s.Position
......@@ -94,6 +97,7 @@ type OrgMatchTeamPlayerUpdateReq struct {
MatchId string `json:"matchId" comment:""`
ClubId string `json:"clubId" comment:""`
TeamId string `json:"teamId" comment:""`
PlayerId string `json:"playerId" comment:""`
PlayerName string `json:"playerName" comment:"球员名称"`
PlayerNumber string `json:"playerNumber" comment:"球员号码"`
Position string `json:"position" comment:"场上位置"`
......@@ -116,6 +120,7 @@ func (s *OrgMatchTeamPlayerUpdateReq) Generate(model *models.OrgMatchTeamPlayer)
model.MatchId = s.MatchId
model.ClubId = s.ClubId
model.TeamId = s.TeamId
model.PlayerId = s.PlayerId
model.PlayerName = s.PlayerName
model.PlayerNumber = s.PlayerNumber
model.Position = s.Position
......
......@@ -2,35 +2,62 @@ package service
import (
"errors"
"github.com/go-admin-team/go-admin-core/sdk/service"
"github.com/go-admin-team/go-admin-core/sdk/service"
cDto "go-admin/common/dto"
"gorm.io/gorm"
"go-admin/app/operate/models"
"go-admin/app/operate/service/dto"
"go-admin/common/actions"
cDto "go-admin/common/dto"
)
type OrgMatchEvaluate struct {
service.Service
}
func CreateSearch(key string, act string, value string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
if value != "" {
switch act {
case "=":
return db.Where(key+" = ?", value)
case "like":
return db.Where(key+" like '%?%'", value)
case ">":
return db.Where(key+" > ?", value)
case "<":
return db.Where(key+" > ?", value)
case "<>":
return db.Where(key+" <> ?", value)
default:
return db
}
} else {
return db
}
}
}
// GetPage 获取OrgMatchEvaluate列表
func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions.DataPermission, list *[]models.OrgMatchEvaluate, count *int64) error {
func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions.DataPermission, list *[]dto.OrgMatchEvaluateGetPageReply, count *int64) error {
var err error
var data models.OrgMatchEvaluate
err = e.Orm.Model(&data).
err = e.Orm.Table("org_match_team_player as omtp").
Select("omtp.id, ol.league_name, od.division_name, os.season_name, om.rounds, omtp.player_name, om.match_start_time, om.match_end_time, ome.mv_status, ome.status, ome.remark").
Joins("left join org_match_evaluate as ome on omtp.player_id = ome.player_id").
Joins("left join org_match as om on omtp.match_id = om.id").
Joins("left join org_league as ol on ol.id = om.league_id").
Joins("left join org_division as od on od.id = om.division_id").
Joins("left join org_season as os on os.id = om.season_id").
Scopes(
cDto.MakeCondition(c.GetNeedSearch()),
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
actions.Permission(data.TableName(), p),
actions.Permission("omtp", p),
).
Find(list).Limit(-1).Offset(-1).
Count(count).Error
if err != nil {
e.Log.Errorf("OrgMatchEvaluateService GetPage error:%s \r\n", err)
e.Log.Errorf("OrgMatchService GetPage error:%s \r\n", err)
return err
}
return nil
......@@ -59,9 +86,9 @@ func (e *OrgMatchEvaluate) Get(d *dto.OrgMatchEvaluateGetReq, p *actions.DataPer
// Insert 创建OrgMatchEvaluate对象
func (e *OrgMatchEvaluate) Insert(c *dto.OrgMatchEvaluateInsertReq) error {
var err error
var data models.OrgMatchEvaluate
c.Generate(&data)
var err error
var data models.OrgMatchEvaluate
c.Generate(&data)
err = e.Orm.Create(&data).Error
if err != nil {
e.Log.Errorf("OrgMatchEvaluateService Insert error:%s \r\n", err)
......@@ -72,22 +99,22 @@ func (e *OrgMatchEvaluate) Insert(c *dto.OrgMatchEvaluateInsertReq) error {
// Update 修改OrgMatchEvaluate对象
func (e *OrgMatchEvaluate) Update(c *dto.OrgMatchEvaluateUpdateReq, p *actions.DataPermission) error {
var err error
var data = models.OrgMatchEvaluate{}
e.Orm.Scopes(
actions.Permission(data.TableName(), p),
).First(&data, c.GetId())
c.Generate(&data)
var err error
var data = models.OrgMatchEvaluate{}
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("OrgMatchEvaluateService 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("OrgMatchEvaluateService Save error:%s \r\n", err)
return err
}
if db.RowsAffected == 0 {
return errors.New("无权更新该数据")
}
return nil
}
// Remove 删除OrgMatchEvaluate
......@@ -99,11 +126,11 @@ func (e *OrgMatchEvaluate) Remove(d *dto.OrgMatchEvaluateDeleteReq, p *actions.D
actions.Permission(data.TableName(), p),
).Delete(&data, d.GetId())
if err := db.Error; err != nil {
e.Log.Errorf("Service RemoveOrgMatchEvaluate error:%s \r\n", err)
return err
}
if db.RowsAffected == 0 {
return errors.New("无权删除该数据")
}
e.Log.Errorf("Service RemoveOrgMatchEvaluate error:%s \r\n", err)
return err
}
if db.RowsAffected == 0 {
return errors.New("无权删除该数据")
}
return nil
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment