DiskAlbumMapper.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.disk.db.mapper.DiskAlbumMapper">
  4. <insert id="save" useGeneratedKeys="true" keyProperty="id">
  5. insert into my_disk_album
  6. (`album_id`,`album_name`,`cover_url`,`num`,`create_at`,`create_by`)
  7. values
  8. (#{albumId},#{albumName},#{coverUrl},#{num},#{createAt},#{createBy})
  9. </insert>
  10. <insert id="saveAlbumFiles" useGeneratedKeys="true" keyProperty="id">
  11. insert into my_disk_album_file
  12. (`album_id`,`file_id`,`file_type`,`pos`)
  13. values
  14. <foreach collection="list" item="item" index="index" separator=",">
  15. (#{item.albumId},#{item.fileId},#{item.fileType},#{item.pos})
  16. </foreach>
  17. </insert>
  18. <update id="updateCoverUrl">
  19. update my_disk_album
  20. set update_time=now(),cover_url=#{coverUrl}
  21. where album_id=#{albumId}
  22. </update>
  23. <update id="updateNum">
  24. update my_disk_album
  25. set update_time=now(),num=#{num}
  26. where album_id=#{albumId}
  27. </update>
  28. <select id="findDiskAlbum" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskAlbum">
  29. select *
  30. from my_disk_album
  31. where album_id=#{albumId}
  32. </select>
  33. <select id="findByCreateBy" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskAlbum">
  34. select *
  35. from my_disk_album
  36. where create_by=#{createBy}
  37. </select>
  38. <select id="findDiskAlbumFiles" resultType="cn.reghao.tnb.content.app.disk.model.po.DiskAlbumFile">
  39. select *
  40. from my_disk_album_file
  41. where album_id=#{albumId}
  42. order by pos asc
  43. </select>
  44. </mapper>