<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="org.springblade.modules.comment.mapper.CommentMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="ulikesResultMap" type="org.springblade.modules.comment.vo.CommentVO">
|
|
</resultMap>
|
|
|
<select id="selectSurveyPage" resultMap="ulikesResultMap">
|
SELECT
|
com.*,
|
user.real_name as name
|
FROM
|
sys_comment com
|
LEFT JOIN blade_user user ON com.user_id = user.id
|
where 1=1 and isexamine = 1
|
<if test="comment.article!=null and comment.article!=''">
|
and article = #{comment.article}
|
</if>
|
ORDER BY topping DESC,time DESC
|
|
</select>
|
|
<select id="articlepage" resultMap="ulikesResultMap">
|
SELECT
|
com.*,
|
user.real_name AS name,
|
art.title,
|
art.source_name
|
FROM
|
sys_comment com
|
LEFT JOIN blade_user user ON com.user_id = user.id
|
LEFT JOIN sys_article art on art.id = com.article
|
WHERE
|
1 =1
|
<if test="comment.topping!=null and comment.topping!=''">
|
and topping = #{comment.topping}
|
</if>
|
<if test="comment.isexamine!=null and comment.isexamine!=''">
|
and isexamine = #{comment.isexamine}
|
</if>
|
<if test="comment.sourceName!=null and comment.sourceName!=''">
|
and source_name LIKE CONCAT ('%', #{comment.sourceName},'%')
|
</if>
|
<if test="comment.title!=null and comment.title!=''">
|
and title LIKE CONCAT ('%', #{comment.title},'%')
|
</if>
|
<if test="comment.name!=null and comment.name!=''">
|
and name LIKE CONCAT ('%', #{comment.name},'%')
|
</if>
|
<if test="comment.startTime!=null and comment.startTime!=''">
|
and time>=#{comment.startTime}
|
</if>
|
<if test="comment.endTime!=null and comment.endTime!=''">
|
and time<=#{comment.endTime}
|
</if>
|
ORDER BY isexamine ASC,topping DESC,time DESC
|
</select>
|
|
|
</mapper>
|