Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
段启岩
beyond-clouds
Commits
1f257b91
Commit
1f257b91
authored
Feb 16, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问答锁定
parent
4d531cdf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionServiceImpl.java
+14
-4
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionTagServiceImpl.java
+4
-1
No files found.
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionServiceImpl.java
View file @
1f257b91
...
...
@@ -179,7 +179,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
//1.判断自己是否发布过此问题
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"question_id"
,
questionId
)
.
eq
(
"user_id"
,
userId
);
.
eq
(
"user_id"
,
userId
)
.
eq
(
"status"
,
0
);
Question
question
=
getOne
(
questionQueryWrapper
);
if
(
null
==
question
)
{
throw
new
QuestionServiceException
(
QuestionErrorCode
.
QUESTION_NOT_FOUND
);
...
...
@@ -221,7 +222,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
//1.判断自己是否发布过此问题
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"question_id"
,
question
.
getQuestionId
())
.
eq
(
"user_id"
,
question
.
getUserId
());
.
eq
(
"user_id"
,
question
.
getUserId
())
.
eq
(
"status"
,
0
);
Question
questionInDb
=
getOne
(
questionQueryWrapper
);
if
(
null
==
questionInDb
)
{
throw
new
QuestionServiceException
(
QuestionErrorCode
.
QUESTION_NOT_FOUND
);
...
...
@@ -267,7 +269,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
@Override
public
QuestionDetailDTO
getQuestionDetail
(
String
questionId
,
Subject
subject
)
throws
QuestionServiceException
,
QuestionTagServiceException
{
//1.获取问题基本信息
Question
question
=
getById
(
questionId
);
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"question_id"
,
questionId
);
questionQueryWrapper
.
eq
(
"status"
,
0
);
Question
question
=
getOne
(
questionQueryWrapper
);
//2.判断是否存在此问题
if
(
null
==
question
)
{
...
...
@@ -329,6 +335,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
IPage
<
Question
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
orderByDesc
(
"q.create_time"
);
questionQueryWrapper
.
eq
(
"q.status"
,
0
);
if
(
null
!=
categoryId
)
{
questionQueryWrapper
.
eq
(
"q.category_id"
,
categoryId
);
}
...
...
@@ -339,7 +346,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
public
IPage
<
Question
>
getUserQuestionPage
(
Integer
pageNumber
,
Integer
pageSize
,
String
userId
)
{
IPage
<
Question
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"q.user_id"
,
userId
)
questionQueryWrapper
.
eq
(
"q.user_id"
,
userId
)
.
eq
(
"q.status"
,
0
)
.
orderByDesc
(
"q.create_time"
);
return
questionMapper
.
selectPageWithTags
(
page
,
questionQueryWrapper
);
}
...
...
@@ -367,6 +376,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
public
IPage
<
Question
>
getHotsQuestionsPage
(
Integer
pageNumber
,
Integer
pageSize
)
{
IPage
<
Question
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"q.status"
,
0
);
questionQueryWrapper
.
orderByDesc
(
"q.view_number"
);
return
questionMapper
.
selectPageWithTags
(
page
,
questionQueryWrapper
);
}
...
...
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionTagServiceImpl.java
View file @
1f257b91
...
...
@@ -59,7 +59,10 @@ public class QuestionTagServiceImpl extends ServiceImpl<QuestionTagMapper, Quest
@Override
public
List
<
Tag
>
getQuestionTags
(
String
questionId
)
throws
QuestionTagServiceException
{
//1.获取问题信息
Question
question
=
questionService
.
getById
(
questionId
);
QueryWrapper
<
Question
>
questionQueryWrapper
=
new
QueryWrapper
<>();
questionQueryWrapper
.
eq
(
"question_id"
,
questionId
);
questionQueryWrapper
.
eq
(
"status"
,
0
);
Question
question
=
questionService
.
getOne
(
questionQueryWrapper
);
//判断该问题是否存在
if
(
null
==
question
)
{
...
...
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