MusicSheetMapper.xml 45 KB

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