MusicSheetMapper.xml 46 KB

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