MusicSheetMapper.xml 46 KB

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