MusicSheetMapper.xml 46 KB

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