UserMusicMapper.xml 2.5 KB

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