Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
wangming
/
kzy-oss
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 319c8cab
authored
May 27, 2020
by
wangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增评论列表
1 parent
7e8706ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
0 deletions
src/main/java/com/server/web/controller/CommentController.java
src/main/resources/mybatis/mapping/queryModel.xml
src/main/java/com/server/web/controller/CommentController.java
View file @
319c8ca
...
...
@@ -128,4 +128,38 @@ public class CommentController extends BaseController {
}
}
/**
* 评论列表
* @param pageNo
* @param pageSize
* @param authStatus
* @param name
* @return
*/
@ResponseBody
@RequestMapping
(
path
=
"/queryCommentList"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
},
produces
=
"application/json"
)
public
Map
queryCommentList
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageSize
,
@RequestParam
(
defaultValue
=
"-1"
)
Integer
authStatus
,
@RequestParam
(
defaultValue
=
""
)
String
name
)
{
try
{
Map
paramMap
=
new
HashMap
<>();
if
(
authStatus
!=-
1
){
paramMap
.
put
(
"authStatus"
,
authStatus
);
}
if
(!(
""
).
equals
(
name
)){
paramMap
.
put
(
"name"
,
"%"
+
name
+
"%"
);
}
PageHelper
.
startPage
(
pageNo
,
pageSize
,
true
,
false
);
List
list
=
openSqlRingsService
.
selectList_Rings
(
"com.mapping.queryModel.queryCommentList"
,
paramMap
);
PageInfo
pageInfo
=
new
PageInfo
(
list
);
PageModel
model
=
new
PageModel
();
model
.
setTotal
(
pageInfo
.
getTotal
());
model
.
setList
(
list
);
return
success
(
model
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
error
(
"0"
,
"系统异常"
,
null
);
}
}
}
src/main/resources/mybatis/mapping/queryModel.xml
View file @
319c8ca
...
...
@@ -279,4 +279,60 @@
c.type=1 AND c.relation_id = #{id,jdbcType=BIGINT}
ORDER BY c.auth_status ASC,c.create_dt ASC
</select>
<select
id=
"queryCommentList"
resultType=
"java.util.HashMap"
parameterType=
"java.util.HashMap"
>
SELECT * FROM (
SELECT
t.id,
t.type,
u.full_name AS fullName,
u.phone,
t.auth_status AS authStatus,
t.auth_dt AS authDt,
t.create_dt AS createDt,
t.reply_content AS replyContent,
c.course_name as name,
t.relation_id as relationId
FROM
t_kzy_comment t
LEFT JOIN t_kzy_course c ON t.relation_id = c.id
LEFT JOIN t_kzy_user u ON t.user_id = u.id
WHERE
t.type = 2
AND t.is_delete = 0
<if
test=
"authStatus != null"
>
AND t.auth_status = #{authStatus,jdbcType=INTEGER}
</if>
<if
test=
"name != null"
>
AND c.course_name LIKE #{name}
</if>
UNION ALL
SELECT
t.id,
t.type,
u.full_name AS fullName,
u.phone,
t.auth_status AS authStatus,
t.auth_dt AS authDt,
t.create_dt AS createDt,
t.reply_content AS replyContent,
c.title as name,
t.relation_id as relationId
FROM
t_kzy_comment t
LEFT JOIN t_kzy_information c ON t.relation_id = c.id
LEFT JOIN t_kzy_user u ON t.user_id = u.id
WHERE
t.type = 1
AND t.is_delete = 0
<if
test=
"authStatus != null"
>
AND t.auth_status = #{authStatus,jdbcType=INTEGER}
</if>
<if
test=
"name != null"
>
AND c.title LIKE #{name}
</if>
) a
ORDER BY a.createDt DESC
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment