代码

  1. 一对一
<!--    -->
<?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">
<!--这里对应Maper接口类的命名空间-->
<mapper namespace="com.xxxxxx.suddenlynlinelearningplatform.mapper.VideoCommentMaper">
<!--  查询评论  -->
     <resultMap type="com.xxxxxx.suddenlynlinelearningplatform.entity.VideoComment" >
         <id property="id" column="id"/>
         <association property="student" column="student_id" select="findStudentById">
         </association>
         <association property="repliedStudent" column="replied_student_id" select="findStudentById">
         </association>
         <association property="videoCommentList" column="id" select="findByWhileClassVideoComments">
         </association>
         <association property="myLike" column="{id=id,param2=student_id}"  select="findMyIsLike">
         </association>
     </resultMap>
<!--  一级评论  -->
    <select >
        select * from `video_comments` where video_comment_id=0 and status = 1 and video_id=#{param1}
    </select>
<!--    二级评论-->
    <select >
        select * from `video_comments` where status = 1 and video_comment_id=#{video_comment_id}
    </select>
<!--    查询学生-->
    <select >
        select id,name,avatar_url,bewrite from `students` where id = #{id}
    </select>
<!--    查询自己是否点赞了这个博客-->
    <select >
        select count(1) from `video_comment_likes` where video_comment_id=#{id} and student_id=#{param2} limit 1
    </select>
</mapper>

相关文章:

  • 2021-07-07
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2023-03-19
猜你喜欢
  • 2021-04-07
  • 2021-09-08
  • 2021-12-14
  • 2022-02-20
  • 2022-12-23
相关资源
相似解决方案