Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
research-project
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
research-project
Commits
7e4ed296
Commit
7e4ed296
authored
Sep 18, 2025
by
“Kongxiangkun”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
投票列表增加分页
parent
9440f548
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
43 deletions
+48
-43
cloud-research-api/src/main/java/com/yizhi/research/application/feign/ResearchQuestionClient.java
+2
-2
cloud-research-service/src/main/java/com/yizhi/research/application/controller/TrResearchQuestionController.java
+2
-2
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/TrResearchQuestionMapper.java
+11
-2
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/TrResearchQuestionMapper.xml
+31
-32
cloud-research-service/src/main/java/com/yizhi/research/application/service/impl/TrResearchQuestionServiceImpl.java
+2
-5
No files found.
cloud-research-api/src/main/java/com/yizhi/research/application/feign/ResearchQuestionClient.java
View file @
7e4ed296
...
...
@@ -104,8 +104,8 @@ public interface ResearchQuestionClient {
*/
@GetMapping
(
"/researchQuestion/getVoteResult"
)
VoteRankingVo
getVoteResult
(
@RequestParam
(
"researchId"
)
Long
researchId
,
@RequestParam
(
value
=
"page
Size"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
"page
No"
,
required
=
false
)
Integer
pageNo
);
@RequestParam
(
value
=
"page
No"
,
required
=
false
)
Integer
pageNo
,
@RequestParam
(
value
=
"page
Size"
,
required
=
false
)
Integer
pageSize
);
/**
* 获取投票排行榜
...
...
cloud-research-service/src/main/java/com/yizhi/research/application/controller/TrResearchQuestionController.java
View file @
7e4ed296
...
...
@@ -193,8 +193,8 @@ public class TrResearchQuestionController {
*/
@GetMapping
(
"/getVoteResult"
)
VoteRankingVo
getVoteResult
(
@RequestParam
(
"researchId"
)
Long
researchId
,
@RequestParam
(
value
=
"page
Size"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
value
=
"page
No"
,
required
=
false
)
Integer
pageNo
)
{
@RequestParam
(
value
=
"page
No"
,
required
=
false
)
Integer
pageNo
,
@RequestParam
(
value
=
"page
Size"
,
required
=
false
)
Integer
pageSize
)
{
return
researchQuestionService
.
getVoteResult
(
researchId
,
pageNo
,
pageSize
);
}
...
...
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/TrResearchQuestionMapper.java
View file @
7e4ed296
...
...
@@ -99,14 +99,23 @@ public interface TrResearchQuestionMapper extends BaseMapper<TrResearchQuestion>
* @param siteId
* @param researchId
* @param accountId
* @param isTop
* @return
*/
VoteRankingVo
getVoteResult
(
@Param
(
"companyId"
)
Long
companyId
,
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"researchId"
)
Long
researchId
,
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"isTop"
)
boolean
isTop
,
@Param
(
"researchId"
)
Long
researchId
,
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"pageStart"
)
Integer
pageStart
,
@Param
(
"pageEnd"
)
Integer
pageEnd
);
/**
* 投票排行榜
* @param companyId
* @param siteId
* @param researchId
* @return
*/
VoteRankingVo
getVoteTop
(
@Param
(
"companyId"
)
Long
companyId
,
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"researchId"
)
Long
researchId
);
/**
* 刪除投票中的指定問題
* @param id
* @param researchId
...
...
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/TrResearchQuestionMapper.xml
View file @
7e4ed296
...
...
@@ -184,37 +184,36 @@
</foreach>
</update>
<select
id=
"getVoteResult"
resultMap=
"getVoteResultMap"
>
SELECT r.id,r.name,a.id AS questionId,a.no,a.content_appendix_url,b.content, a.keywords,COUNT(c.id) AS voteCount
<if
test=
"isTop == null or isTop == false"
>
,IFNULL(myanswer.answerState,0) AS answerState
</if>
,r.vote_num
FROM tr_research_question a
INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0
LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id
LEFT JOIN research r ON a.research_id=r.id AND r.deleted=0
<if
test=
"isTop == null or isTop == false"
>
LEFT JOIN(
SELECT myb.question_id,COUNT(myb.question_id) AS answerState
FROM tr_research_answer mya
INNER JOIN tr_research_answer_question myb ON myb.answer_id=mya.id AND myb.deleted=0
INNER JOIN tr_research_answer_question_result myc ON myc.answer_question_id=myb.id AND myc.option_id IS NOT NULL
WHERE mya.research_id=#{researchId} AND mya.account_id=#{accountId} AND mya.finish=1
GROUP BY myb.question_id
) myanswer ON b.question_id=myanswer.question_id
</if>
WHERE a.research_id=#{researchId} AND a.company_id=#{companyId} AND a.site_id=#{siteId} AND a.deleted=0
GROUP BY r.id,r.name,a.id,a.no,a.content_appendix_url,b.content, a.keywords,r.vote_num
<if
test=
"isTop == null or isTop == false"
>
,IFNULL(myanswer.answerState,0)
</if>
<if
test=
"isTop != null and isTop == true"
>
ORDER BY COUNT(c.id) DESC,MIN(c.create_time)
</if>
<if
test=
"isTop != null and isTop == false"
>
ORDER BY a.no
</if>
SELECT r.id,r.name,a.id AS questionId,a.no,a.content_appendix_url,b.content, a.keywords,COUNT(c.id) AS voteCount
,IFNULL(myanswer.answerState,0) AS answerState
,r.vote_num
FROM tr_research_question a
INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0
LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id
LEFT JOIN research r ON a.research_id=r.id AND r.deleted=0
LEFT JOIN(
SELECT myb.question_id,COUNT(myb.question_id) AS answerState
FROM tr_research_answer mya
INNER JOIN tr_research_answer_question myb ON myb.answer_id=mya.id AND myb.deleted=0
INNER JOIN tr_research_answer_question_result myc ON myc.answer_question_id=myb.id AND myc.option_id IS NOT NULL
WHERE mya.research_id=#{researchId} AND mya.account_id=#{accountId} AND mya.finish=1
GROUP BY myb.question_id
) myanswer ON b.question_id=myanswer.question_id
WHERE a.research_id=#{researchId} AND a.company_id=#{companyId} AND a.site_id=#{siteId} AND a.deleted=0
GROUP BY r.id,r.name,a.id,a.no,a.content_appendix_url,b.content, a.keywords,r.vote_num
,IFNULL(myanswer.answerState,0)
ORDER BY a.no limit #{pageStart},#{pageEnd}
</select>
<select
id=
"getVoteTop"
resultMap=
"getVoteResultMap"
>
SELECT r.id,r.name,a.id AS questionId,a.no,a.content_appendix_url,b.content, a.keywords,COUNT(c.id) AS voteCount
,r.vote_num
FROM tr_research_question a
INNER JOIN tr_research_question_option b ON a.id=b.question_id AND b.deleted=0
LEFT JOIN tr_research_answer_question_result c ON c.option_id=b.id
LEFT JOIN research r ON a.research_id=r.id AND r.deleted=0
WHERE a.research_id=#{researchId} AND a.company_id=#{companyId} AND a.site_id=#{siteId} AND a.deleted=0
GROUP BY r.id,r.name,a.id,a.no,a.content_appendix_url,b.content, a.keywords,r.vote_num
ORDER BY COUNT(c.id) DESC,MIN(c.create_time)
</select>
</mapper>
cloud-research-service/src/main/java/com/yizhi/research/application/service/impl/TrResearchQuestionServiceImpl.java
View file @
7e4ed296
...
...
@@ -1161,7 +1161,7 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
Long
companyId
=
context
.
getCompanyId
();
Long
siteId
=
context
.
getSiteId
();
LOG
.
info
(
"投票列表入参, companyId:{}, siteId:{}, researchId:{}, start:{}, range:{}"
,
companyId
,
siteId
,
researchId
,
(
pageNo
-
1
)
*
pageSize
,
pageSize
);
VoteRankingVo
voteRankingVo
=
researchQuestionMapper
.
getVoteResult
(
companyId
,
siteId
,
researchId
,
context
.
getAccountId
(),
false
,
(
pageNo
-
1
)
*
pageSize
,
pageSize
);
VoteRankingVo
voteRankingVo
=
researchQuestionMapper
.
getVoteResult
(
companyId
,
siteId
,
researchId
,
context
.
getAccountId
(),(
pageNo
-
1
)
*
pageSize
,
pageSize
);
LOG
.
info
(
"投票列表返回, voteRankingVo:{}"
,
JSONUtil
.
toJsonStr
(
voteRankingVo
));
if
(
voteRankingVo
!=
null
){
Integer
finish
=
trResearchAnswerMapper
.
getResearchAnsweFinish
(
context
.
getAccountId
(),
researchId
);
...
...
@@ -1182,19 +1182,16 @@ public class TrResearchQuestionServiceImpl extends ServiceImpl<TrResearchQuestio
@Override
public
VoteRankingVo
getVoteTop
(
Long
researchId
)
{
Integer
pageNo
=
1
;
Integer
pageSize
=
Integer
.
MAX_VALUE
;
RequestContext
context
=
ContextHolder
.
get
();
Long
companyId
=
context
.
getCompanyId
();
Long
siteId
=
context
.
getSiteId
();
VoteRankingVo
result
=
researchQuestionMapper
.
getVote
Result
(
companyId
,
siteId
,
researchId
,
context
.
getAccountId
(),
true
,
pageNo
,
pageSize
);
VoteRankingVo
result
=
researchQuestionMapper
.
getVote
Top
(
companyId
,
siteId
,
researchId
);
if
(
result
!=
null
&&
!
CollectionUtils
.
isEmpty
(
result
.
getRankingList
())){
int
no
=
1
;
for
(
VoteRankingListVo
item
:
result
.
getRankingList
()){
item
.
setNo
(
no
++);
}
}
return
result
;
}
...
...
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