Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
Project
Project
Details
Activity
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
antai-sport
antai-sport-http-server
Commits
fb1fceca
Commit
fb1fceca
authored
Apr 21, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日常赛发布和删除
parent
78af6900
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
4 deletions
+51
-4
SimpleMatchController.java
...usiness/simplematch/controller/SimpleMatchController.java
+17
-4
SimpleMatchListVO.java
...nt/api/business/simplematch/dto/vo/SimpleMatchListVO.java
+1
-0
SimpleMatchService.java
.../api/business/simplematch/service/SimpleMatchService.java
+26
-0
SimpleMatch.java
...ttp/server/repository/simplematch/entity/SimpleMatch.java
+5
-0
SimpleMatchBusinessMapper.xml
...esources/mapper/simplematch/SimpleMatchBusinessMapper.xml
+2
-0
No files found.
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/controller/SimpleMatchController.java
View file @
fb1fceca
...
...
@@ -7,10 +7,7 @@ import com.antai.sport.http.server.management.api.business.simplematch.service.S
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -29,4 +26,20 @@ public class SimpleMatchController {
public
ResponseEntity
<
Result
<
SimpleMatchListResponseDTO
>>
getMatchList
(
@RequestBody
SimpleMatchListRequestDTO
param
)
{
return
success
(
simpleMatchService
.
getMatchList
(
param
));
}
@ApiOperation
(
"删除"
)
@DeleteMapping
(
"/{matchId}"
)
public
ResponseEntity
<
Result
>
deleteMatch
(
@PathVariable
(
"matchId"
)
Long
matchId
)
{
simpleMatchService
.
deleteMatch
(
matchId
);
return
success
();
}
@ApiOperation
(
"更改发布状态"
)
@PutMapping
(
"/{matchId}"
)
public
ResponseEntity
<
Result
>
publish
(
@PathVariable
(
"matchId"
)
Long
matchId
)
{
simpleMatchService
.
publish
(
matchId
);
return
success
();
}
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/dto/vo/SimpleMatchListVO.java
View file @
fb1fceca
...
...
@@ -13,4 +13,5 @@ public class SimpleMatchListVO {
private
String
pathName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
startTime
;
private
Integer
status
;
}
management-api/src/main/java/com/antai/sport/http/server/management/api/business/simplematch/service/SimpleMatchService.java
View file @
fb1fceca
package
com
.
antai
.
sport
.
http
.
server
.
management
.
api
.
business
.
simplematch
.
service
;
import
com.antai.sport.http.server.common.exception.BusinessException
;
import
com.antai.sport.http.server.constants.DeleteStatus
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListRequestDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.SimpleMatchListResponseDTO
;
import
com.antai.sport.http.server.management.api.business.simplematch.dto.vo.SimpleMatchListVO
;
import
com.antai.sport.http.server.management.api.business.simplematch.mapper.SimpleMatchBusinessMapper
;
import
com.antai.sport.http.server.repository.simplematch.entity.SimpleMatch
;
import
com.antai.sport.http.server.repository.simplematch.mapper.SimpleMatchMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -14,6 +18,8 @@ import javax.annotation.Resource;
@Service
public
class
SimpleMatchService
{
@Resource
private
SimpleMatchMapper
simpleMatchMapper
;
@Resource
private
SimpleMatchBusinessMapper
simpleMatchBusinessMapper
;
...
...
@@ -31,4 +37,24 @@ public class SimpleMatchService {
dto
.
setTotalCount
(
result
.
getTotal
());
return
dto
;
}
public
void
deleteMatch
(
Long
matchId
)
{
SimpleMatch
simpleMatch
=
simpleMatchMapper
.
selectById
(
matchId
);
if
(
simpleMatch
.
getStatus
()
!=
null
&&
simpleMatch
.
getStatus
().
equals
(
20
))
{
throw
new
BusinessException
(
"已发布比赛不能删除"
);
}
simpleMatch
.
setDeleted
(
Integer
.
valueOf
(
DeleteStatus
.
DELETED
));
simpleMatchMapper
.
updateById
(
simpleMatch
);
}
public
void
publish
(
Long
matchId
)
{
SimpleMatch
simpleMatch
=
simpleMatchMapper
.
selectById
(
matchId
);
if
(
simpleMatch
.
getStatus
()
==
null
||
simpleMatch
.
getStatus
().
equals
(
10
))
{
simpleMatch
.
setStatus
(
20
);
}
else
{
simpleMatch
.
setStatus
(
10
);
}
simpleMatchMapper
.
updateById
(
simpleMatch
);
}
}
repository/src/main/java/com/antai/sport/http/server/repository/simplematch/entity/SimpleMatch.java
View file @
fb1fceca
...
...
@@ -79,6 +79,11 @@ public class SimpleMatch implements Serializable {
*/
private
String
description
;
/**
* 状态 10:未发布 20:已发布
*/
private
Integer
status
;
/**
* 显示顺序
*/
...
...
server-api/src/main/resources/mapper/simplematch/SimpleMatchBusinessMapper.xml
View file @
fb1fceca
...
...
@@ -16,6 +16,7 @@
) t2 on t1.id = t2.match_id
where t1.end_time
>
#{now}
and t1.deleted = 0
and t1.status = 20
) t1
order by t1.registered desc, t1.show_order, t1.start_time
</select>
...
...
@@ -25,6 +26,7 @@
from simple_match t1
where t1.end_time
>
#{now}
and t1.deleted = 0
and t1.status = 20
order by t1.show_order, t1.start_time
</select>
...
...
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