MusicSheetMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.yonge.cooleshow.biz.dal.dao.MusicSheetDao">
  5. <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
  6. <id column="id_" jdbcType="BIGINT" property="id"/>
  7. <result column="music_sheet_name_" jdbcType="VARCHAR" property="musicSheetName"/>
  8. <result column="user_id_" jdbcType="BIGINT" property="userId"/>
  9. <result column="composer_" jdbcType="VARCHAR" property="composer"/>
  10. <result column="music_subject_" jdbcType="VARCHAR" property="musicSubject"/>
  11. <result column="audio_type_" jdbcType="VARCHAR" property="audioType"/>
  12. <result column="music_tag_" jdbcType="VARCHAR" property="musicTag"/>
  13. <result column="play_speed_" jdbcType="INTEGER" property="playSpeed"/>
  14. <result column="can_evaluate_" jdbcType="TINYINT" property="canEvaluate"/>
  15. <result column="show_fingering_" jdbcType="TINYINT" property="showFingering"/>
  16. <result column="charge_type_" jdbcType="TINYINT" property="chargeType"/>
  17. <result column="audit_status_" jdbcType="TINYINT" property="auditStatus"/>
  18. <result column="sort_number_" jdbcType="INTEGER" property="sortNumber"/>
  19. <result column="top_flag_" jdbcType="TINYINT" property="topFlag"/>
  20. <result column="hot_flag_" jdbcType="TINYINT" property="hotFlag"/>
  21. <result column="music_price_" jdbcType="DECIMAL" property="musicPrice"/>
  22. <result column="audio_file_url_" jdbcType="VARCHAR" property="audioFileUrl"/>
  23. <result column="xml_file_url_" jdbcType="VARCHAR" property="xmlFileUrl"/>
  24. <result column="has_beat_" jdbcType="TINYINT" property="hasBeat"/>
  25. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
  26. <result column="create_by_" jdbcType="BIGINT" property="createBy"/>
  27. <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
  28. <result column="update_by_" jdbcType="BIGINT" property="updateBy"/>
  29. <result column="remark_" jdbcType="VARCHAR" property="remark"/>
  30. </resultMap>
  31. <sql id="Base_Column_List">
  32. t.id_ as id ,
  33. t.music_sheet_name_ as musicSheetName,
  34. t.user_id_ as userId,
  35. t.composer_ as composer,
  36. t.music_subject_ as musicSubject,
  37. t.audio_type_ as audioType,
  38. t.music_tag_ as musicTag,
  39. t.play_speed_ as playSpeed,
  40. t.can_evaluate_ as canEvaluate,
  41. t.show_fingering_ as showFingering,
  42. t.charge_type_ as chargeType,
  43. t.state_ as state,
  44. t.audit_status_ as auditStatus,
  45. t.sort_number_ as sortNumber,
  46. t.top_flag_ as topFlag,
  47. t.hot_flag_ as hotFlag,
  48. t.music_price_ as musicPrice,
  49. t.audio_file_url_ as audioFileUrl,
  50. t.xml_file_url_ as xmlFileUrl,
  51. t.has_beat_ as hasBeat,
  52. t.mp3_type_ as mp3Type,
  53. t.create_time_ as createTime,
  54. t.create_by_ as createBy,
  55. t.update_time_ as updateTime,
  56. t.update_by_ as updateBy,
  57. t.del_flag_ as delFlag,
  58. t.audit_version_ as auditVersion,
  59. t.source_type_ as sourceType,
  60. t.submit_audit_time_ as submitAuditTime,
  61. t.remark_ as remark
  62. </sql>
  63. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  64. select <include refid="Base_Column_List"/>
  65. ,su.username_ as addName
  66. ,su.avatar_ as addUserAvatar
  67. ,(select group_concat(mt.name_) from music_tag mt
  68. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  69. ,(select group_concat(s.name_) from subject s
  70. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  71. from music_sheet t
  72. left join sys_user su on t.create_by_ = su.id_
  73. <where>
  74. <include refid="QueryInfo"/>
  75. </where>
  76. order by t.id_ desc
  77. </select>
  78. <sql id="QueryInfo">
  79. <if test="param.idAndName != null and param.idAndName != ''">
  80. and (t.id_ like concat('%',#{param.idAndName},'%') or
  81. t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  82. </if>
  83. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  84. and
  85. <foreach collection="param.musicTagIdList" separator="or" item="item">
  86. find_in_set(#{item},t.music_tag_)
  87. </foreach>
  88. </if>
  89. <if test="param.subjectIds != null and param.subjectIds != ''">
  90. and
  91. <foreach collection="param.subjectIdList" separator="or" item="item">
  92. find_in_set(#{item},t.music_subject_)
  93. </foreach>
  94. </if>
  95. <if test="param.state != null">
  96. and t.state_ = #{param.state}
  97. </if>
  98. <if test="param.auditStatus != null">
  99. and t.audit_status_ = #{param.auditStatus}
  100. </if>
  101. <if test="param.createBy != null">
  102. and t.create_by_ = #{param.createBy}
  103. </if>
  104. <if test="param.delFlag != null">
  105. and t.del_flag_ = #{param.delFlag}
  106. </if>
  107. <if test="param.sourceType != null">
  108. and t.source_type_ = #{param.sourceType}
  109. </if>
  110. <if test="param.chargeType != null">
  111. and t.charge_type_ = #{param.chargeType}
  112. </if>
  113. </sql>
  114. <select id="selectAlbumDetailPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  115. select distinct <include refid="Base_Column_List"/>
  116. ,(select group_concat(mt.name_) from music_tag mt
  117. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  118. ,(select group_concat(s.name_) from subject s
  119. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  120. from music_sheet t
  121. left join album_music_relate amr on t.id_ = amr.music_sheet_id_
  122. <where>
  123. <if test="param.idAndName != null and param.idAndName != ''">
  124. and (t.id_ like concat('%',#{param.idAndName},'%') or
  125. t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  126. </if>
  127. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  128. and
  129. <foreach collection="param.musicTagIdList" separator="and" item="item">
  130. find_in_set(#{item},t.music_tag_)
  131. </foreach>
  132. </if>
  133. <if test="param.subjectIds != null and param.subjectIds != ''">
  134. and
  135. <foreach collection="param.subjectIdList" separator="and" item="item">
  136. find_in_set(#{item},t.music_subject_)
  137. </foreach>
  138. </if>
  139. <if test="param.state != null">
  140. and t.state_ = #{param.state}
  141. </if>
  142. <if test="param.delFlag != null">
  143. and t.del_flag_ = #{param.delFlag}
  144. </if>
  145. <if test="param.id != null">
  146. <if test="param.type == 2">
  147. and amr.album_id_ = #{param.id}
  148. order by amr.create_time_ desc
  149. </if>
  150. <if test="param.type == 1">
  151. and t.id_ not in(select amr2.music_sheet_id_ from album_music_relate amr2
  152. where amr2.album_id_ = #{param.id})
  153. order by t.id_ desc
  154. </if>
  155. </if>
  156. </where>
  157. </select>
  158. <select id="detail" resultMap="DetailResultMap">
  159. SELECT
  160. <include refid="Base_Column_List"/>
  161. ,t.url_ as url
  162. ,t.midi_url_ as midiUrl
  163. ,t.metronome_url_ as metronomeUrl
  164. ,msa.id_ as accompanimentId
  165. ,msa.music_sheet_id_ as accompanimentMusicSheetId
  166. ,msa.music_subject_ as accompanimentMusicSubject
  167. ,msa.audio_file_url_ as accompanimentAudioFileUrl
  168. ,msa.sort_number_ as accompanimentSortNumber
  169. ,msa.create_time_ as accompanimentCreateTime
  170. ,msa.metronome_url_ as accompanimentMetronomeUrl
  171. ,msa.track_ as track
  172. ,su.username_ as userName
  173. ,su.avatar_ as userAvatar
  174. ,(select group_concat(mt.name_) from music_tag mt
  175. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  176. ,(select group_concat(s.name_) from subject s
  177. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0) as subjectNames
  178. FROM music_sheet t
  179. left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.id_
  180. left join sys_user su on t.create_by_ = su.id_
  181. where t.id_ = #{id}
  182. order by msa.sort_number_
  183. </select>
  184. <resultMap id="DetailResultMap" type="com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo">
  185. <id column="id" jdbcType="BIGINT" property="id"/>
  186. <result column="musicSheetName" jdbcType="VARCHAR" property="musicSheetName"/>
  187. <result column="userId" jdbcType="BIGINT" property="userId"/>
  188. <result column="composer" jdbcType="VARCHAR" property="composer"/>
  189. <result column="musicSubject" jdbcType="VARCHAR" property="musicSubject"/>
  190. <result column="audioType" jdbcType="VARCHAR" property="audioType"/>
  191. <result column="musicTag" jdbcType="VARCHAR" property="musicTag"/>
  192. <result column="playSpeed" jdbcType="INTEGER" property="playSpeed"/>
  193. <result column="canEvaluate" jdbcType="TINYINT" property="canEvaluate"/>
  194. <result column="showFingering" jdbcType="TINYINT" property="showFingering"/>
  195. <result column="chargeType" jdbcType="TINYINT" property="chargeType"/>
  196. <result column="auditStatus" jdbcType="TINYINT" property="auditStatus"/>
  197. <result column="state" jdbcType="TINYINT" property="state"/>
  198. <result column="sortNumber" jdbcType="INTEGER" property="sortNumber"/>
  199. <result column="topFlag" jdbcType="TINYINT" property="topFlag"/>
  200. <result column="hotFlag" jdbcType="TINYINT" property="hotFlag"/>
  201. <result column="musicPrice" jdbcType="DECIMAL" property="musicPrice"/>
  202. <result column="audioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  203. <result column="musicTagNames" jdbcType="VARCHAR" property="musicTagNames"/>
  204. <result column="subjectNames" jdbcType="VARCHAR" property="subjectNames"/>
  205. <result column="xmlFileUrl" jdbcType="VARCHAR" property="xmlFileUrl"/>
  206. <result column="hasBeat" jdbcType="TINYINT" property="hasBeat"/>
  207. <result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
  208. <result column="createBy" jdbcType="BIGINT" property="createBy"/>
  209. <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
  210. <result column="updateBy" jdbcType="BIGINT" property="updateBy"/>
  211. <result column="delFlag" jdbcType="BOOLEAN" property="delFlag"/>
  212. <result column="url" jdbcType="BOOLEAN" property="url"/>
  213. <result column="metronomeUrl" jdbcType="BOOLEAN" property="metronomeUrl"/>
  214. <result column="midiUrl" jdbcType="BOOLEAN" property="midiUrl"/>
  215. <result column="mp3Type" jdbcType="VARCHAR" property="mp3Type"/>
  216. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  217. <result column="userName" jdbcType="VARCHAR" property="userName"/>
  218. <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">
  219. <id column="accompanimentId" jdbcType="BIGINT" property="id"/>
  220. <result column="accompanimentMusicSheetId" jdbcType="BIGINT" property="musicSheetId"/>
  221. <result column="accompanimentMusicSubject" jdbcType="VARCHAR" property="musicSubject"/>
  222. <result column="accompanimentAudioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  223. <result column="accompanimentSortNumber" jdbcType="TINYINT" property="sortNumber"/>
  224. <result column="accompanimentCreateTime" jdbcType="TIMESTAMP" property="createTime"/>
  225. <result column="accompanimentMetronomeUrl" jdbcType="VARCHAR" property="metronomeUrl"/>
  226. <result column="track" jdbcType="VARCHAR" property="track"/>
  227. </collection>
  228. </resultMap>
  229. <select id="selectStudentMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  230. select <include refid="Base_Column_List"/>
  231. ,su.username_ as addName
  232. ,su.avatar_ as addUserAvatar
  233. ,(select group_concat(mt.name_) from music_tag mt
  234. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  235. ,(select group_concat(s.name_) from subject s
  236. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0) as subjectNames
  237. <if test="param.studentId != null">
  238. ,if(mf.id_ is not null,1,0) as favorite
  239. ,case when mspr.id_ is not null then 1
  240. when t.charge_type_ = 'FREE' then 1
  241. else 0 end as play
  242. </if>
  243. from music_sheet t
  244. left join sys_user su on t.create_by_ = su.id_
  245. <if test="param.studentId != null">
  246. left join music_sheet_purchase_record mspr
  247. on mspr.music_sheet_id_ = t.id_
  248. and mspr.student_id_ = #{param.studentId}
  249. and order_status_ = 'PAID'
  250. left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mf.user_id_ = #{param.studentId}
  251. </if>
  252. <where>
  253. <include refid="QueryInfo"/>
  254. <if test="param.auditVersion != null ">
  255. and #{param.auditVersion} = t.audit_version_
  256. </if>
  257. </where>
  258. order by t.id_ desc
  259. </select>
  260. <select id="selectMyMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  261. select <include refid="Base_Column_List"/>
  262. ,su.username_ as addName
  263. ,su.avatar_ as addUserAvatar
  264. ,(select group_concat(mt.name_) from music_tag mt
  265. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  266. ,(select group_concat(s.name_) from subject s
  267. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  268. from music_sheet t
  269. left join sys_user su on t.create_by_ = su.id_
  270. left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_
  271. <where>
  272. <include refid="QueryInfo"/>
  273. <if test="param.studentId != null">
  274. and mspr.student_id_ = #{param.studentId}
  275. and mspr.order_status_ = 'PAID'
  276. </if>
  277. </where>
  278. order by mspr.id_ desc
  279. </select>
  280. <select id="selectFavoriteMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  281. select <include refid="Base_Column_List"/>
  282. ,su.username_ as addName
  283. ,su.avatar_ as addUserAvatar
  284. ,(select group_concat(mt.name_) from music_tag mt
  285. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  286. ,(select group_concat(s.name_) from subject s
  287. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  288. ,if(mf.id_ is not null,1,0) as favorite
  289. from music_sheet t
  290. left join sys_user su on t.create_by_ = su.id_
  291. left join music_favorite mf on t.id_ = mf.music_sheet_id_
  292. <where>
  293. <include refid="QueryInfo"/>
  294. <if test="param.studentId != null">
  295. and mf.user_id_ = #{param.studentId}
  296. </if>
  297. </where>
  298. order by mf.id_ desc
  299. </select>
  300. <select id="selectPracticeMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  301. select <include refid="Base_Column_List"/>
  302. ,su.username_ as addName
  303. ,su.avatar_ as addUserAvatar
  304. ,(select group_concat(mt.name_) from music_tag mt
  305. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  306. ,(select group_concat(s.name_) from subject s where find_in_set(s.id_,t.music_subject_) ) as subjectNames
  307. from music_sheet t
  308. left join sys_user su on t.create_by_ = su.id_
  309. <where>
  310. <include refid="QueryInfo"/>
  311. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  312. and t.id_ in
  313. <foreach collection="practiceMusicIdList" item="item" open="(" close=")" separator=",">
  314. #{item}
  315. </foreach>
  316. </if>
  317. </where>
  318. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  319. order by field(t.id_,
  320. <foreach collection="practiceMusicIdList" item="item" separator=",">
  321. #{item}
  322. </foreach>
  323. </if>
  324. )
  325. </select>
  326. <select id="selectStudentOrderPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentMusicSheetOrderVo">
  327. select mspr.music_sheet_id_ as musicSheetId
  328. ,ms.music_sheet_name_ as musicSheetName
  329. ,ms.composer_ as composer
  330. ,ms.music_tag_ as musicTag
  331. ,(select group_concat(mt.name_) from music_tag mt
  332. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  333. ,mspr.purchase_price_ as purchasePrice
  334. ,mspr.order_no_ as orderNo
  335. ,mspr.purchase_time_ as purchaseTime
  336. from music_sheet_purchase_record mspr
  337. left join music_sheet ms on mspr.music_sheet_id_ = ms.id_
  338. <where>
  339. mspr.order_status_ = 'PAID'
  340. <if test="param.idAndName != null and param.idAndName != ''">
  341. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  342. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  343. </if>
  344. <if test="param.studentId != null">
  345. and mspr.student_id_ = #{param.studentId}
  346. </if>
  347. <if test="param.orderNo != null and param.orderNo != ''">
  348. and mspr.order_no_ = #{param.orderNo}
  349. </if>
  350. <if test="param.musicTagList != null and param.musicTagList.size() != 0">
  351. and
  352. <foreach collection="param.musicTagList" separator="and" item="item">
  353. find_in_set(#{item},ms.music_tag_)
  354. </foreach>
  355. </if>
  356. <if test="param.startTime != null">
  357. and mspr.purchase_time_ &gt; #{param.startTime}
  358. </if>
  359. <if test="param.endTime != null">
  360. and mspr.purchase_time_ &lt; #{param.endTime}
  361. </if>
  362. <if test="param.delFlag != null">
  363. and ms.del_flag_ = #{param.delFlag}
  364. </if>
  365. </where>
  366. order by mspr.id_ desc
  367. </select>
  368. <select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  369. select ms.id_ as musicSheetId
  370. ,ms.music_sheet_name_ as musicSheetName
  371. ,ms.composer_ as composer
  372. ,ms.music_tag_ as musicTag
  373. ,(select group_concat(mt.name_) from music_tag mt
  374. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  375. ,ms.play_speed_ as playSpeed
  376. ,ms.music_price_ as musicPrice
  377. ,ms.create_time_ as createTime
  378. ,ms.audit_status_ as auditStatus
  379. ,su.username_ as auditName
  380. from music_sheet ms
  381. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  382. left join sys_user su on msar.verify_user_id_ = su.id_
  383. <where>
  384. <if test="param.idAndName != null and param.idAndName != ''">
  385. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  386. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  387. or ms.composer_ like concat('%',#{param.idAndName},'%'))
  388. </if>
  389. <if test="param.teacherId != null">
  390. and ms.create_by_ = #{param.teacherId}
  391. </if>
  392. <if test="param.startTime != null">
  393. and ms.create_time_ &gt; #{param.startTime}
  394. </if>
  395. <if test="param.endTime != null">
  396. and ms.create_time_ &lt; #{param.endTime}
  397. </if>
  398. <if test="param.delFlag != null">
  399. and ms.del_flag_ = #{param.delFlag}
  400. </if>
  401. </where>
  402. order by ms.id_ desc
  403. </select>
  404. <select id="selectAuditPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  405. select
  406. ms.create_by_ as teacherId
  407. ,su.username_ as username
  408. ,su.phone_ as phone
  409. ,ms.id_ as musicSheetId
  410. ,ms.music_sheet_name_ as musicSheetName
  411. ,ms.composer_ as composer
  412. ,ms.music_tag_ as musicTag
  413. ,(select group_concat(mt.name_) from music_tag mt
  414. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  415. ,ms.play_speed_ as playSpeed
  416. ,ms.music_price_ as musicPrice
  417. ,ms.create_time_ as createTime
  418. ,ms.audit_status_ as auditStatus
  419. ,su.username_ as auditName
  420. from music_sheet ms
  421. left join sys_user su on su.id_ = ms.create_by_
  422. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  423. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  424. <where>
  425. ms.source_type_ = 'TEACHER'
  426. <if test="param.idAndName != null and param.idAndName != ''">
  427. and (su.id_ like concat('%',#{param.idAndName} ,'%')
  428. or su.username_ like concat('%',#{param.idAndName},'%')
  429. or su.phone_ like concat('%',#{param.idAndName},'%'))
  430. </if>
  431. <if test="param.auditName != null and param.auditName != ''">
  432. and su2.username_ like concat('%',#{param.auditName},'%')
  433. </if>
  434. <if test="param.authStatus != null">
  435. and ms.audit_status_ = #{param.authStatus}
  436. </if>
  437. <if test="param.startTime != null">
  438. and ms.create_time_ &gt; #{param.startTime}
  439. </if>
  440. <if test="param.endTime != null">
  441. and ms.create_time_ &lt; #{param.endTime}
  442. </if>
  443. <if test="param.delFlag != null">
  444. and ms.del_flag_ = #{param.delFlag}
  445. </if>
  446. <if test="param.chargeType != null">
  447. and ms.charge_type_ = #{param.chargeType}
  448. </if>
  449. </where>
  450. order by ms.submit_audit_time_ desc
  451. </select>
  452. <select id="selectTeacherMusicSheetCount" resultType="java.lang.Integer">
  453. select count(1)
  454. from music_sheet
  455. where user_id_ = #{userId}
  456. and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0
  457. </select>
  458. <select id="selectMusicNum" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo">
  459. select
  460. sum(if(ms.source_type_ = 'PLATFORM',1,0)) as musicSheetPlatformCount,
  461. sum(if(ms.source_type_ = 'TEACHER',1,0)) as musicSheetTeacherCount,
  462. count(1) as musicSheetCount
  463. from music_sheet ms
  464. where ms.state_ = 1 and ms.del_flag_ = 0 and ms.audit_status_ = 'PASS'
  465. </select>
  466. <select id="selectPayMusicSheet" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo$MusicSheetSmall">
  467. select distinct
  468. ms.id_ as musicSheetId,
  469. ms.music_sheet_name_ as musicSheetName,
  470. count(1) as num
  471. from music_sheet ms
  472. left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = ms.id_
  473. and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0 and mspr.order_status_ = 'PAID'
  474. group by ms.id_, ms.music_sheet_name_
  475. order by count(ms.id_)
  476. limit 5
  477. </select>
  478. </mapper>