UserMusicMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.ym.mec.biz.dal.mapper.UserMusicMapper">
  4. <select id="selectPage" resultType="com.ym.mec.biz.dal.wrapper.UserMusicWrapper$UserMusic">
  5. SELECT t.id_,
  6. t.user_id_,
  7. t.client_type_,
  8. t.music_practice_record_id_,
  9. t.music_sheet_id_,
  10. t.video_img_,
  11. t.accompany_url_,
  12. t.type_,
  13. t.img_,
  14. t.desc_,
  15. t.video_url_,
  16. t.json_config_,
  17. t.like_num_,
  18. t.del_flag_,
  19. t.expire_flag_,
  20. t.submit_time_,
  21. t.select_flag_,
  22. t.file_type_ ,
  23. t.update_time_ as createTime
  24. FROM user_music t
  25. left join sys_music_score t1 on t1.id_ = t.music_sheet_id_
  26. <where>
  27. t.del_flag_ = 0 and t.expire_flag_ = 0
  28. <if test="param.keyword != null and param.keyword != ''">
  29. and t1.name_ like concat('%', #{param.keyword}, '%')
  30. </if>
  31. <if test="param.userId != null">
  32. and t.user_id_ = #{param.userId}
  33. </if>
  34. <if test="param.clientType != null">
  35. and t.client_type_ = #{param.clientType}
  36. </if>
  37. <if test="param.type != null">
  38. and t.type_ = #{param.type}
  39. </if>
  40. <if test="param.id != null">
  41. and t.id_ = #{param.id}
  42. </if>
  43. <if test="param.exclusionId != null">
  44. and t.id_ != #{param.exclusionId}
  45. </if>
  46. <if test="param.fileType != null">
  47. and t.file_type_ = #{param.fileType}
  48. </if>
  49. <if test="param.musicPracticeRecordId != null">
  50. and t.music_practice_record_id_ = #{param.musicPracticeRecordId}
  51. </if>
  52. </where>
  53. <if test="param.sort != null">
  54. order by
  55. <if test="param.sort == 1">
  56. t.like_num_ desc,
  57. </if>
  58. t.submit_time_ desc ,t.create_time_ desc ,t.id_ desc
  59. </if>
  60. </select>
  61. <update id="updateStar">
  62. update user_music set like_num_ =(select count(1) from user_music_star where user_music_id_ = #{userMusicId}) where id_ = #{userMusicId}
  63. </update>
  64. <update id="workOverdue">
  65. update user_music set expire_flag_ = 1 where date_add(update_time_,interval #{time} day ) &lt;= now() and type_ = 'DRAFT' and expire_flag_ = 0
  66. </update>
  67. </mapper>