Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
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
micro_app
gk
Commits
9f9f3f35
Commit
9f9f3f35
authored
Sep 10, 2026
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
赛事列表接口增加赛事类型条件
parent
b023b13e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
CmptMapper.xml
.../com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptMapper.xml
+3
-0
CmptService.java
...a/com/dlbridge/jadp/plugins/cmpt/service/CmptService.java
+2
-2
MicroApiController.java
...om/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
+7
-3
No files found.
src/main/java/com/dlbridge/jadp/plugins/cmpt/dao/mapper/CmptMapper.xml
View file @
9f9f3f35
...
...
@@ -198,6 +198,9 @@
<if
test=
"@org.apache.commons.lang3.StringUtils@isNotBlank(param.keyword)"
>
and a.cmpt_name like concat('%',#{param.keyword},'%')
</if>
<if
test=
"@org.apache.commons.lang3.StringUtils@isNotBlank(param.cmptType)"
>
and c.`type`= #{param.cmptType}
</if>
<if
test=
"param.type == 1"
>
and now() >= c.openTime and c.deadLine >= now()
</if>
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/service/CmptService.java
View file @
9f9f3f35
...
...
@@ -198,7 +198,7 @@ public class CmptService {
public
Page
<
List
<
Cmpt
>>
queryCmpt
(
Pageable
page
,
Map
<
String
,
String
>
param
)
{
// 响应级缓存:同一筛选条件+分页 的所有用户看到相同结果,缓存1分钟
// 1000 req/s 下,60秒窗口内每个缓存key仅查DB一次,DB压力降至 < 0.02 req/s
String
responseCacheKey
=
CacheTemplate
.
REDIS_KEY_PREFIX
+
CacheTemplate
.
NS_CMPT_LIST_RESP
+
":"
+
param
.
get
(
"userId"
)
+
":"
+
param
.
get
(
"type"
)
String
responseCacheKey
=
CacheTemplate
.
REDIS_KEY_PREFIX
+
CacheTemplate
.
NS_CMPT_LIST_RESP
+
":"
+
param
.
get
(
"userId"
)
+
":"
+
param
.
get
(
"type"
)
+
":"
+
param
.
get
(
"cmptType"
)
+
":"
+
param
.
get
(
"keyword"
)
+
":"
+
param
.
get
(
"partnerId"
)
+
":"
+
page
.
getPageNumber
()
+
":"
+
page
.
getPageSize
();
Object
cached
=
valueOperations
.
get
(
responseCacheKey
);
...
...
@@ -214,7 +214,7 @@ public class CmptService {
}
// count 短时缓存:同一筛选条件翻页时避免重复执行跨库COUNT查询
String
countCacheKey
=
CacheTemplate
.
REDIS_KEY_PREFIX
+
CacheTemplate
.
NS_CMPT_LIST_COUNT
+
":"
+
param
.
get
(
"userId"
)
+
":"
+
param
.
get
(
"type"
)
+
":"
+
param
.
get
(
"keyword"
)
+
":"
+
param
.
get
(
"partnerId"
);
String
countCacheKey
=
CacheTemplate
.
REDIS_KEY_PREFIX
+
CacheTemplate
.
NS_CMPT_LIST_COUNT
+
":"
+
param
.
get
(
"userId"
)
+
":"
+
param
.
get
(
"type"
)
+
":"
+
param
.
get
(
"
cmptType"
)
+
":"
+
param
.
get
(
"
keyword"
)
+
":"
+
param
.
get
(
"partnerId"
);
Long
count
=
null
;
Object
cachedCount
=
valueOperations
.
get
(
countCacheKey
);
if
(
cachedCount
!=
null
)
{
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/MicroApiController.java
View file @
9f9f3f35
...
...
@@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit;
@Log4j2
@RestController
@RequestMapping
(
"api"
)
@Api
(
value
=
"赛
客助手小程序api"
,
tags
=
"赛客
助手小程序api"
)
@Api
(
value
=
"赛
事助手小程序api"
,
tags
=
"赛事
助手小程序api"
)
@ApiSort
(
1
)
public
class
MicroApiController
{
private
static
final
String
SIGNING_CODE
=
"1"
;
...
...
@@ -457,16 +457,19 @@ public class MicroApiController {
/**
* 小程序赛事列表接口
*
赛事助手
小程序赛事列表接口
*
* @return 赛事列表
*/
@PostMapping
(
value
=
"/cmpt"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"成功"
),
@ApiResponse
(
code
=
-
1
,
message
=
"失败"
,
response
=
ObjectUtils
.
Null
.
class
),
@ApiResponse
(
code
=
200
,
message
=
"成功"
,
response
=
Page
.
class
,
responseContainer
=
"List"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"页码"
,
name
=
"page"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
value
=
"条数"
,
name
=
"size"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
value
=
"关键字"
,
name
=
"keyword"
,
required
=
false
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"页码"
,
name
=
"page"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
value
=
"条数"
,
name
=
"size"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
value
=
"关键字"
,
name
=
"keyword"
,
required
=
false
)})
@ApiOperation
(
value
=
"赛事列表"
,
notes
=
"赛事列表,与查询接口一致"
,
tags
=
"首页接口"
)
public
Page
<
List
<
Cmpt
>>
cmpt
(
@ApiIgnore
Pageable
page
,
String
keyword
,
HttpServletRequest
request
)
{
int
type
=
NumberUtils
.
toInt
(
request
.
getParameter
(
"type"
),
0
);
String
cmptType
=
request
.
getParameter
(
"cmptType"
);
String
partnerId
=
request
.
getParameter
(
"partnerId"
);
String
creator
=
request
.
getParameter
(
"userId"
);
Partner
partner
=
cmptService
.
getPartnerById
(
partnerId
);
...
...
@@ -481,6 +484,7 @@ public class MicroApiController {
param
.
put
(
"userId"
,
partner
.
getUserId
()
+
""
);
param
.
put
(
"creator"
,
creator
);
param
.
put
(
"type"
,
type
+
""
);
param
.
put
(
"cmptType"
,
cmptType
);
param
.
put
(
"keyword"
,
keyword
);
param
.
put
(
"partnerId"
,
partnerId
);
Page
<
List
<
Cmpt
>>
result
=
cmptService
.
queryCmpt
(
page
,
param
);
...
...
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