MusicSheetMapper.xml 46 KB

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