PostItemMapper.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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="cn.reghao.tnb.content.app.vod.db.mapper.PostItemMapper">
  4. <insert id="save" useGeneratedKeys="true" keyProperty="id">
  5. insert into vod_post_item
  6. (`album_id`,`post_id`,`pos`,`channel_code`,`object_id`,`format`,`url`,`width`,`height`,`horizontal`)
  7. values
  8. (#{albumId},#{postId},#{pos},#{channelCode},#{objectId},#{format},#{url},#{width},#{height},#{horizontal})
  9. </insert>
  10. <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
  11. insert into vod_post_item
  12. (`album_id`,`post_id`,`pos`,`channel_code`,`object_id`,`format`,`url`,`width`,`height`,`horizontal`)
  13. values
  14. <foreach collection="list" item="item" index="index" separator=",">
  15. (#{item.albumId},#{item.postId},#{item.pos},#{item.channelCode},#{item.objectId},#{item.format},#{item.url},#{item.width},#{item.height},#{item.horizontal})
  16. </foreach>
  17. </insert>
  18. <delete id="deleteByAlbumIdAndPostId">
  19. delete from vod_post_item
  20. where album_id=#{albumId} and post_id=#{postId}
  21. </delete>
  22. <select id="countByAlbumId" resultType="java.lang.Integer">
  23. select count(*)
  24. from vod_post_item
  25. where album_id=#{albumId}
  26. </select>
  27. <select id="findByAlbumIdByPage" resultType="cn.reghao.tnb.content.app.vod.model.po.PostItem">
  28. select *
  29. from vod_post_item
  30. where album_id=#{albumId}
  31. </select>
  32. <select id="findByImagePost" resultType="cn.reghao.tnb.content.app.vod.model.po.PostItem">
  33. select *
  34. from vod_post_item
  35. where album_id in
  36. (
  37. select album_id
  38. from vod_post_album
  39. where post_type=1 and create_by=#{createBy}
  40. )
  41. and object_id=#{imageFileId}
  42. </select>
  43. <select id="findByUrl" resultType="cn.reghao.tnb.content.app.vod.model.po.PostItem">
  44. select *
  45. from vod_post_item
  46. where url=#{url}
  47. limit 1
  48. </select>
  49. </mapper>