MusicSheetMapper.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  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="favorite_count_" jdbcType="INTEGER" property="favoriteCount"/>
  15. <result column="virtual_number_" property="virtualNumber" />
  16. <result column="first_pass_audit_time_" jdbcType="TIMESTAMP" property="firstPassAuditTime"/>
  17. <result column="can_evaluate_" jdbcType="TINYINT" property="canEvaluate"/>
  18. <result column="show_fingering_" jdbcType="TINYINT" property="showFingering"/>
  19. <result column="charge_type_" jdbcType="TINYINT" property="chargeType"/>
  20. <result column="audit_status_" jdbcType="TINYINT" property="auditStatus"/>
  21. <result column="sort_number_" jdbcType="INTEGER" property="sortNumber"/>
  22. <result column="top_flag_" jdbcType="TINYINT" property="topFlag"/>
  23. <result column="hot_flag_" jdbcType="TINYINT" property="hotFlag"/>
  24. <result column="exquisite_flag_" jdbcType="TINYINT" property="exquisiteFlag"/>
  25. <result column="music_price_" jdbcType="DECIMAL" property="musicPrice"/>
  26. <result column="audio_file_url_" jdbcType="VARCHAR" property="audioFileUrl"/>
  27. <result column="xml_file_url_" jdbcType="VARCHAR" property="xmlFileUrl"/>
  28. <result column="has_beat_" jdbcType="TINYINT" property="hasBeat"/>
  29. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
  30. <result column="create_by_" jdbcType="BIGINT" property="createBy"/>
  31. <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
  32. <result column="update_by_" jdbcType="BIGINT" property="updateBy"/>
  33. <result column="remark_" jdbcType="VARCHAR" property="remark"/>
  34. <result column="notation_" jdbcType="VARCHAR" property="notation"/>
  35. <result column="accompaniment_type_" jdbcType="VARCHAR" property="accompanimentType"/>
  36. <result column="title_img_" jdbcType="VARCHAR" property="titleImg"/>
  37. <result column="music_img_" jdbcType="VARCHAR" property="musicImg"/>
  38. <result column="first_tone_" jdbcType="VARCHAR" property="firstTone"/>
  39. <result column="fixed_tone_" jdbcType="VARCHAR" property="fixedTone"/>
  40. <result column="music_sheet_type_" jdbcType="VARCHAR" property="musicSheetType"/>
  41. <result column="provider_type_" jdbcType="VARCHAR" property="providerType"/>
  42. <result column="cbs_music_sheet_id_" property="cbsMusicSheetId"/>
  43. </resultMap>
  44. <sql id="Base_Column_List">
  45. t.id_ as id ,
  46. t.music_sheet_name_ as musicSheetName,
  47. t.user_id_ as userId,
  48. t.composer_ as composer,
  49. t.music_subject_ as musicSubject,
  50. t.audio_type_ as audioType,
  51. t.music_tag_ as musicTag,
  52. t.play_speed_ as playSpeed,
  53. t.favorite_count_ as favoriteCount,
  54. t.virtual_number_ as virtualNumber,
  55. t.first_pass_audit_time_ as firstPassAuditTime,
  56. t.can_evaluate_ as canEvaluate,
  57. t.show_fingering_ as showFingering,
  58. t.charge_type_ as chargeType,
  59. t.payment_type_ as paymentType,
  60. t.provider_type_ as providerType,
  61. t.state_ as state,
  62. t.audit_status_ as auditStatus,
  63. t.sort_number_ as sortNumber,
  64. t.top_flag_ as topFlag,
  65. t.exquisite_flag_ as exquisiteFlag,
  66. t.hot_flag_ as hotFlag,
  67. t.music_price_ as musicPrice,
  68. t.audio_file_url_ as audioFileUrl,
  69. t.xml_file_url_ as xmlFileUrl,
  70. t.has_beat_ as hasBeat,
  71. t.mp3_type_ as mp3Type,
  72. t.ext_config_json_ as extConfigJson,
  73. t.create_time_ as createTime,
  74. t.create_by_ as createBy,
  75. t.update_time_ as updateTime,
  76. t.update_by_ as updateBy,
  77. t.del_flag_ as delFlag,
  78. t.audit_version_ as auditVersion,
  79. t.source_type_ as sourceType,
  80. t.submit_audit_time_ as submitAuditTime,
  81. t.accompaniment_type_ as accompanimentType,
  82. t.remark_ as remark,
  83. t.first_tone_ as firstTone,
  84. t.fixed_tone_ as fixedTone,
  85. t.title_img_ as titleImg,
  86. t.reason_ as reason,
  87. t.music_img_ as musicImg,
  88. t.notation_ as notation,
  89. t.music_json_ as musicJSON,
  90. t.music_svg_ as musicSvg,
  91. t.music_jian_svg_ as musicJianSvg,
  92. t.music_first_svg_ as musicFirstSvg,
  93. t.music_sheet_type_ as musicSheetType,
  94. t.cbs_music_sheet_id_ as cbsMusicSheetId
  95. </sql>
  96. <insert id="batchInsert">
  97. insert into music_sheet
  98. (cbs_music_sheet_id_,provider_type_,music_tag_,payment_type_,charge_type_,top_flag_,exquisite_flag_,sort_number_,state_,audit_status_
  99. ,music_sheet_name_,music_subject_,music_svg_,composer_,accompaniment_type_,play_speed_,
  100. music_price_,notation_,music_sheet_type_,source_type_,audio_type_,show_fingering_,can_evaluate_,create_by_,user_id_
  101. )
  102. values
  103. <foreach collection="vos" item="item" separator=",">
  104. (#{item.musicSheetId},CASE WHEN #{item.availableType} = 'PLATFORM' THEN 'PLATFORM'
  105. WHEN #{item.availableType} = 'PERSON' THEN 'TEACHER' ELSE 'TENANT' END,
  106. #{item.musicTagIds},#{item.paymentType},#{item.paymentType},
  107. #{item.topFlag},#{item.exquisiteFlag},#{item.sortNo},0
  108. ,CASE WHEN #{item.delFlag} THEN 'PASS' ELSE 'DOING' END
  109. ,#{item.musicSheetUpdate.name},
  110. #{item.musicSheetUpdate.subjectIds},
  111. #{item.musicSheetUpdate.musicSvg},
  112. #{item.musicSheetUpdate.composer},
  113. #{item.musicSheetUpdate.audioType},
  114. #{item.musicSheetUpdate.playSpeed},
  115. #{item.musicSheetUpdate.musicPrice},
  116. #{item.musicSheetUpdate.notation},
  117. #{item.musicSheetUpdate.musicSheetType},
  118. CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  119. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER'
  120. ELSE 'TENANT' END,
  121. #{item.musicSheetUpdate.playMode},
  122. #{item.musicSheetUpdate.showFingering},
  123. #{item.musicSheetUpdate.canEvaluate},
  124. #{item.musicSheetUpdate.userId},#{item.musicSheetUpdate.userId}
  125. )
  126. </foreach>
  127. </insert>
  128. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  129. select <include refid="Base_Column_List"/>
  130. ,(select group_concat(mt.name_) from music_tag mt
  131. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  132. ,(select group_concat(s.name_) from subject s
  133. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  134. from music_sheet t
  135. left join sys_user su on t.create_by_ = su.id_
  136. <if test="param.sortByAlbumIdDesc != null">
  137. left join tenant_album_music tam on tam.music_sheet_id_ = t.id_ and tam.tenant_album_id_ = #{param.sortByAlbumIdDesc} and tam.del_flag_=0
  138. </if>
  139. <where>
  140. t.cbs_music_sheet_id_ IS NOT NULL
  141. <include refid="QueryInfo"/>
  142. <if test="param.auditVersion != null ">
  143. and #{param.auditVersion} = t.audit_version_
  144. </if>
  145. <if test="param.notation">
  146. AND t.notation_ = #{param.notation}
  147. </if>
  148. </where>
  149. order by
  150. <if test="param.sortByAlbumIdDesc != null">
  151. if(isnull(tam.id_),0,1),
  152. </if>
  153. <if test="param.myself == null or param.myself == false ">
  154. t.top_flag_ desc,t.sort_number_ desc,
  155. </if>
  156. t.cbs_music_sheet_id_ desc
  157. </select>
  158. <sql id="QueryInfo">
  159. <if test="param.musicSheetType != null">
  160. and t.music_sheet_type_ = #{param.musicSheetType}
  161. </if>
  162. <if test="param.idAndName != null and param.idAndName != ''">
  163. and (t.id_ like concat('%',#{param.idAndName},'%') or
  164. t.music_sheet_name_ like concat('%',#{param.idAndName},'%') or
  165. t.composer_ like concat ('%',#{param.idAndName},'%'))
  166. </if>
  167. <if test="param.search != null and param.search != ''">
  168. and (t.cbs_music_sheet_id_ like concat('%',#{param.search},'%') or
  169. t.music_sheet_name_ like concat('%',#{param.search},'%') or
  170. t.composer_ like concat ('%',#{param.search},'%'))
  171. </if>
  172. <if test="param.providerType != null">
  173. and t.provider_type_ = #{param.providerType}
  174. </if>
  175. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  176. and
  177. <foreach collection="param.musicTagIdList" open="(" close=")" separator="or" item="item">
  178. find_in_set(#{item},t.music_tag_)
  179. </foreach>
  180. </if>
  181. <if test="param.subjectIdList != null and param.subjectIdList.size() != 0">
  182. and(
  183. <foreach collection="param.subjectIdList" separator="or" item="item" open="(" close=")">
  184. find_in_set(#{item},t.music_subject_)
  185. </foreach>
  186. or t.music_subject_ is null or t.music_subject_ = '' or t.music_sheet_type_ = 'CONCERT'
  187. )
  188. </if>
  189. <if test="param.subjectIds != null and param.subjectIds != ''">
  190. and(find_in_set(#{param.subjectIds},t.music_subject_) or t.music_subject_ is null or t.music_subject_ = '' or t.music_sheet_type_ = 'CONCERT')
  191. </if>
  192. <if test="param.musicSheetIdlist != null and param.musicSheetIdlist.size() != 0">
  193. and t.id_ in
  194. <foreach collection="param.musicSheetIdlist" separator="," item="item" open="(" close=")">
  195. #{item}
  196. </foreach>
  197. </if>
  198. <if test="param.state != null">
  199. and t.state_ = #{param.state}
  200. </if>
  201. <if test="param.auditStatus != null">
  202. and t.audit_status_ = #{param.auditStatus}
  203. </if>
  204. <if test="param.createBy != null">
  205. and t.create_by_ = #{param.createBy}
  206. </if>
  207. <if test="param.delFlag != null">
  208. and t.del_flag_ = #{param.delFlag}
  209. </if>
  210. <if test="param.sourceType != null">
  211. and t.source_type_ = #{param.sourceType}
  212. </if>
  213. <if test="param.chargeType != null">
  214. and (FIND_IN_SET(#{param.chargeType}, t.payment_type_))
  215. </if>
  216. <if test="param.topFlag != null">
  217. and t.top_flag_ = #{param.topFlag}
  218. </if>
  219. <if test="param.exquisiteFlag != null">
  220. and t.exquisite_flag_ = #{param.exquisiteFlag}
  221. </if>
  222. <if test="param.accompanimentType != null">
  223. and t.accompaniment_type_ = #{param.accompanimentType}
  224. </if>
  225. <if test="param.audioType != null">
  226. and t.audio_type_ = #{param.audioType}
  227. </if>
  228. </sql>
  229. <select id="selectAlbumDetailPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  230. select distinct <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 and mt.state_ = 1) 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. ,amr.sort_number_ as albumSortNumber
  238. from music_sheet t
  239. left join album_music_relate amr on t.id_ = amr.music_sheet_id_
  240. left join sys_user su on t.create_by_ = su.id_
  241. <where>
  242. <if test="param.composer != null">
  243. AND t.composer_ LIKE '%${param.composer}%'
  244. </if>
  245. <if test="param.providerType != null">
  246. and t.provider_type_ = #{param.providerType}
  247. </if>
  248. <if test="param.idAndName != null and param.idAndName != ''">
  249. and (t.id_ like concat('%',#{param.idAndName},'%') or
  250. t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  251. </if>
  252. <if test="param.search != null and param.search != ''">
  253. and (t.cbs_music_sheet_id_ like concat('%',#{param.search},'%') or
  254. t.music_sheet_name_ like concat('%',#{param.search},'%'))
  255. </if>
  256. <if test="param.chargeType != null">
  257. and t.charge_type_ = #{param.chargeType}
  258. </if>
  259. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  260. and
  261. <foreach collection="param.musicTagIdList" separator="or" item="item" open="(" close=")" >
  262. find_in_set(#{item},t.music_tag_)
  263. </foreach>
  264. </if>
  265. <if test="param.subjectIdList != null and param.subjectIdList.size() != 0">
  266. and
  267. <foreach collection="param.subjectIdList" separator="or" item="item" open="(" close=")" >
  268. find_in_set(#{item},t.music_subject_)
  269. </foreach>
  270. </if>
  271. <if test="param.musicSheetType != null">
  272. and t.music_sheet_type_ = #{param.musicSheetType}
  273. </if>
  274. <if test="param.state != null">
  275. and t.state_ = #{param.state}
  276. </if>
  277. <if test="param.delFlag != null">
  278. and t.del_flag_ = #{param.delFlag}
  279. </if>
  280. <if test="param.sourceType != null">
  281. AND t.source_type_ = #{param.sourceType}
  282. </if>
  283. <if test="param.chargeType != null">
  284. AND (t.payment_type_ = 'FREE' OR FIND_IN_SET(#{param.chargeType}, t.payment_type_))
  285. </if>
  286. <if test="param.paymentTypes != null">
  287. AND t.payment_type_ IN (<foreach collection="param.paymentTypes" separator="," item="item">#{item}</foreach>)
  288. </if>
  289. <if test="param.id != null">
  290. <if test="param.type == 2">
  291. and amr.album_id_ = #{param.id}
  292. order by amr.sort_number_ desc, t.id_ desc
  293. </if>
  294. <if test="param.type == 1">
  295. and t.id_ not in(select amr2.music_sheet_id_ from album_music_relate amr2
  296. where amr2.album_id_ = #{param.id})
  297. order by t.id_ desc
  298. </if>
  299. </if>
  300. </where>
  301. </select>
  302. <select id="detail" resultMap="DetailResultMap">
  303. SELECT
  304. <include refid="Base_Column_List"/>
  305. ,t.url_ as url
  306. ,t.midi_url_ as midiUrl
  307. ,t.metronome_url_ as metronomeUrl
  308. ,msa.id_ as accompanimentId
  309. ,msa.music_sheet_id_ as accompanimentMusicSheetId
  310. ,msa.audio_file_url_ as accompanimentAudioFileUrl
  311. ,msa.sort_number_ as accompanimentSortNumber
  312. ,msa.create_time_ as accompanimentCreateTime
  313. ,msa.track_ as track
  314. ,su.username_ as userName
  315. ,su.avatar_ as userAvatar
  316. ,(
  317. select group_concat(mt.name_) from music_tag mt
  318. where find_in_set(mt.id_,t.music_tag_)
  319. and mt.del_flag_ = 0 and mt.state_ = 1
  320. ) as musicTagNames
  321. ,s2.name_ as subjectNames
  322. ,s2.code_ as code
  323. ,su.real_name_ as realName
  324. ,s2.ai_default_frequency_ as aiDefaultFrequency
  325. FROM music_sheet t
  326. left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.id_
  327. left join sys_user su on t.create_by_ = su.id_
  328. left join subject s2 on t.music_subject_ = s2.id_
  329. where t.id_ = #{id}
  330. order by msa.sort_number_
  331. </select>
  332. <resultMap id="DetailResultMap" type="com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo">
  333. <id column="id" jdbcType="BIGINT" property="id"/>
  334. <result column="musicSheetName" jdbcType="VARCHAR" property="musicSheetName"/>
  335. <result column="userId" jdbcType="BIGINT" property="userId"/>
  336. <result column="cbsMusicSheetId" jdbcType="BIGINT" property="cbsMusicSheetId"/>
  337. <result column="composer" jdbcType="VARCHAR" property="composer"/>
  338. <result column="titleImg" jdbcType="VARCHAR" property="titleImg"/>
  339. <result column="musicSubject" jdbcType="VARCHAR" property="musicSubject"/>
  340. <result column="audioType" jdbcType="VARCHAR" property="audioType"/>
  341. <result column="providerType" jdbcType="VARCHAR" property="providerType"/>
  342. <result column="musicTag" jdbcType="VARCHAR" property="musicTag"/>
  343. <result column="playSpeed" jdbcType="INTEGER" property="playSpeed"/>
  344. <result column="canEvaluate" jdbcType="TINYINT" property="canEvaluate"/>
  345. <result column="showFingering" jdbcType="TINYINT" property="showFingering"/>
  346. <result column="chargeType" jdbcType="TINYINT" property="chargeType"/>
  347. <result column="auditStatus" property="auditStatus"/>
  348. <result column="state" jdbcType="TINYINT" property="state"/>
  349. <result column="sortNumber" jdbcType="INTEGER" property="sortNumber"/>
  350. <result column="topFlag" jdbcType="TINYINT" property="topFlag"/>
  351. <result column="hotFlag" jdbcType="TINYINT" property="hotFlag"/>
  352. <result column="musicPrice" jdbcType="DECIMAL" property="musicPrice"/>
  353. <result column="audioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  354. <result column="musicTagNames" jdbcType="VARCHAR" property="musicTagNames"/>
  355. <result column="subjectNames" jdbcType="VARCHAR" property="subjectNames"/>
  356. <result column="xmlFileUrl" jdbcType="VARCHAR" property="xmlFileUrl"/>
  357. <result column="hasBeat" jdbcType="TINYINT" property="hasBeat"/>
  358. <result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
  359. <result column="createBy" jdbcType="BIGINT" property="createBy"/>
  360. <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
  361. <result column="updateBy" jdbcType="BIGINT" property="updateBy"/>
  362. <result column="delFlag" jdbcType="BOOLEAN" property="delFlag"/>
  363. <result column="url" jdbcType="BOOLEAN" property="url"/>
  364. <result column="metronomeUrl" jdbcType="BOOLEAN" property="metronomeUrl"/>
  365. <result column="midiUrl" jdbcType="BOOLEAN" property="midiUrl"/>
  366. <result column="mp3Type" jdbcType="VARCHAR" property="mp3Type"/>
  367. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  368. <result column="userName" jdbcType="VARCHAR" property="userName"/>
  369. <result column="auditVersion" jdbcType="VARCHAR" property="auditVersion"/>
  370. <result column="code" jdbcType="VARCHAR" property="code"/>
  371. <result column="reason" jdbcType="VARCHAR" property="reason"/>
  372. <result column="accompanimentType" jdbcType="VARCHAR" property="accompanimentType"/>
  373. <result column="notation" jdbcType="VARCHAR" property="notation"/>
  374. <result column="musicImg" jdbcType="VARCHAR" property="musicImg"/>
  375. <result column="favoriteCount" jdbcType="VARCHAR" property="favoriteCount"/>
  376. <result column="firstPassAuditTime" jdbcType="VARCHAR" property="firstPassAuditTime"/>
  377. <result column="realName" jdbcType="VARCHAR" property="realName"/>
  378. <result column="auditTime" jdbcType="VARCHAR" property="auditTime"/>
  379. <result column="auditName" jdbcType="VARCHAR" property="auditName"/>
  380. <result column="auditReason" jdbcType="VARCHAR" property="auditReason"/>
  381. <result column="aiDefaultFrequency" jdbcType="VARCHAR" property="aiDefaultFrequency"/>
  382. <result column="musicJSON" jdbcType="VARCHAR" property="musicJSON"/>
  383. <result column="musicSvg" jdbcType="VARCHAR" property="musicSvg"/>
  384. <result column="musicJianSvg" jdbcType="VARCHAR" property="musicJianSvg"/>
  385. <result column="musicFirstSvg" jdbcType="VARCHAR" property="musicFirstSvg"/>
  386. <result column="musicSheetType" jdbcType="VARCHAR" property="musicSheetType"/>
  387. <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">
  388. <id column="accompanimentId" jdbcType="BIGINT" property="id"/>
  389. <result column="accompanimentMusicSheetId" jdbcType="BIGINT" property="musicSheetId"/>
  390. <result column="accompanimentMusicSubject" jdbcType="VARCHAR" property="musicSubjectId"/>
  391. <result column="accompanimentAudioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  392. <result column="accompanimentSortNumber" jdbcType="TINYINT" property="sortNumber"/>
  393. <result column="accompanimentCreateTime" jdbcType="TIMESTAMP" property="createTime"/>
  394. <result column="accompanimentMetronomeUrl" jdbcType="VARCHAR" property="metronomeUrl"/>
  395. <result column="track" jdbcType="VARCHAR" property="track"/>
  396. </collection>
  397. </resultMap>
  398. <select id="selectStudentMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  399. select <include refid="Base_Column_List"/>
  400. ,su.username_ as addName
  401. ,su.avatar_ as addUserAvatar
  402. from music_sheet t
  403. left join sys_user su on t.create_by_ = su.id_
  404. <where>
  405. su.del_flag_ = 0
  406. <include refid="QueryInfo"/>
  407. <if test="param.auditVersion != null ">
  408. and #{param.auditVersion} = t.audit_version_
  409. </if>
  410. </where>
  411. order by
  412. <choose>
  413. <when test="param.musicSortType != null and param.musicSortType.code == 'TOP'">
  414. t.top_flag_ desc, t.sort_number_ desc,
  415. </when>
  416. <when test="param.musicSortType != null and param.musicSortType.code == 'HOT'">
  417. t.favorite_count_ desc,
  418. </when>
  419. <when test="param.musicSortType != null and param.musicSortType.code == 'NEW'">
  420. t.first_pass_audit_time_ desc,
  421. </when>
  422. <otherwise>
  423. <if test="param.myself == null or param.myself == false ">
  424. t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc,
  425. </if>
  426. </otherwise>
  427. </choose>
  428. t.id_ desc
  429. </select>
  430. <select id="selectMyMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  431. select distinct <include refid="Base_Column_List"/>
  432. ,su.username_ as addName
  433. ,su.avatar_ as addUserAvatar
  434. ,(select group_concat(mt.name_) from music_tag mt
  435. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  436. ,(select group_concat(s.name_) from subject s
  437. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  438. ,if(mf.id_ is not null,1,0) as favorite
  439. from music_sheet t
  440. left join sys_user su on t.create_by_ = su.id_
  441. left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_
  442. left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mspr.student_id_ = mf.user_id_
  443. <where>
  444. <include refid="QueryInfo"/>
  445. <if test="param.studentId != null">
  446. and mspr.student_id_ = #{param.studentId}
  447. and mspr.order_status_ = 'PAID'
  448. </if>
  449. <if test="param.userType != null">
  450. and mspr.client_type_ = #{param.userType}
  451. </if>
  452. <if test="param.purchaseType != null">
  453. AND mspr.purchase_type_ = #{param.purchaseType}
  454. </if>
  455. <if test="param.courseGift != null">
  456. AND mspr.course_music_album_id_ <choose><when test="param.courseGift == 0"> = </when><otherwise> > </otherwise> </choose> 0
  457. </if>
  458. </where>
  459. order by mspr.id_ desc
  460. </select>
  461. <select id="selectFavoriteMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  462. select <include refid="Base_Column_List"/>
  463. ,su.username_ as addName
  464. ,su.avatar_ as addUserAvatar
  465. ,(select group_concat(mt.name_) from music_tag mt
  466. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  467. ,(select group_concat(s.name_) from subject s
  468. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  469. ,if(mf.id_ is not null,1,0) as favorite
  470. from music_sheet t
  471. left join sys_user su on t.create_by_ = su.id_
  472. left join music_favorite mf on t.id_ = mf.music_sheet_id_
  473. <where>
  474. su.del_flag_ = 0
  475. <include refid="QueryInfo"/>
  476. <if test="clientType != null">
  477. AND mf.client_type_ = #{clientType}
  478. </if>
  479. <if test="param.studentId != null">
  480. and mf.user_id_ = #{param.studentId}
  481. </if>
  482. </where>
  483. order by mf.id_ desc
  484. </select>
  485. <select id="selectPracticeMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  486. select <include refid="Base_Column_List"/>
  487. ,su.username_ as addName
  488. ,su.avatar_ as addUserAvatar
  489. ,(select group_concat(mt.name_) from music_tag mt
  490. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  491. ,(select group_concat(s.name_) from subject s where find_in_set(s.id_,t.music_subject_) ) as subjectNames
  492. ,if(mf.id_ is not null,1,0) as favorite
  493. from sys_music_compare_record mspr
  494. left join music_sheet t on mspr.music_sheet_id_ = t.id_
  495. left join sys_user su on t.create_by_ = su.id_
  496. left join music_favorite mf on (t.id_ = mf.music_sheet_id_ and mspr.user_id_ = mf.user_id_ <if test="param.clientType != null"> AND mf.client_type_ = #{param.clientType}</if> )
  497. <where>
  498. su.del_flag_ = 0
  499. <include refid="QueryInfo"/>
  500. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  501. and mspr.id_ in
  502. <foreach collection="practiceMusicIdList" item="item" open="(" close=")" separator=",">
  503. #{item}
  504. </foreach>
  505. </if>
  506. </where>
  507. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  508. order by field(mspr.id_,
  509. <foreach collection="practiceMusicIdList" item="item" separator=",">
  510. #{item}
  511. </foreach>
  512. </if>
  513. )
  514. </select>
  515. <select id="selectStudentOrderPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentMusicSheetOrderVo">
  516. select distinct mspr.music_sheet_id_ as musicSheetId
  517. ,ms.music_sheet_name_ as musicSheetName
  518. ,ms.composer_ as composer
  519. ,ms.title_img_ as titleImg
  520. ,ms.music_tag_ as musicTag
  521. ,(select group_concat(mt.name_) from music_tag mt
  522. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  523. ,mspr.purchase_price_ as purchasePrice
  524. ,mspr.order_no_ as orderNo
  525. ,mspr.purchase_time_ as purchaseTime
  526. from music_sheet_purchase_record mspr
  527. left join music_sheet ms on mspr.music_sheet_id_ = ms.id_
  528. <where>
  529. mspr.order_status_ = 'PAID' and mspr.purchase_type_ = 'MUSIC'
  530. <if test="param.idAndName != null and param.idAndName != ''">
  531. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  532. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  533. </if>
  534. <if test="param.studentId != null">
  535. and mspr.student_id_ = #{param.studentId}
  536. </if>
  537. <if test="param.orderNo != null and param.orderNo != ''">
  538. and mspr.order_no_ = #{param.orderNo}
  539. </if>
  540. <if test="param.musicTagList != null and param.musicTagList.size() != 0">
  541. and
  542. <foreach collection="param.musicTagList" separator="or" item="item" open="(" close=")" >
  543. find_in_set(#{item},ms.music_tag_)
  544. </foreach>
  545. </if>
  546. <if test="param.startTime != null">
  547. and mspr.purchase_time_ &gt; #{param.startTime}
  548. </if>
  549. <if test="param.endTime != null">
  550. and mspr.purchase_time_ &lt; #{param.endTime}
  551. </if>
  552. </where>
  553. order by mspr.id_ desc
  554. </select>
  555. <select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  556. select ms.id_ as musicSheetId
  557. ,ms.music_sheet_name_ as musicSheetName
  558. ,ms.composer_ as composer
  559. ,ms.title_img_ as titleImg
  560. ,ms.accompaniment_type_ as accompanimentType
  561. ,ms.music_tag_ as musicTag
  562. ,(select group_concat(mt.name_) from music_tag mt
  563. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  564. ,ms.play_speed_ as playSpeed
  565. ,ms.music_price_ as musicPrice
  566. ,ms.create_time_ as createTime
  567. ,ms.audit_status_ as auditStatus
  568. ,su.username_ as auditName
  569. from music_sheet ms
  570. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  571. left join sys_user su on msar.verify_user_id_ = su.id_
  572. <where>
  573. <if test="param.idAndName != null and param.idAndName != ''">
  574. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  575. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  576. or ms.composer_ like concat('%',#{param.idAndName},'%'))
  577. </if>
  578. <if test="param.teacherId != null">
  579. and ms.create_by_ = #{param.teacherId} and ms.source_type_ = 'TEACHER'
  580. </if>
  581. <if test="param.startTime != null">
  582. and ms.create_time_ &gt; #{param.startTime}
  583. </if>
  584. <if test="param.endTime != null">
  585. and ms.create_time_ &lt; #{param.endTime}
  586. </if>
  587. <if test="param.delFlag != null">
  588. and ms.del_flag_ = #{param.delFlag}
  589. </if>
  590. </where>
  591. order by ms.id_ desc
  592. </select>
  593. <select id="selectAuditPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  594. select
  595. msar.id_ as authMusicSheetId,
  596. ms.create_by_ as teacherId
  597. ,ms.exquisite_flag_ as exquisiteFlag
  598. ,ms.title_img_ as titleImg
  599. ,ms.accompaniment_type_ as accompanimentType
  600. ,su.username_ as username
  601. ,su.real_name_ as realName
  602. ,su.phone_ as phone
  603. ,ms.id_ as musicSheetId
  604. ,ms.music_sheet_name_ as musicSheetName
  605. ,ms.composer_ as composer
  606. ,ms.music_tag_ as musicTag
  607. ,(select group_concat(mt.name_) from music_tag mt
  608. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  609. ,ms.play_speed_ as playSpeed
  610. ,ms.music_price_ as musicPrice
  611. ,ms.update_time_ as createTime
  612. ,if(msar.audit_state_ is null,ms.audit_status_,msar.audit_state_) as auditStatus
  613. ,su2.username_ as auditName
  614. ,msar.first_auth_ as firstAuth
  615. from music_sheet_auth_record msar
  616. left join music_sheet ms on ms.id_ = msar.music_sheet_id_
  617. left join sys_user su on su.id_ = ms.create_by_
  618. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  619. <where>
  620. su.del_flag_ = 0 and
  621. ms.source_type_ = 'TEACHER'
  622. <if test="param.idAndName != null and param.idAndName != ''">
  623. and (su.id_ like concat('%',#{param.idAndName} ,'%')
  624. or su.username_ like concat('%',#{param.idAndName},'%')
  625. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  626. or su.phone_ like concat('%',#{param.idAndName},'%'))
  627. </if>
  628. <if test="param.auditName != null and param.auditName != ''">
  629. and su2.username_ like concat('%',#{param.auditName},'%')
  630. </if>
  631. <if test="param.authStatus != null">
  632. and msar.audit_state_ = #{param.authStatus}
  633. </if>
  634. <if test="param.startTime != null">
  635. and ms.create_time_ &gt; #{param.startTime}
  636. </if>
  637. <if test="param.endTime != null">
  638. and ms.create_time_ &lt; #{param.endTime}
  639. </if>
  640. <if test="param.chargeType != null">
  641. and ms.charge_type_ = #{param.chargeType}
  642. </if>
  643. <if test="param.firstAuth != null">
  644. and msar.first_auth_ = #{param.firstAuth}
  645. </if>
  646. <if test="param.exquisiteFlag != null">
  647. and ms.exquisite_flag_ = #{param.exquisiteFlag}
  648. </if>
  649. </where>
  650. order by field(ms.audit_status_,'DOING') desc, ms.submit_audit_time_ desc
  651. </select>
  652. <select id="selectTeacherMusicSheetCount" resultType="java.lang.Integer">
  653. select count(1)
  654. from music_sheet
  655. where user_id_ = #{userId}
  656. and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0 and source_type_ = 'TEACHER'
  657. </select>
  658. <select id="selectMusicNum" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo">
  659. select
  660. sum(if(ms.source_type_ = 'PLATFORM',1,0)) as musicSheetPlatformCount,
  661. sum(if(ms.source_type_ = 'TEACHER',1,0)) as musicSheetTeacherCount,
  662. count(1) as musicSheetCount
  663. from music_sheet ms
  664. where ms.state_ = 1 and ms.del_flag_ = 0 and ms.audit_status_ = 'PASS' and find_in_set('CHARGE',ms.payment_type_)
  665. </select>
  666. <select id="selectPayMusicSheet" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo$MusicSheetSmall">
  667. SELECT
  668. ms.id_ as musicSheetId,
  669. ms.music_sheet_name_ as musicSheetName,
  670. count(DISTINCT pr.student_id_) as num
  671. FROM
  672. music_sheet ms
  673. LEFT JOIN music_sheet_purchase_record pr ON ms.id_ = pr.music_sheet_id_
  674. WHERE
  675. ms.del_flag_=0
  676. AND ms.charge_type_='CHARGE'
  677. AND ms.state_=1
  678. AND pr.order_status_='PAID'
  679. GROUP BY ms.id_
  680. ORDER BY count(DISTINCT pr.student_id_) DESC,ms.id_ desc
  681. limit 5
  682. </select>
  683. <select id="selectTeacherCount" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherAuditMusicSheetVo">
  684. select
  685. sum(if(t.audit_status_ = 'DOING',1,0)) as doing,
  686. sum(if(t.audit_status_ = 'PASS'
  687. and t.state_ = 1,1,0)) as pass,
  688. sum(if(t.audit_status_ = 'UNPASS',1,0)) as upPass
  689. from
  690. music_sheet t
  691. where t.user_id_ = #{userId}
  692. </select>
  693. <select id="queryStudentTotal" resultType="com.yonge.cooleshow.biz.dal.vo.StudentTotalVo">
  694. select
  695. t.user_id_ as userId,
  696. a.musicAlbumNum,
  697. b.musicSheetNum
  698. from student t
  699. left join (
  700. select
  701. user_id_, count(1) as musicAlbumNum
  702. from album_favorite
  703. <where>
  704. <if test="null != userId">
  705. and user_id_ = #{userId}
  706. </if>
  707. </where>
  708. group by user_id_
  709. ) a on t.user_id_ = a.user_id_
  710. left join (
  711. select
  712. user_id_, count(1) as musicSheetNum
  713. from music_favorite
  714. <where>
  715. <if test="null != userId">
  716. and user_id_ = #{userId}
  717. </if>
  718. </where>
  719. group by user_id_
  720. ) b on t.user_id_ = b.user_id_
  721. <where>
  722. <if test="null != userId">
  723. and t.user_id_ = #{userId}
  724. </if>
  725. </where>
  726. </select>
  727. <select id="queryTeacherTotal" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo">
  728. select
  729. t.user_id_ as userId,
  730. a.musicSheetNum as musicSheetNum
  731. from teacher t
  732. left join (
  733. select
  734. user_id_, count(1) as musicSheetNum
  735. from music_sheet
  736. where source_type_ = 'TEACHER' and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0
  737. <if test="null != userId">
  738. and user_id_ = #{userId}
  739. </if>
  740. group by user_id_
  741. ) a on t.user_id_ = a.user_id_
  742. <where>
  743. <if test="null != userId">
  744. and t.user_id_ = #{userId}
  745. </if>
  746. </where>
  747. </select>
  748. <select id="auditDetailList" resultMap="DetailResultMap">
  749. SELECT
  750. <include refid="Base_Column_List"/>
  751. ,t.url_ as url
  752. ,t.midi_url_ as midiUrl
  753. ,t.metronome_url_ as metronomeUrl
  754. ,su.username_ as userName
  755. ,su.avatar_ as userAvatar
  756. ,s2.name_ as subjectNames
  757. ,s2.code_ as code
  758. ,s2.ai_default_frequency_ as aiDefaultFrequency
  759. ,su.real_name_ as realName
  760. ,msar.update_time_ as auditTime
  761. ,su2.username_ as auditName
  762. ,msar.reason_ as auditReason
  763. from music_sheet_auth_record msar
  764. left join music_sheet t on t.id_ = msar.music_sheet_id_
  765. left join sys_user su on su.id_ = t.create_by_
  766. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  767. left join subject s2 on t.music_subject_ = s2.id_
  768. <where>
  769. <if test="musicSheetId != null">
  770. and #{musicSheetId} = msar.music_sheet_id_
  771. </if>
  772. <if test="batchNo != null and batchNo != ''">
  773. and #{batchNo} = msar.batch_no_
  774. </if>
  775. </where>
  776. order by msar.id_ desc
  777. </select>
  778. <!--单曲专辑数量统计-->
  779. <select id="selectMusicAlbumStatInfo" resultType="com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper">
  780. SELECT t1.music_sheet_id_ AS id, COUNT(DISTINCT t1.id_) AS total
  781. FROM album_music_relate t1 JOIN music_sheet t2 ON (t1.music_sheet_id_ = t2.id_)
  782. <where>
  783. <if test="musicIds != null">
  784. AND t1.music_sheet_id_ IN (<foreach collection="musicIds" separator="," item="item">#{item}</foreach>)
  785. </if>
  786. </where>
  787. GROUP BY t1.music_sheet_id_
  788. </select>
  789. <update id="updateFavoriteCount">
  790. update music_sheet set favorite_count_ =
  791. <choose>
  792. <when test="state.code == 0">
  793. favorite_count_ - 1
  794. </when>
  795. <when test="state.code == 1">
  796. favorite_count_ + 1
  797. </when>
  798. <otherwise>
  799. favorite_count_
  800. </otherwise>
  801. </choose>
  802. where id_ = #{musicSheetId}
  803. </update>
  804. <update id="updateBatchByCbsId">
  805. <foreach collection="vos" item="item" index="index" separator=";">
  806. update music_sheet ms set ms.provider_type_ = CASE WHEN #{item.availableType} = 'PLATFORM' THEN 'PLATFORM'
  807. WHEN #{item.availableType} = 'PERSON' THEN 'TEACHER' ELSE 'TENANT' END,
  808. ms.music_tag_ = #{item.musicTagIds},ms.payment_type_ = #{item.paymentType},
  809. ms.charge_type_ = #{item.paymentType},
  810. ms.music_price_ = #{item.musicPrice},ms.top_flag_ = #{item.topFlag},
  811. ms.exquisite_flag_ = #{item.exquisiteFlag},ms.sort_number_ = #{item.sortNo},ms.del_flag_ = 0,
  812. ms.audit_status_ = CASE WHEN #{item.delFlag} THEN 'PASS' ELSE 'DOING' END,
  813. ms.state_ = #{item.status}
  814. <if test="item.musicSheetUpdate != null">
  815. ,ms.music_sheet_name_ = #{item.musicSheetUpdate.name},
  816. ms.music_subject_ = #{item.musicSheetUpdate.subjectIds},
  817. ms.music_svg_ = #{item.musicSheetUpdate.musicSvg},
  818. ms.composer_ = #{item.musicSheetUpdate.composer},
  819. ms.accompaniment_type_ = #{item.musicSheetUpdate.audioType},
  820. ms.play_speed_ = #{item.musicSheetUpdate.playSpeed},
  821. ms.music_price_ = #{item.musicSheetUpdate.musicPrice},
  822. ms.notation_ = #{item.musicSheetUpdate.notation},
  823. ms.music_sheet_type_ = #{item.musicSheetUpdate.musicSheetType},
  824. ms.create_by_ = #{item.musicSheetUpdate.userId},
  825. ms.audio_type_ = #{item.musicSheetUpdate.playMode},
  826. ms.notation_ = #{item.musicSheetUpdate.notation},
  827. ms.show_fingering_ = #{item.musicSheetUpdate.showFingering},
  828. ms.can_evaluate_ = #{item.musicSheetUpdate.canEvaluate},
  829. ms.source_type_ = CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  830. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER'
  831. ELSE 'TENANT' END
  832. </if>
  833. where ms.cbs_music_sheet_id_ = #{item.musicSheetId}
  834. </foreach>
  835. </update>
  836. <update id="batchEnable">
  837. update music_sheet set state_ = #{status} where FIND_IN_SET(cbs_music_sheet_id_,#{ids})
  838. </update>
  839. <update id="batchDel">
  840. update music_sheet set del_flag_ = 1 where FIND_IN_SET(cbs_music_sheet_id_,#{ids})
  841. </update>
  842. <update id="updateMusicSheet">
  843. update music_sheet
  844. set music_sheet_name_ = #{param.name},music_subject_ = #{param.subjectIds},music_svg_ = #{param.musicSvg},
  845. composer_ = #{param.composer},title_img_ = #{param.musicCover},music_img_ = #{param.musicCover},accompaniment_type_ = #{param.audioType},
  846. play_speed_ = #{param.playSpeed},music_price_ = #{param.musicPrice},notation_ = #{param.notation},
  847. music_sheet_type_ = #{param.musicSheetType},source_type_ = CASE WHEN #{param.sourceType} = 'PLATFORM' THEN 'PLATFORM' ELSE 'TEACHER' END,
  848. create_by_ = #{param.userId},audit_status_ = 'PASS'
  849. where cbs_music_sheet_id_ = #{param.id}
  850. </update>
  851. <select id="countByUser" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetUploadCountVo">
  852. select user_id_ userId, count(id_) count
  853. from music_sheet
  854. where del_flag_ = false and state_ =1 and source_type_ = 'TEACHER' and user_id_ in
  855. <foreach collection="userIds" open="(" close=")" separator="," item="item">
  856. #{item}
  857. </foreach>
  858. group by user_id_
  859. </select>
  860. <select id="searchMusic" resultType="java.lang.Long">
  861. select t.id_ from music_sheet t
  862. <if test="param.tenantAlbumIds != null and param.tenantAlbumIds.size() != 0">
  863. left join tenant_album_music tam on t.id_ = tam.music_sheet_id_
  864. </if>
  865. <where>
  866. t.state_=1 and t.audit_version_ = 0 and t.del_flag_ = 0 and t.audit_status_ = 'PASS'
  867. <if test="param.subjectId != null">
  868. and ( t.music_subject_ = #{param.subjectId} or t.music_subject_ is null or t.music_subject_ = '' or t.music_sheet_type_ = 'CONCERT')
  869. </if>
  870. <if test="param.name != null and param.name != ''">
  871. and t.music_sheet_name_ like concat('%',#{param.name},'%')
  872. </if>
  873. <if test="param.tenantAlbumIds != null and param.tenantAlbumIds.size() != 0">
  874. and tam.tenant_album_id_ in
  875. <foreach collection="param.tenantAlbumIds" item="item" open="(" close=")" separator=",">
  876. #{item}
  877. </foreach>
  878. and tam.del_flag_=0
  879. and tam.subject_type_ in ('ENSEMBLE', 'MUSIC', 'SUBJECT')
  880. </if>
  881. <if test="param.providerType != null">
  882. and t.provider_type_ = #{param.providerType}
  883. </if>
  884. </where>
  885. order by t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc
  886. </select>
  887. <select id="searchAlbum" resultType="java.lang.Long">
  888. select id_ from music_album t
  889. <where>
  890. t.album_status_=1 and del_flag_=0 and audit_version_ = 0
  891. <if test="param.subjectId != null">
  892. and ( t.subject_id_ = #{param.subjectId} or t.subject_id_ is null or t.subject_id_ = '')
  893. </if>
  894. <if test="param.name != null and param.name != ''">
  895. and t.album_name_ like concat('%',#{param.name},'%')
  896. </if>
  897. </where>
  898. order by t.sort_number_ desc
  899. </select>
  900. <select id="personOwnerList"
  901. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  902. select su.id_ userId,su.username_ username
  903. ,'TEACHER' clientType,su.phone_ phone from teacher t
  904. left join sys_user su ON su.id_ = t.user_id_
  905. where su.user_type_ LIKE '%TEACHER%' AND su.del_flag_ = 0 AND su.lock_flag_ = 0 AND t.lock_flag_ = 0
  906. <if test="param.name != null and param.name != ''">
  907. AND (su.phone_ LIKE CONCAT('%',#{param.name},'%') OR su.username_ LIKE CONCAT('%',#{param.name},'%'))
  908. </if>
  909. <if test="param.userIdList != null and param.userIdList.size > 0">
  910. AND su.id_ IN
  911. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  912. #{item}
  913. </foreach>
  914. </if>
  915. </select>
  916. <select id="orgOwnerList"
  917. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  918. select id_ organizationRoleId,name_ organizationRole,'ORG' clientType,phone_ phone from tenant_info where enable_flag_ = 1
  919. <if test="param.name != null and param.name != ''">
  920. AND (phone_ LIKE CONCAT('%',#{param.name},'%') OR name_ LIKE CONCAT('%',#{param.name},'%'))
  921. </if>
  922. <if test="param.userIdList != null and param.userIdList.size > 0">
  923. AND id_ IN
  924. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  925. #{item}
  926. </foreach>
  927. </if>
  928. </select>
  929. <select id="get" resultType="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
  930. select <include refid="Base_Column_List"/>
  931. from music_sheet t
  932. where t.id_ = #{id}
  933. </select>
  934. <select id="selectSyncPage" resultType="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
  935. select *
  936. from music_sheet
  937. where del_flag_ = 0 and audit_status_ = 'PASS' and id_ = 22
  938. </select>
  939. <!--单曲专辑数量统计-->
  940. </mapper>