forum-backend/target/classes/mapper/BmsCommentMapper.xml

21 lines
910 B
XML
Raw Normal View History

2023-06-14 20:12:48 +08:00
<?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="com.yovinchen.forum.mapper.BmsCommentMapper">
<resultMap id="topicVO" type="com.yovinchen.forum.model.vo.CommentVO">
<id column="id" property="id"/>
<result column="content" property="content"/>
<result column="user_id" property="userId"/>
<result column="topic_id" property="topicId"/>
<result column="username" property="username"/>
<result column="create_time" property="createTime"/>
</resultMap>
<select id="getCommentsByTopicID" resultMap="topicVO">
select bms_comment.*,ums_user.username
from bms_comment
join ums_user on ums_user.id = bms_comment.user_id
where topic_id = #{topicid}
order by create_time desc
</select>
</mapper>