MusicSheetMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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. <result column="auditVersion" jdbcType="VARCHAR" property="auditVersion"/>
  219. <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">
  220. <id column="accompanimentId" jdbcType="BIGINT" property="id"/>
  221. <result column="accompanimentMusicSheetId" jdbcType="BIGINT" property="musicSheetId"/>
  222. <result column="accompanimentMusicSubject" jdbcType="VARCHAR" property="musicSubject"/>
  223. <result column="accompanimentAudioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  224. <result column="accompanimentSortNumber" jdbcType="TINYINT" property="sortNumber"/>
  225. <result column="accompanimentCreateTime" jdbcType="TIMESTAMP" property="createTime"/>
  226. <result column="accompanimentMetronomeUrl" jdbcType="VARCHAR" property="metronomeUrl"/>
  227. <result column="track" jdbcType="VARCHAR" property="track"/>
  228. </collection>
  229. </resultMap>
  230. <select id="selectStudentMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  231. select <include refid="Base_Column_List"/>
  232. ,su.username_ as addName
  233. ,su.avatar_ as addUserAvatar
  234. ,(select group_concat(mt.name_) from music_tag mt
  235. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  236. ,(select group_concat(s.name_) from subject s
  237. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0) as subjectNames
  238. <if test="param.studentId != null">
  239. ,if(mf.id_ is not null,1,0) as favorite
  240. ,case when mspr.id_ is not null then 1
  241. when t.charge_type_ = 'FREE' then 1
  242. else 0 end as play
  243. </if>
  244. from music_sheet t
  245. left join sys_user su on t.create_by_ = su.id_
  246. <if test="param.studentId != null">
  247. left join music_sheet_purchase_record mspr
  248. on mspr.music_sheet_id_ = t.id_
  249. and mspr.student_id_ = #{param.studentId}
  250. and order_status_ = 'PAID'
  251. left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mf.user_id_ = #{param.studentId}
  252. </if>
  253. <where>
  254. <include refid="QueryInfo"/>
  255. <if test="param.auditVersion != null ">
  256. and #{param.auditVersion} = t.audit_version_
  257. </if>
  258. </where>
  259. order by t.id_ desc
  260. </select>
  261. <select id="selectMyMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  262. select <include refid="Base_Column_List"/>
  263. ,su.username_ as addName
  264. ,su.avatar_ as addUserAvatar
  265. ,(select group_concat(mt.name_) from music_tag mt
  266. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  267. ,(select group_concat(s.name_) from subject s
  268. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  269. from music_sheet t
  270. left join sys_user su on t.create_by_ = su.id_
  271. left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_
  272. <where>
  273. <include refid="QueryInfo"/>
  274. <if test="param.studentId != null">
  275. and mspr.student_id_ = #{param.studentId}
  276. and mspr.order_status_ = 'PAID'
  277. </if>
  278. </where>
  279. order by mspr.id_ desc
  280. </select>
  281. <select id="selectFavoriteMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  282. select <include refid="Base_Column_List"/>
  283. ,su.username_ as addName
  284. ,su.avatar_ as addUserAvatar
  285. ,(select group_concat(mt.name_) from music_tag mt
  286. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  287. ,(select group_concat(s.name_) from subject s
  288. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  289. ,if(mf.id_ is not null,1,0) as favorite
  290. from music_sheet t
  291. left join sys_user su on t.create_by_ = su.id_
  292. left join music_favorite mf on t.id_ = mf.music_sheet_id_
  293. <where>
  294. <include refid="QueryInfo"/>
  295. <if test="param.studentId != null">
  296. and mf.user_id_ = #{param.studentId}
  297. </if>
  298. </where>
  299. order by mf.id_ desc
  300. </select>
  301. <select id="selectPracticeMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  302. select <include refid="Base_Column_List"/>
  303. ,su.username_ as addName
  304. ,su.avatar_ as addUserAvatar
  305. ,(select group_concat(mt.name_) from music_tag mt
  306. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  307. ,(select group_concat(s.name_) from subject s where find_in_set(s.id_,t.music_subject_) ) as subjectNames
  308. from music_sheet t
  309. left join sys_user su on t.create_by_ = su.id_
  310. <where>
  311. <include refid="QueryInfo"/>
  312. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  313. and t.id_ in
  314. <foreach collection="practiceMusicIdList" item="item" open="(" close=")" separator=",">
  315. #{item}
  316. </foreach>
  317. </if>
  318. </where>
  319. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  320. order by field(t.id_,
  321. <foreach collection="practiceMusicIdList" item="item" separator=",">
  322. #{item}
  323. </foreach>
  324. </if>
  325. )
  326. </select>
  327. <select id="selectStudentOrderPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentMusicSheetOrderVo">
  328. select mspr.music_sheet_id_ as musicSheetId
  329. ,ms.music_sheet_name_ as musicSheetName
  330. ,ms.composer_ as composer
  331. ,ms.music_tag_ as musicTag
  332. ,(select group_concat(mt.name_) from music_tag mt
  333. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  334. ,mspr.purchase_price_ as purchasePrice
  335. ,mspr.order_no_ as orderNo
  336. ,mspr.purchase_time_ as purchaseTime
  337. from music_sheet_purchase_record mspr
  338. left join music_sheet ms on mspr.music_sheet_id_ = ms.id_
  339. <where>
  340. mspr.order_status_ = 'PAID'
  341. <if test="param.idAndName != null and param.idAndName != ''">
  342. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  343. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  344. </if>
  345. <if test="param.studentId != null">
  346. and mspr.student_id_ = #{param.studentId}
  347. </if>
  348. <if test="param.orderNo != null and param.orderNo != ''">
  349. and mspr.order_no_ = #{param.orderNo}
  350. </if>
  351. <if test="param.musicTagList != null and param.musicTagList.size() != 0">
  352. and
  353. <foreach collection="param.musicTagList" separator="and" item="item">
  354. find_in_set(#{item},ms.music_tag_)
  355. </foreach>
  356. </if>
  357. <if test="param.startTime != null">
  358. and mspr.purchase_time_ &gt; #{param.startTime}
  359. </if>
  360. <if test="param.endTime != null">
  361. and mspr.purchase_time_ &lt; #{param.endTime}
  362. </if>
  363. <if test="param.delFlag != null">
  364. and ms.del_flag_ = #{param.delFlag}
  365. </if>
  366. </where>
  367. order by mspr.id_ desc
  368. </select>
  369. <select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  370. select ms.id_ as musicSheetId
  371. ,ms.music_sheet_name_ as musicSheetName
  372. ,ms.composer_ as composer
  373. ,ms.music_tag_ as musicTag
  374. ,(select group_concat(mt.name_) from music_tag mt
  375. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  376. ,ms.play_speed_ as playSpeed
  377. ,ms.music_price_ as musicPrice
  378. ,ms.create_time_ as createTime
  379. ,ms.audit_status_ as auditStatus
  380. ,su.username_ as auditName
  381. from music_sheet ms
  382. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  383. left join sys_user su on msar.verify_user_id_ = su.id_
  384. <where>
  385. <if test="param.idAndName != null and param.idAndName != ''">
  386. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  387. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  388. or ms.composer_ like concat('%',#{param.idAndName},'%'))
  389. </if>
  390. <if test="param.teacherId != null">
  391. and ms.create_by_ = #{param.teacherId}
  392. </if>
  393. <if test="param.startTime != null">
  394. and ms.create_time_ &gt; #{param.startTime}
  395. </if>
  396. <if test="param.endTime != null">
  397. and ms.create_time_ &lt; #{param.endTime}
  398. </if>
  399. <if test="param.delFlag != null">
  400. and ms.del_flag_ = #{param.delFlag}
  401. </if>
  402. </where>
  403. order by ms.id_ desc
  404. </select>
  405. <select id="selectAuditPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  406. select
  407. ms.create_by_ as teacherId
  408. ,su.username_ as username
  409. ,su.phone_ as phone
  410. ,ms.id_ as musicSheetId
  411. ,ms.music_sheet_name_ as musicSheetName
  412. ,ms.composer_ as composer
  413. ,ms.music_tag_ as musicTag
  414. ,(select group_concat(mt.name_) from music_tag mt
  415. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames
  416. ,ms.play_speed_ as playSpeed
  417. ,ms.music_price_ as musicPrice
  418. ,ms.create_time_ as createTime
  419. ,ms.audit_status_ as auditStatus
  420. ,su.username_ as auditName
  421. from music_sheet ms
  422. left join sys_user su on su.id_ = ms.create_by_
  423. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  424. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  425. <where>
  426. ms.source_type_ = 'TEACHER'
  427. <if test="param.idAndName != null and param.idAndName != ''">
  428. and (su.id_ like concat('%',#{param.idAndName} ,'%')
  429. or su.username_ like concat('%',#{param.idAndName},'%')
  430. or su.phone_ like concat('%',#{param.idAndName},'%'))
  431. </if>
  432. <if test="param.auditName != null and param.auditName != ''">
  433. and su2.username_ like concat('%',#{param.auditName},'%')
  434. </if>
  435. <if test="param.authStatus != null">
  436. and ms.audit_status_ = #{param.authStatus}
  437. </if>
  438. <if test="param.startTime != null">
  439. and ms.create_time_ &gt; #{param.startTime}
  440. </if>
  441. <if test="param.endTime != null">
  442. and ms.create_time_ &lt; #{param.endTime}
  443. </if>
  444. <if test="param.delFlag != null">
  445. and ms.del_flag_ = #{param.delFlag}
  446. </if>
  447. <if test="param.chargeType != null">
  448. and ms.charge_type_ = #{param.chargeType}
  449. </if>
  450. </where>
  451. order by ms.submit_audit_time_ desc
  452. </select>
  453. <select id="selectTeacherMusicSheetCount" resultType="java.lang.Integer">
  454. select count(1)
  455. from music_sheet
  456. where user_id_ = #{userId}
  457. and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0
  458. </select>
  459. <select id="selectMusicNum" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo">
  460. select
  461. sum(if(ms.source_type_ = 'PLATFORM',1,0)) as musicSheetPlatformCount,
  462. sum(if(ms.source_type_ = 'TEACHER',1,0)) as musicSheetTeacherCount,
  463. count(1) as musicSheetCount
  464. from music_sheet ms
  465. where ms.state_ = 1 and ms.del_flag_ = 0 and ms.audit_status_ = 'PASS' and ms.charge_type_ = 'CHARGE'
  466. </select>
  467. <select id="selectPayMusicSheet" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo$MusicSheetSmall">
  468. SELECT
  469. ms.id_ as musicSheetId,
  470. ms.music_sheet_name_ as musicSheetName,
  471. count(DISTINCT pr.student_id_) as num
  472. FROM
  473. music_sheet ms
  474. LEFT JOIN music_sheet_purchase_record pr ON ms.id_ = pr.music_sheet_id_
  475. WHERE
  476. ms.del_flag_=0
  477. AND ms.charge_type_='CHARGE'
  478. AND ms.state_=1
  479. AND pr.order_status_='PAID'
  480. GROUP BY ms.id_
  481. ORDER BY count(DISTINCT pr.student_id_) DESC,ms.id_ desc
  482. limit 5
  483. </select>
  484. </mapper>