BbsCollectMapper.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.yonge.cooleshow.bbs.dao.BbsCollectDao">
  4. <resultMap id="BaseResultMap" type="com.yonge.cooleshow.bbs.entity.BbsCollect">
  5. <result column="id_" property="id" />
  6. <result column="article_id_" property="articleId" />
  7. <result column="collect_user_id_" property="collectUserId" />
  8. <result column="created_time_" property="createdTime" />
  9. </resultMap>
  10. <!-- 表字段 -->
  11. <sql id="baseColumns">
  12. t.id_ as id
  13. , t.article_id_ as articleId
  14. , t.collect_user_id_ as collectUserId
  15. , t.created_time_ as createdTime
  16. </sql>
  17. <select id="detail" resultType="com.yonge.cooleshow.bbs.vo.BbsCollectVo">
  18. SELECT
  19. <include refid="baseColumns"/>
  20. FROM bbs_collect t
  21. where t.id_ = #{id}
  22. </select>
  23. <select id="selectPage" resultType="com.yonge.cooleshow.bbs.vo.BbsCollectVo">
  24. SELECT
  25. <include refid="baseColumns" />
  26. ,ba.title_ as title
  27. ,ba.label_name_ as labelName
  28. ,ba.label_id_ as labelId
  29. FROM bbs_collect t
  30. left join bbs_article ba on t.article_id_ = ba.id_
  31. <where>
  32. <if test="param.userId != null">
  33. and #{param.userId,jdbcType=BIGINT} = t.collect_user_id_
  34. </if>
  35. </where>
  36. order by t.created_time_ desc
  37. </select>
  38. </mapper>