MusicSheetMapper.xml 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  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. <result column="score_type_" property="scoreType"/>
  44. <result column="tenant_sort_number_" property="tenantSortNumber"/>
  45. <result column="tenant_state_" property="tenantState"/>
  46. <result column="tenant_notation_" property="tenantNotation"/>
  47. <result column="tenant_category_id_" property="tenantCategoryId"/>
  48. <result column="tenant_score_type_" property="tenantScoreType"/>
  49. <result column="tenant_del_flag_" property="tenantCategoryId"/>
  50. </resultMap>
  51. <sql id="Base_Column_List">
  52. t.id_ as id ,
  53. t.music_sheet_name_ as musicSheetName,
  54. t.user_id_ as userId,
  55. t.composer_ as composer,
  56. t.music_subject_ as musicSubject,
  57. t.audio_type_ as audioType,
  58. t.music_tag_ as musicTag,
  59. t.play_speed_ as playSpeed,
  60. t.favorite_count_ as favoriteCount,
  61. t.virtual_number_ as virtualNumber,
  62. t.first_pass_audit_time_ as firstPassAuditTime,
  63. t.can_evaluate_ as canEvaluate,
  64. t.show_fingering_ as showFingering,
  65. t.charge_type_ as chargeType,
  66. t.payment_type_ as paymentType,
  67. t.provider_type_ as providerType,
  68. t.state_ as state,
  69. t.client_state_ as clientState,
  70. t.platform_state_ as platformState,
  71. t.sort_number_ as sortNumber,
  72. t.top_flag_ as topFlag,
  73. t.exquisite_flag_ as exquisiteFlag,
  74. t.hot_flag_ as hotFlag,
  75. t.music_price_ as musicPrice,
  76. t.audio_file_url_ as audioFileUrl,
  77. t.xml_file_url_ as xmlFileUrl,
  78. t.has_beat_ as hasBeat,
  79. t.mp3_type_ as mp3Type,
  80. t.ext_config_json_ as extConfigJson,
  81. t.create_time_ as createTime,
  82. t.create_by_ as createBy,
  83. t.update_time_ as updateTime,
  84. t.update_by_ as updateBy,
  85. t.del_flag_ as delFlag,
  86. t.audit_version_ as auditVersion,
  87. t.source_type_ as sourceType,
  88. t.accompaniment_type_ as accompanimentType,
  89. t.remark_ as remark,
  90. t.first_tone_ as firstTone,
  91. t.fixed_tone_ as fixedTone,
  92. t.title_img_ as titleImg,
  93. t.reason_ as reason,
  94. t.music_img_ as musicImg,
  95. t.notation_ as notation,
  96. t.music_json_ as musicJSON,
  97. t.music_svg_ as musicSvg,
  98. t.music_jian_svg_ as musicJianSvg,
  99. t.music_first_svg_ as musicFirstSvg,
  100. t.music_sheet_type_ as musicSheetType,
  101. t.audit_status_ as auditStatus,
  102. t.submit_audit_time_ as submitAuditTime,
  103. t.cbs_music_sheet_id_ as cbsMusicSheetId,
  104. t.score_type_ as scoreType,
  105. t.tenant_sort_number_ as tenantSortNumber,
  106. t.tenant_state_ as tenantState,
  107. t.tenant_notation_ as tenantNotation,
  108. t.tenant_category_id_ as tenantCategoryId,
  109. t.tenant_score_type_ as tenantScoreType,
  110. t.tenant_del_flag_ as tenantDelFlag
  111. </sql>
  112. <insert id="batchInsert">
  113. insert into music_sheet
  114. (cbs_music_sheet_id_,music_tag_,payment_type_,charge_type_,top_flag_,exquisite_flag_,sort_number_,state_,audit_status_
  115. ,music_sheet_name_,music_subject_,music_svg_,composer_,accompaniment_type_,play_speed_,
  116. music_price_,notation_,music_sheet_type_,source_type_,provider_type_,audio_type_,show_fingering_,
  117. can_evaluate_,create_by_,user_id_,score_type_,is_all_subject_,first_pass_audit_time_
  118. )
  119. values
  120. <foreach collection="vos" item="item" separator=",">
  121. (#{item.musicSheetId},
  122. #{item.musicTagIds},#{item.paymentType},#{item.paymentType},
  123. #{item.topFlag},#{item.exquisiteFlag},#{item.sortNo},0
  124. ,'PASS'
  125. ,#{item.musicSheetUpdate.name},
  126. #{item.musicSheetUpdate.subjectIds},
  127. #{item.musicSheetUpdate.musicSvg},
  128. #{item.musicSheetUpdate.composer},
  129. #{item.musicSheetUpdate.audioType},
  130. #{item.musicSheetUpdate.playSpeed},
  131. #{item.musicSheetUpdate.musicPrice},
  132. #{item.isConvertibleScore},
  133. #{item.musicSheetUpdate.musicSheetType},
  134. CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  135. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER'
  136. ELSE 'TENANT' END,
  137. CASE WHEN #{item.availableType} = 'PLATFORM' THEN 'PLATFORM' ELSE 'TENANT' END,
  138. #{item.musicSheetUpdate.playMode},
  139. #{item.musicSheetUpdate.showFingering},
  140. #{item.musicSheetUpdate.canEvaluate},
  141. #{item.musicSheetUpdate.userId},#{item.musicSheetUpdate.userId},
  142. #{item.scoreType},#{item.musicSheetUpdate.isAllSubject},now()
  143. )
  144. </foreach>
  145. </insert>
  146. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  147. select <include refid="Base_Column_List"/>
  148. from music_sheet t
  149. left join sys_user su on t.create_by_ = su.id_
  150. <if test="param.sortByAlbumIdDesc != null">
  151. 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
  152. </if>
  153. <if test="param.auditStatus != null">
  154. left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
  155. </if>
  156. <where>
  157. 1=1
  158. <if test="param.clientState != null">
  159. and t.client_state_ = #{param.clientState}
  160. </if>
  161. <if test="param.platformState != null">
  162. and t.platform_state_ = #{param.platformState}
  163. </if>
  164. <if test="param.excludeMusicIds != null and param.excludeMusicIds.size() != 0">
  165. and t.id_ not in
  166. <foreach collection="param.excludeMusicIds" separator="," item="item" open="(" close=")">
  167. #{item}
  168. </foreach>
  169. </if>
  170. <if test="param.mustMatchSubjectIds != null and param.mustMatchSubjectIds.size() != 0">
  171. and
  172. <foreach collection="param.mustMatchSubjectIds" separator="and" item="item" open="(" close=")">
  173. find_in_set(#{item},t.music_subject_)
  174. </foreach>
  175. </if>
  176. <include refid="QueryInfo"/>
  177. <if test="param.auditStatus == null">
  178. AND t.cbs_music_sheet_id_ IS NOT NULL
  179. </if>
  180. <if test="param.tenantCategoryIds != null and param.tenantCategoryIds.size() != 0">
  181. and t.tenant_category_id_ in
  182. <foreach collection="param.tenantCategoryIds" separator="," item="item" open="(" close=")">
  183. #{item}
  184. </foreach>
  185. </if>
  186. <if test="param.auditVersion != null ">
  187. and #{param.auditVersion} = t.audit_version_
  188. </if>
  189. <if test="param.notation">
  190. AND t.notation_ = #{param.notation}
  191. </if>
  192. </where>
  193. <if test="param.auditStatus != null">
  194. group by msar.music_sheet_id_
  195. </if>
  196. order by
  197. <if test="param.sortByAlbumIdDesc != null">
  198. if(isnull(tam.id_),0,1),
  199. </if>
  200. <if test="param.myself == null or param.myself == false ">
  201. t.top_flag_ desc,t.sort_number_ desc,
  202. </if>
  203. t.cbs_music_sheet_id_ desc
  204. </select>
  205. <sql id="QueryInfo">
  206. <if test="param.musicSheetType != null">
  207. and t.music_sheet_type_ = #{param.musicSheetType}
  208. </if>
  209. <if test="param.idAndName != null and param.idAndName != ''">
  210. <if test="param.auditStatus != null">
  211. AND ((su.id_ like concat('%',#{param.idAndName} ,'%')
  212. or su.username_ like concat('%',#{param.idAndName},'%')
  213. or su.phone_ like concat('%',#{param.idAndName},'%')) OR
  214. (t.music_sheet_name_ like concat('%',#{param.idAndName},'%') AND msar.last_audit_state_ = 'PASS') OR
  215. (JSON_UNQUOTE(JSON_EXTRACT(music_sheet_json_, '$.name')) LIKE CONCAT('%',#{param.idAndName},'%') AND msar.last_audit_state_ != 'PASS'))
  216. </if>
  217. <if test="param.auditStatus == null">
  218. AND (su.id_ like concat('%',#{param.idAndName} ,'%')
  219. or su.username_ like concat('%',#{param.idAndName},'%')
  220. or su.phone_ like concat('%',#{param.idAndName},'%') OR
  221. t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  222. </if>
  223. </if>
  224. <if test="param.search != null and param.search != ''">
  225. and (t.cbs_music_sheet_id_ like concat('%',#{param.search},'%') or
  226. t.music_sheet_name_ like concat('%',#{param.search},'%') or
  227. t.composer_ like concat ('%',#{param.search},'%'))
  228. </if>
  229. <if test="param.providerType != null">
  230. and find_in_set(#{param.providerType},t.provider_type_)
  231. </if>
  232. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  233. and
  234. <foreach collection="param.musicTagIdList" open="(" close=")" separator="or" item="item">
  235. find_in_set(#{item},t.music_tag_)
  236. </foreach>
  237. </if>
  238. <if test="param.subjectIdList != null and param.subjectIdList.size() != 0">
  239. and(
  240. <foreach collection="param.subjectIdList" separator="or" item="item" open="(" close=")">
  241. find_in_set(#{item},t.music_subject_)
  242. </foreach>
  243. or t.music_subject_ is null or t.music_subject_ = '' OR t.is_all_subject_
  244. )
  245. </if>
  246. <if test="param.subjectIds != null and param.subjectIds != ''">
  247. and(find_in_set(#{param.subjectIds},t.music_subject_) or t.music_subject_ is null or t.music_subject_ = '' OR t.is_all_subject_)
  248. </if>
  249. <if test="param.musicSheetIdlist != null and param.musicSheetIdlist.size() != 0">
  250. and t.id_ in
  251. <foreach collection="param.musicSheetIdlist" separator="," item="item" open="(" close=")">
  252. #{item}
  253. </foreach>
  254. </if>
  255. <if test="param.state != null">
  256. <if test="param.providerType != null">
  257. <if test="param.providerType.code == 'TENANT'">
  258. and t.tenant_state_ = #{param.state}
  259. </if>
  260. <if test="param.providerType.code == 'PLATFORM'">
  261. and t.state_ = #{param.state}
  262. </if>
  263. </if>
  264. <if test="param.providerType == null">
  265. and t.state_ = #{param.state}
  266. </if>
  267. </if>
  268. <if test="param.auditStatus != null">
  269. and msar.last_audit_state_ = #{param.auditStatus}
  270. </if>
  271. <if test="param.scoreType != null">
  272. and t.score_type_ = #{param.scoreType}
  273. </if>
  274. <if test="param.createBy != null">
  275. and t.create_by_ = #{param.createBy}
  276. </if>
  277. <if test="param.delFlag != null">
  278. <if test="param.providerType != null">
  279. <if test="param.providerType.code == 'TENANT'">
  280. and t.tenant_del_flag_ = #{param.delFlag}
  281. </if>
  282. <if test="param.providerType.code == 'PLATFORM'">
  283. and t.del_flag_ = #{param.delFlag}
  284. </if>
  285. </if>
  286. <if test="param.providerType == null">
  287. and t.del_flag_ = #{param.delFlag}
  288. </if>
  289. </if>
  290. <if test="param.sourceType != null">
  291. and t.source_type_ = #{param.sourceType}
  292. </if>
  293. <if test="param.chargeType != null">
  294. and (FIND_IN_SET(#{param.chargeType}, t.payment_type_))
  295. </if>
  296. <if test="param.topFlag != null">
  297. and t.top_flag_ = #{param.topFlag}
  298. </if>
  299. <if test="param.exquisiteFlag != null">
  300. and t.exquisite_flag_ = #{param.exquisiteFlag}
  301. </if>
  302. <if test="param.accompanimentType != null">
  303. and t.accompaniment_type_ = #{param.accompanimentType}
  304. </if>
  305. <if test="param.audioType != null">
  306. and t.audio_type_ = #{param.audioType}
  307. </if>
  308. </sql>
  309. <select id="selectAlbumDetailPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  310. select distinct <include refid="Base_Column_List"/>
  311. ,su.username_ as addName
  312. ,su.avatar_ as addUserAvatar
  313. ,(select group_concat(mt.name_) from music_tag mt
  314. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  315. ,(select group_concat(s.name_) from subject s
  316. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  317. ,amr.sort_number_ as albumSortNumber
  318. from music_sheet t
  319. left join album_music_relate amr on t.id_ = amr.music_sheet_id_
  320. left join sys_user su on t.create_by_ = su.id_
  321. <where>
  322. t.cbs_music_sheet_id_ IS NOT NULL and find_in_set('PLATFORM',t.provider_type_)
  323. <if test="param.composer != null">
  324. AND t.composer_ LIKE '%${param.composer}%'
  325. </if>
  326. <if test="param.providerType != null">
  327. and find_in_set(#{param.providerType},t.provider_type_)
  328. </if>
  329. <if test="param.idAndName != null and param.idAndName != ''">
  330. and (t.id_ like concat('%',#{param.idAndName},'%') or
  331. t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  332. </if>
  333. <if test="param.search != null and param.search != ''">
  334. and (t.cbs_music_sheet_id_ like concat('%',#{param.search},'%') or
  335. t.music_sheet_name_ like concat('%',#{param.search},'%'))
  336. </if>
  337. <if test="param.chargeType != null">
  338. and t.charge_type_ = #{param.chargeType}
  339. </if>
  340. <if test="param.excludeMusicIds != null and param.excludeMusicIds.size() != 0">
  341. and t.id_ not in
  342. <foreach collection="param.excludeMusicIds" separator="," item="item" open="(" close=")">
  343. #{item}
  344. </foreach>
  345. </if>
  346. <if test="param.musicTagIds != null and param.musicTagIds != ''">
  347. and
  348. <foreach collection="param.musicTagIdList" separator="or" item="item" open="(" close=")" >
  349. find_in_set(#{item},t.music_tag_)
  350. </foreach>
  351. </if>
  352. <if test="param.subjectIdList != null and param.subjectIdList.size() != 0">
  353. and
  354. <foreach collection="param.subjectIdList" separator="or" item="item" open="(" close=")" >
  355. find_in_set(#{item},t.music_subject_)
  356. </foreach>
  357. </if>
  358. <if test="param.musicSheetType != null">
  359. and t.music_sheet_type_ = #{param.musicSheetType}
  360. </if>
  361. <if test="param.state != null">
  362. and t.state_ = #{param.state}
  363. </if>
  364. <if test="param.delFlag != null">
  365. and t.del_flag_ = #{param.delFlag}
  366. </if>
  367. <if test="param.sourceType != null">
  368. AND t.source_type_ = #{param.sourceType}
  369. </if>
  370. <if test="param.chargeType != null">
  371. AND (t.payment_type_ = 'FREE' OR FIND_IN_SET(#{param.chargeType}, t.payment_type_))
  372. </if>
  373. <if test="param.paymentTypes != null">
  374. AND t.payment_type_ IN (<foreach collection="param.paymentTypes" separator="," item="item">#{item}</foreach>)
  375. </if>
  376. <if test="param.id != null">
  377. <if test="param.type == 2">
  378. and amr.album_id_ = #{param.id}
  379. order by amr.sort_number_ desc,
  380. CONVERT(t.music_sheet_name_ USING gbk) COLLATE gbk_chinese_ci,
  381. t.music_sheet_name_ COLLATE utf8mb4_bin,
  382. t.music_sheet_name_ REGEXP '^[0-9]' DESC, t.create_time_ DESC
  383. </if>
  384. <if test="param.type == 1">
  385. and t.id_ not in(select amr2.music_sheet_id_ from album_music_relate amr2
  386. where amr2.album_id_ = #{param.id})
  387. ORDER BY CONVERT(t.music_sheet_name_ USING gbk) COLLATE gbk_chinese_ci,
  388. t.music_sheet_name_ COLLATE utf8mb4_bin,
  389. t.music_sheet_name_ REGEXP '^[0-9]' DESC, t.create_time_ DESC
  390. </if>
  391. </if>
  392. <if test="param.id == null">
  393. ORDER BY CONVERT(t.music_sheet_name_ USING gbk) COLLATE gbk_chinese_ci,
  394. t.music_sheet_name_ COLLATE utf8mb4_bin,
  395. t.music_sheet_name_ REGEXP '^[0-9]' DESC, t.create_time_ DESC
  396. </if>
  397. </where>
  398. </select>
  399. <select id="detail" resultMap="DetailResultMap">
  400. SELECT
  401. <include refid="Base_Column_List"/>
  402. ,t.url_ as url
  403. ,t.midi_url_ as midiUrl
  404. ,t.metronome_url_ as metronomeUrl
  405. ,msa.id_ as accompanimentId
  406. ,msa.music_sheet_id_ as accompanimentMusicSheetId
  407. ,msa.audio_file_url_ as accompanimentAudioFileUrl
  408. ,msa.sort_number_ as accompanimentSortNumber
  409. ,msa.create_time_ as accompanimentCreateTime
  410. ,msa.track_ as track
  411. ,msa.musical_instrument_id_ as musicalInstrumentId
  412. ,su.username_ as userName
  413. ,su.avatar_ as userAvatar
  414. ,(
  415. select group_concat(mt.name_) from music_tag mt
  416. where find_in_set(mt.id_,t.music_tag_)
  417. and mt.del_flag_ = 0 and mt.state_ = 1
  418. ) as musicTagNames
  419. ,s2.name_ as subjectNames
  420. ,s2.code_ as code
  421. ,su.real_name_ as realName
  422. ,s2.ai_default_frequency_ as aiDefaultFrequency
  423. FROM music_sheet t
  424. left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.id_
  425. left join sys_user su on t.create_by_ = su.id_
  426. left join subject s2 on t.music_subject_ = s2.id_
  427. where t.id_ = #{id} AND t.cbs_music_sheet_id_ IS NOT NULL
  428. order by msa.sort_number_
  429. </select>
  430. <resultMap id="DetailResultMap" type="com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo">
  431. <id column="id" jdbcType="BIGINT" property="id"/>
  432. <result column="musicSheetName" jdbcType="VARCHAR" property="musicSheetName"/>
  433. <result column="userId" jdbcType="BIGINT" property="userId"/>
  434. <result column="cbsMusicSheetId" jdbcType="BIGINT" property="cbsMusicSheetId"/>
  435. <result column="composer" jdbcType="VARCHAR" property="composer"/>
  436. <result column="titleImg" jdbcType="VARCHAR" property="titleImg"/>
  437. <result column="musicSubject" jdbcType="VARCHAR" property="musicSubject"/>
  438. <result column="audioType" jdbcType="VARCHAR" property="audioType"/>
  439. <result column="providerType" jdbcType="VARCHAR" property="providerType"/>
  440. <result column="musicTag" jdbcType="VARCHAR" property="musicTag"/>
  441. <result column="playSpeed" jdbcType="INTEGER" property="playSpeed"/>
  442. <result column="canEvaluate" jdbcType="TINYINT" property="canEvaluate"/>
  443. <result column="showFingering" jdbcType="TINYINT" property="showFingering"/>
  444. <result column="chargeType" jdbcType="TINYINT" property="chargeType"/>
  445. <result column="auditStatus" property="auditStatus"/>
  446. <result column="state" jdbcType="TINYINT" property="state"/>
  447. <result column="sortNumber" jdbcType="INTEGER" property="sortNumber"/>
  448. <result column="topFlag" jdbcType="TINYINT" property="topFlag"/>
  449. <result column="hotFlag" jdbcType="TINYINT" property="hotFlag"/>
  450. <result column="musicPrice" jdbcType="DECIMAL" property="musicPrice"/>
  451. <result column="audioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  452. <result column="musicTagNames" jdbcType="VARCHAR" property="musicTagNames"/>
  453. <result column="subjectNames" jdbcType="VARCHAR" property="subjectNames"/>
  454. <result column="xmlFileUrl" jdbcType="VARCHAR" property="xmlFileUrl"/>
  455. <result column="hasBeat" jdbcType="TINYINT" property="hasBeat"/>
  456. <result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
  457. <result column="createBy" jdbcType="BIGINT" property="createBy"/>
  458. <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
  459. <result column="updateBy" jdbcType="BIGINT" property="updateBy"/>
  460. <result column="delFlag" jdbcType="BOOLEAN" property="delFlag"/>
  461. <result column="url" jdbcType="BOOLEAN" property="url"/>
  462. <result column="metronomeUrl" jdbcType="BOOLEAN" property="metronomeUrl"/>
  463. <result column="midiUrl" jdbcType="BOOLEAN" property="midiUrl"/>
  464. <result column="mp3Type" jdbcType="VARCHAR" property="mp3Type"/>
  465. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  466. <result column="userName" jdbcType="VARCHAR" property="userName"/>
  467. <result column="auditVersion" jdbcType="VARCHAR" property="auditVersion"/>
  468. <result column="code" jdbcType="VARCHAR" property="code"/>
  469. <result column="reason" jdbcType="VARCHAR" property="reason"/>
  470. <result column="accompanimentType" jdbcType="VARCHAR" property="accompanimentType"/>
  471. <result column="notation" jdbcType="VARCHAR" property="notation"/>
  472. <result column="musicImg" jdbcType="VARCHAR" property="musicImg"/>
  473. <result column="favoriteCount" jdbcType="VARCHAR" property="favoriteCount"/>
  474. <result column="firstPassAuditTime" jdbcType="VARCHAR" property="firstPassAuditTime"/>
  475. <result column="realName" jdbcType="VARCHAR" property="realName"/>
  476. <result column="auditTime" jdbcType="VARCHAR" property="auditTime"/>
  477. <result column="auditName" jdbcType="VARCHAR" property="auditName"/>
  478. <result column="auditReason" jdbcType="VARCHAR" property="auditReason"/>
  479. <result column="aiDefaultFrequency" jdbcType="VARCHAR" property="aiDefaultFrequency"/>
  480. <result column="musicJSON" jdbcType="VARCHAR" property="musicJSON"/>
  481. <result column="musicSvg" jdbcType="VARCHAR" property="musicSvg"/>
  482. <result column="musicJianSvg" jdbcType="VARCHAR" property="musicJianSvg"/>
  483. <result column="musicFirstSvg" jdbcType="VARCHAR" property="musicFirstSvg"/>
  484. <result column="musicSheetType" jdbcType="VARCHAR" property="musicSheetType"/>
  485. <result column="musicSheetJson" jdbcType="VARCHAR" property="musicSheetJson"/>
  486. <result column="tenantSortNumber" jdbcType="VARCHAR" property="tenantSortNumber"/>
  487. <result column="tenantState" jdbcType="VARCHAR" property="tenantState"/>
  488. <result column="tenantNotation" jdbcType="VARCHAR" property="tenantNotation"/>
  489. <result column="tenantCategoryId" jdbcType="VARCHAR" property="tenantCategoryId"/>
  490. <result column="tenantScoreType" jdbcType="VARCHAR" property="tenantScoreType"/>
  491. <result column="tenantDelFlag" jdbcType="VARCHAR" property="tenantDelFlag"/>
  492. <result column="scoreType" jdbcType="VARCHAR" property="scoreType"/>
  493. <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">
  494. <id column="accompanimentId" jdbcType="BIGINT" property="id"/>
  495. <result column="accompanimentMusicSheetId" jdbcType="BIGINT" property="musicSheetId"/>
  496. <result column="accompanimentMusicSubject" jdbcType="VARCHAR" property="musicSubjectId"/>
  497. <result column="accompanimentAudioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>
  498. <result column="accompanimentSortNumber" jdbcType="TINYINT" property="sortNumber"/>
  499. <result column="accompanimentCreateTime" jdbcType="TIMESTAMP" property="createTime"/>
  500. <result column="accompanimentMetronomeUrl" jdbcType="VARCHAR" property="metronomeUrl"/>
  501. <result column="track" jdbcType="VARCHAR" property="track"/>
  502. <result column="musicalInstrumentId" jdbcType="VARCHAR" property="musicalInstrumentId"/>
  503. </collection>
  504. </resultMap>
  505. <select id="selectStudentMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  506. select <include refid="Base_Column_List"/>
  507. ,su.username_ as addName
  508. ,su.avatar_ as addUserAvatar
  509. from music_sheet t
  510. left join sys_user su on t.create_by_ = su.id_
  511. <if test="param.auditStatus != null">
  512. left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
  513. </if>
  514. <where>
  515. 1=1
  516. <include refid="QueryInfo"/>
  517. <if test="param.auditVersion != null ">
  518. and #{param.auditVersion} = t.audit_version_
  519. </if>
  520. </where>
  521. <if test="param.auditStatus != null">
  522. group by msar.music_sheet_id_
  523. </if>
  524. order by
  525. <choose>
  526. <when test="param.musicSortType != null and param.musicSortType.code == 'TOP'">
  527. t.top_flag_ desc, t.sort_number_ desc,
  528. </when>
  529. <when test="param.musicSortType != null and param.musicSortType.code == 'HOT'">
  530. t.favorite_count_ desc,
  531. </when>
  532. <when test="param.musicSortType != null and param.musicSortType.code == 'NEW'">
  533. t.first_pass_audit_time_ desc,
  534. </when>
  535. <otherwise>
  536. <if test="param.myself == null or param.myself == false ">
  537. t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc,
  538. </if>
  539. </otherwise>
  540. </choose>
  541. CONVERT(t.music_sheet_name_ USING gbk) COLLATE gbk_chinese_ci,
  542. t.music_sheet_name_ COLLATE utf8mb4_bin,
  543. t.music_sheet_name_ REGEXP '^[0-9]' DESC, t.create_time_ DESC
  544. </select>
  545. <select id="selectMyMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  546. select distinct <include refid="Base_Column_List"/>
  547. ,su.username_ as addName
  548. ,su.avatar_ as addUserAvatar
  549. ,(select group_concat(mt.name_) from music_tag mt
  550. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  551. ,(select group_concat(s.name_) from subject s
  552. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  553. ,if(mf.id_ is not null,1,0) as favorite
  554. from music_sheet t
  555. left join sys_user su on t.create_by_ = su.id_
  556. left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_
  557. left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mspr.student_id_ = mf.user_id_
  558. <if test="param.auditStatus != null">
  559. left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
  560. </if>
  561. <where>
  562. 1=1
  563. <include refid="QueryInfo"/>
  564. <if test="param.studentId != null">
  565. and mspr.student_id_ = #{param.studentId}
  566. and mspr.order_status_ = 'PAID'
  567. </if>
  568. <if test="param.userType != null">
  569. and mspr.client_type_ = #{param.userType}
  570. </if>
  571. <if test="param.purchaseType != null">
  572. AND mspr.purchase_type_ = #{param.purchaseType}
  573. </if>
  574. <if test="param.courseGift != null">
  575. AND mspr.course_music_album_id_ <choose><when test="param.courseGift == 0"> = </when><otherwise> > </otherwise> </choose> 0
  576. </if>
  577. </where>
  578. <if test="param.auditStatus != null">
  579. group by msar.music_sheet_id_
  580. </if>
  581. order by mspr.id_ desc
  582. </select>
  583. <select id="selectFavoriteMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  584. select <include refid="Base_Column_List"/>
  585. ,su.username_ as addName
  586. ,su.avatar_ as addUserAvatar
  587. ,(select group_concat(mt.name_) from music_tag mt
  588. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  589. ,(select group_concat(s.name_) from subject s
  590. where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames
  591. ,if(mf.id_ is not null,1,0) as favorite
  592. from music_sheet t
  593. left join sys_user su on t.create_by_ = su.id_
  594. left join music_favorite mf on t.id_ = mf.music_sheet_id_
  595. <if test="param.auditStatus != null">
  596. left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
  597. </if>
  598. <where>
  599. mf.client_type_ = #{clientType}
  600. <if test="clientType.code == 'STUDENT'">
  601. and t.del_flag_=0 and t.state_ =1 and find_in_set('PLATFORM',t.provider_type_)
  602. </if>
  603. <if test="clientType.code == 'TEACHER'">
  604. and ((t.del_flag_=0 and t.state_ =1 and find_in_set('PLATFORM',t.provider_type_))
  605. <if test="param.tenantId !=null">
  606. or (t.tenant_del_flag_=0 and t.tenant_state_ =1 and find_in_set('TENANT',t.provider_type_)
  607. and t.id_ in (select s.music_sheet_id_ from tenant_album_music s
  608. left join tenant_album s1 on s.tenant_album_id_ = s1.id_ where s.tenant_id_ = #{param.tenantId}
  609. and s.del_flag_ = 0 and s.subject_type_ in ('ENSEMBLE','MUSIC','SUBJECT') and s1.del_flag_= 0 and s1.status_ = 1
  610. )
  611. )
  612. </if>
  613. )
  614. </if>
  615. <if test="param.studentId != null">
  616. and mf.user_id_ = #{param.studentId}
  617. </if>
  618. </where>
  619. <if test="param.auditStatus != null">
  620. group by msar.music_sheet_id_
  621. </if>
  622. order by mf.id_ desc
  623. </select>
  624. <select id="selectPracticeMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  625. select <include refid="Base_Column_List"/>
  626. ,su.username_ as addName
  627. ,su.avatar_ as addUserAvatar
  628. ,(select group_concat(mt.name_) from music_tag mt
  629. where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  630. ,(select group_concat(s.name_) from subject s where find_in_set(s.id_,t.music_subject_) ) as subjectNames
  631. ,if(mf.id_ is not null,1,0) as favorite
  632. from sys_music_compare_record mspr
  633. left join music_sheet t on mspr.music_sheet_id_ = t.id_
  634. <if test="param.auditStatus != null">
  635. left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
  636. </if>
  637. left join sys_user su on t.create_by_ = su.id_
  638. 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> )
  639. <where>
  640. 1=1
  641. <include refid="QueryInfo"/>
  642. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  643. and mspr.id_ in
  644. <foreach collection="practiceMusicIdList" item="item" open="(" close=")" separator=",">
  645. #{item}
  646. </foreach>
  647. </if>
  648. </where>
  649. <if test="param.auditStatus != null">
  650. group by msar.music_sheet_id_
  651. </if>
  652. <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
  653. order by field(mspr.id_,
  654. <foreach collection="practiceMusicIdList" item="item" separator=",">
  655. #{item}
  656. </foreach>
  657. </if>
  658. )
  659. </select>
  660. <select id="selectStudentOrderPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentMusicSheetOrderVo">
  661. select distinct mspr.music_sheet_id_ as musicSheetId
  662. ,ms.music_sheet_name_ as musicSheetName
  663. ,ms.composer_ as composer
  664. ,ms.title_img_ as titleImg
  665. ,ms.music_tag_ as musicTag
  666. ,(select group_concat(mt.name_) from music_tag mt
  667. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  668. ,mspr.purchase_price_ as purchasePrice
  669. ,mspr.order_no_ as orderNo
  670. ,mspr.purchase_time_ as purchaseTime
  671. from music_sheet_purchase_record mspr
  672. left join music_sheet ms on mspr.music_sheet_id_ = ms.id_
  673. <where>
  674. mspr.order_status_ = 'PAID' and mspr.purchase_type_ = 'MUSIC'
  675. <if test="param.idAndName != null and param.idAndName != ''">
  676. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  677. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%'))
  678. </if>
  679. <if test="param.studentId != null">
  680. and mspr.student_id_ = #{param.studentId}
  681. </if>
  682. <if test="param.orderNo != null and param.orderNo != ''">
  683. and mspr.order_no_ = #{param.orderNo}
  684. </if>
  685. <if test="param.musicTagList != null and param.musicTagList.size() != 0">
  686. and
  687. <foreach collection="param.musicTagList" separator="or" item="item" open="(" close=")" >
  688. find_in_set(#{item},ms.music_tag_)
  689. </foreach>
  690. </if>
  691. <if test="param.startTime != null">
  692. and mspr.purchase_time_ &gt; #{param.startTime}
  693. </if>
  694. <if test="param.endTime != null">
  695. and mspr.purchase_time_ &lt; #{param.endTime}
  696. </if>
  697. </where>
  698. order by mspr.id_ desc
  699. </select>
  700. <select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  701. select ms.id_ as musicSheetId
  702. ,ms.music_sheet_name_ as musicSheetName
  703. ,ms.composer_ as composer
  704. ,ms.title_img_ as titleImg
  705. ,ms.accompaniment_type_ as accompanimentType
  706. ,ms.music_tag_ as musicTag
  707. ,(select group_concat(mt.name_) from music_tag mt
  708. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  709. ,ms.play_speed_ as playSpeed
  710. ,ms.music_price_ as musicPrice
  711. ,ms.create_time_ as createTime
  712. ,ms.audit_status_ as auditStatus
  713. ,su.username_ as auditName
  714. from music_sheet ms
  715. left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
  716. left join sys_user su on msar.verify_user_id_ = su.id_
  717. <where>
  718. <if test="param.idAndName != null and param.idAndName != ''">
  719. and (ms.id_ like concat('%',#{param.idAndName} ,'%')
  720. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  721. or ms.composer_ like concat('%',#{param.idAndName},'%'))
  722. </if>
  723. <if test="param.teacherId != null">
  724. and ms.create_by_ = #{param.teacherId} and ms.source_type_ = 'TEACHER'
  725. </if>
  726. <if test="param.startTime != null">
  727. and ms.create_time_ &gt; #{param.startTime}
  728. </if>
  729. <if test="param.endTime != null">
  730. and ms.create_time_ &lt; #{param.endTime}
  731. </if>
  732. <if test="param.delFlag != null">
  733. and ms.del_flag_ = #{param.delFlag}
  734. </if>
  735. </where>
  736. order by ms.id_ desc
  737. </select>
  738. <select id="selectAuditPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">
  739. select
  740. msar.id_ as authMusicSheetId,
  741. ms.create_by_ as teacherId
  742. ,ms.exquisite_flag_ as exquisiteFlag
  743. ,ms.title_img_ as titleImg
  744. ,ms.accompaniment_type_ as accompanimentType
  745. ,su.username_ as username
  746. ,su.real_name_ as realName
  747. ,su.phone_ as phone
  748. ,ms.id_ as musicSheetId
  749. ,ms.music_sheet_name_ as musicSheetName
  750. ,ms.composer_ as composer
  751. ,ms.music_tag_ as musicTag
  752. ,(select group_concat(mt.name_) from music_tag mt
  753. where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0 and mt.state_ = 1) as musicTagNames
  754. ,ms.play_speed_ as playSpeed
  755. ,ms.music_price_ as musicPrice
  756. ,ms.update_time_ as createTime
  757. ,if(msar.audit_state_ is null,ms.audit_status_,msar.audit_state_) as auditStatus
  758. ,su2.username_ as auditName
  759. ,msar.first_auth_ as firstAuth
  760. from music_sheet_auth_record msar
  761. left join music_sheet ms on ms.id_ = msar.music_sheet_id_
  762. left join sys_user su on su.id_ = ms.create_by_
  763. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  764. <where>ms.source_type_ = 'TEACHER'
  765. <if test="param.idAndName != null and param.idAndName != ''">
  766. and (su.id_ like concat('%',#{param.idAndName} ,'%')
  767. or su.username_ like concat('%',#{param.idAndName},'%')
  768. or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')
  769. or su.phone_ like concat('%',#{param.idAndName},'%'))
  770. </if>
  771. <if test="param.auditName != null and param.auditName != ''">
  772. and su2.username_ like concat('%',#{param.auditName},'%')
  773. </if>
  774. <if test="param.authStatus != null">
  775. and msar.audit_state_ = #{param.authStatus} and msar.audit_state_ = msar.last_audit_state_
  776. </if>
  777. <if test="param.startTime != null">
  778. and ms.create_time_ &gt; #{param.startTime}
  779. </if>
  780. <if test="param.endTime != null">
  781. and ms.create_time_ &lt; #{param.endTime}
  782. </if>
  783. <if test="param.chargeType != null">
  784. and ms.charge_type_ = #{param.chargeType}
  785. </if>
  786. <if test="param.firstAuth != null">
  787. and msar.first_auth_ = #{param.firstAuth}
  788. </if>
  789. <if test="param.exquisiteFlag != null">
  790. and ms.exquisite_flag_ = #{param.exquisiteFlag}
  791. </if>
  792. </where>
  793. order by field(ms.audit_status_,'DOING') desc, ms.submit_audit_time_ desc
  794. </select>
  795. <select id="selectTeacherMusicSheetCount" resultType="java.lang.Integer">
  796. select count(1)
  797. from music_sheet
  798. where user_id_ = #{userId}
  799. and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0 and source_type_ = 'TEACHER'
  800. </select>
  801. <select id="selectMusicNum" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo">
  802. select
  803. sum(if(ms.source_type_ = 'PLATFORM',1,0)) as musicSheetPlatformCount,
  804. sum(if(ms.source_type_ = 'TEACHER',1,0)) as musicSheetTeacherCount,
  805. count(1) as musicSheetCount
  806. from music_sheet ms
  807. where ms.state_ = 1 and ms.del_flag_ = 0 and ms.audit_status_ = 'PASS' and find_in_set('CHARGE',ms.payment_type_) and find_in_set('PLATFORM',ms.provider_type_)
  808. </select>
  809. <select id="selectPayMusicSheet" resultType="com.yonge.cooleshow.biz.dal.vo.HomeMusicSheetVo$MusicSheetSmall">
  810. SELECT
  811. ms.id_ as musicSheetId,
  812. ms.music_sheet_name_ as musicSheetName,
  813. count(DISTINCT pr.student_id_) as num
  814. FROM
  815. music_sheet ms
  816. LEFT JOIN music_sheet_purchase_record pr ON ms.id_ = pr.music_sheet_id_
  817. WHERE
  818. ms.del_flag_=0
  819. AND ms.charge_type_='CHARGE'
  820. AND ms.state_=1
  821. AND pr.order_status_='PAID'
  822. GROUP BY ms.id_
  823. ORDER BY count(DISTINCT pr.student_id_) DESC,ms.id_ desc
  824. limit 5
  825. </select>
  826. <select id="selectTeacherCount" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherAuditMusicSheetVo">
  827. select
  828. sum(if(t.audit_status_ = 'DOING',1,0)) as doing,
  829. sum(if(t.audit_status_ = 'PASS'
  830. and t.state_ = 1,1,0)) as pass,
  831. sum(if(t.audit_status_ = 'UNPASS',1,0)) as upPass
  832. from
  833. music_sheet t
  834. where t.user_id_ = #{userId}
  835. </select>
  836. <select id="queryStudentTotal" resultType="com.yonge.cooleshow.biz.dal.vo.StudentTotalVo">
  837. select
  838. t.user_id_ as userId,
  839. a.musicAlbumNum,
  840. b.musicSheetNum
  841. from student t
  842. left join (
  843. select
  844. user_id_, count(1) as musicAlbumNum
  845. from album_favorite
  846. <where>
  847. <if test="null != userId">
  848. and user_id_ = #{userId}
  849. </if>
  850. </where>
  851. group by user_id_
  852. ) a on t.user_id_ = a.user_id_
  853. left join (
  854. select
  855. user_id_, count(1) as musicSheetNum
  856. from music_favorite
  857. <where>
  858. <if test="null != userId">
  859. and user_id_ = #{userId}
  860. </if>
  861. </where>
  862. group by user_id_
  863. ) b on t.user_id_ = b.user_id_
  864. <where>
  865. <if test="null != userId">
  866. and t.user_id_ = #{userId}
  867. </if>
  868. </where>
  869. </select>
  870. <select id="queryTeacherTotal" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo">
  871. select
  872. t.user_id_ as userId,
  873. a.musicSheetNum as musicSheetNum
  874. from teacher t
  875. left join (
  876. select
  877. user_id_, count(1) as musicSheetNum
  878. from music_sheet
  879. where source_type_ = 'TEACHER' and state_ = 1 and audit_status_ = 'PASS' and del_flag_ = 0
  880. <if test="null != userId">
  881. and user_id_ = #{userId}
  882. </if>
  883. group by user_id_
  884. ) a on t.user_id_ = a.user_id_
  885. <where>
  886. <if test="null != userId">
  887. and t.user_id_ = #{userId}
  888. </if>
  889. </where>
  890. </select>
  891. <select id="auditDetail" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo">
  892. SELECT
  893. su.username_ as userName
  894. ,su.avatar_ as userAvatar
  895. ,su.real_name_ as realName
  896. ,msar.update_time_ as auditTime
  897. ,msar.create_time_ as submitAuditTime
  898. ,msar.audit_state_ as auditStatus
  899. ,su2.username_ as auditName
  900. ,msar.reason_ as auditReason
  901. ,msar.music_sheet_json_ as musicSheetJson
  902. ,msar.batch_no_ as batchNo
  903. ,msar.id_ as id
  904. from music_sheet_auth_record msar
  905. left join music_sheet t on t.id_ = msar.music_sheet_id_
  906. left join sys_user su on su.id_ = t.create_by_
  907. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  908. WHERE msar.id_ = #{recordId}
  909. </select>
  910. <select id="auditDetailList" resultType="com.yonge.cooleshow.biz.dal.wrapper.MusicSheetWrapper$MusicSheetDetailVo">
  911. SELECT
  912. su.username_ as userName
  913. ,su.avatar_ as userAvatar
  914. ,su.real_name_ as realName
  915. ,msar.update_time_ as auditTime
  916. ,msar.create_time_ as submitAuditTime
  917. ,msar.audit_state_ as auditStatus
  918. ,su2.username_ as auditName
  919. ,msar.reason_ as auditReason
  920. ,msar.music_sheet_json_ as musicSheetJson
  921. ,msar.batch_no_ as batchNo
  922. ,msar.id_ as id
  923. from music_sheet_auth_record msar
  924. left join music_sheet t on t.id_ = msar.music_sheet_id_
  925. left join sys_user su on su.id_ = t.create_by_
  926. left join sys_user su2 on msar.verify_user_id_ = su2.id_
  927. <where>
  928. <if test="batchNo != null and batchNo != ''">
  929. and #{batchNo} = msar.batch_no_
  930. </if>
  931. </where>
  932. order by msar.id_ desc
  933. </select>
  934. <!--单曲专辑数量统计-->
  935. <select id="selectMusicAlbumStatInfo" resultType="com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper">
  936. SELECT t1.music_sheet_id_ AS id, COUNT(DISTINCT t1.id_) AS total
  937. FROM album_music_relate t1 JOIN music_sheet t2 ON (t1.music_sheet_id_ = t2.id_)
  938. <where>
  939. <if test="musicIds != null">
  940. AND t1.music_sheet_id_ IN (<foreach collection="musicIds" separator="," item="item">#{item}</foreach>)
  941. </if>
  942. </where>
  943. GROUP BY t1.music_sheet_id_
  944. </select>
  945. <update id="updateFavoriteCount">
  946. update music_sheet set favorite_count_ =
  947. <choose>
  948. <when test="state.code == 0">
  949. favorite_count_ - 1
  950. </when>
  951. <when test="state.code == 1">
  952. favorite_count_ + 1
  953. </when>
  954. <otherwise>
  955. favorite_count_
  956. </otherwise>
  957. </choose>
  958. where id_ = #{musicSheetId}
  959. </update>
  960. <update id="updateBatchByCbsId">
  961. <foreach collection="vos" item="item" index="index" separator=";">
  962. update music_sheet ms set
  963. ms.music_tag_ = #{item.musicTagIds},ms.payment_type_ = #{item.paymentType},
  964. ms.charge_type_ = #{item.paymentType},
  965. ms.music_price_ = #{item.musicPrice},ms.top_flag_ = #{item.topFlag},
  966. ms.exquisite_flag_ = #{item.exquisiteFlag},ms.sort_number_ = #{item.sortNo},ms.del_flag_ = 0,
  967. ms.audit_status_ = 'PASS',
  968. ms.score_type_ = #{item.scoreType},
  969. ms.state_ = #{item.status},
  970. ms.notation_ = #{item.isConvertibleScore},
  971. ms.provider_type_ = CASE WHEN #{item.availableType} = 'PLATFORM' THEN 'PLATFORM' ELSE 'TENANT' END
  972. <if test="item.musicSheetUpdate != null">
  973. ,ms.music_sheet_name_ = #{item.musicSheetUpdate.name},
  974. ms.music_subject_ = #{item.musicSheetUpdate.subjectIds},
  975. ms.music_svg_ = #{item.musicSheetUpdate.musicSvg},
  976. ms.composer_ = #{item.musicSheetUpdate.composer},
  977. ms.accompaniment_type_ = #{item.musicSheetUpdate.audioType},
  978. ms.play_speed_ = #{item.musicSheetUpdate.playSpeed},
  979. ms.notation_ = #{item.musicSheetUpdate.notation},
  980. ms.music_sheet_type_ = #{item.musicSheetUpdate.musicSheetType},
  981. ms.create_by_ = #{item.musicSheetUpdate.userId},
  982. ms.audio_type_ = #{item.musicSheetUpdate.playMode},
  983. ms.show_fingering_ = #{item.musicSheetUpdate.showFingering},
  984. ms.can_evaluate_ = #{item.musicSheetUpdate.canEvaluate},
  985. ms.is_all_subject_ = #{item.musicSheetUpdate.isAllSubject},
  986. ms.source_type_ = CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  987. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER' ELSE 'TENANT' END,
  988. ms.first_pass_audit_time_ = IF(#{item.musicSheetUpdate.sourceType} = 'PERSON' and ms.first_pass_audit_time_ is null, now(), ms.first_pass_audit_time_)
  989. </if>
  990. where ms.cbs_music_sheet_id_ = #{item.musicSheetId}
  991. </foreach>
  992. </update>
  993. <update id="batchEnable">
  994. update music_sheet
  995. <set>
  996. <if test="tenantFlag == 1">
  997. tenant_state_ = #{status},
  998. </if>
  999. <if test="tenantFlag == 0">
  1000. client_state_ = #{status}
  1001. </if>
  1002. </set>
  1003. where FIND_IN_SET(cbs_music_sheet_id_,#{ids})
  1004. </update>
  1005. <update id="batchDel">
  1006. update music_sheet
  1007. <set>
  1008. <if test="tenantFlag == 1">
  1009. tenant_del_flag_ = 1,
  1010. </if>
  1011. <if test="tenantFlag == 0">
  1012. del_flag_ = 1
  1013. </if>
  1014. </set>
  1015. where FIND_IN_SET(cbs_music_sheet_id_,#{ids})
  1016. </update>
  1017. <update id="updateMusicSheet">
  1018. update music_sheet
  1019. set music_sheet_name_ = #{param.name},music_subject_ = #{param.subjectIds},music_svg_ = #{param.musicSvg},
  1020. composer_ = #{param.composer},title_img_ = #{param.musicCover},music_img_ = #{param.musicCover},accompaniment_type_ = #{param.audioType},
  1021. play_speed_ = #{param.playSpeed},is_all_subject_ = #{param.isAllSubject},platform_state_ = #{param.platformStatus},
  1022. music_sheet_type_ = #{param.musicSheetType},source_type_ = CASE WHEN #{param.sourceType} = 'PLATFORM' THEN 'PLATFORM' ELSE 'TEACHER' END,
  1023. create_by_ = #{param.userId},tenant_category_id_ = #{param.musicCategoryId}
  1024. where cbs_music_sheet_id_ = #{param.id}
  1025. </update>
  1026. <select id="countByUser" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetUploadCountVo">
  1027. select user_id_ userId, count(id_) count
  1028. from music_sheet
  1029. where del_flag_ = false and state_ =1 and source_type_ = 'TEACHER' and user_id_ in
  1030. <foreach collection="userIds" open="(" close=")" separator="," item="item">
  1031. #{item}
  1032. </foreach>
  1033. group by user_id_
  1034. </select>
  1035. <select id="searchMusic" resultType="java.lang.Long">
  1036. select t.id_ from music_sheet t
  1037. <if test="param.tenantAlbumIds != null and param.tenantAlbumIds.size() != 0">
  1038. left join tenant_album_music tam on t.id_ = tam.music_sheet_id_
  1039. </if>
  1040. <where>
  1041. <if test="param.subjectId != null">
  1042. and ( t.music_subject_ = #{param.subjectId} or t.music_subject_ is null or t.music_subject_ = '' OR t.is_all_subject_)
  1043. </if>
  1044. <if test="param.name != null and param.name != ''">
  1045. and t.music_sheet_name_ like concat('%',#{param.name},'%')
  1046. </if>
  1047. <if test="param.tenantAlbumIds != null and param.tenantAlbumIds.size() != 0">
  1048. and tam.tenant_album_id_ in
  1049. <foreach collection="param.tenantAlbumIds" item="item" open="(" close=")" separator=",">
  1050. #{item}
  1051. </foreach>
  1052. and tam.del_flag_=0
  1053. and tam.subject_type_ in ('ENSEMBLE', 'MUSIC', 'SUBJECT')
  1054. </if>
  1055. <if test="param.providerType != null">
  1056. and find_in_set(#{param.providerType},t.provider_type_)
  1057. <if test="param.providerType != null">
  1058. <if test="param.providerType.code == 'TENANT'">
  1059. and t.tenant_state_ = true and t.tenant_del_flag_ = 0
  1060. </if>
  1061. <if test="param.providerType.code == 'PLATFORM'">
  1062. and t.state_=1 and t.audit_version_ = 0 and t.del_flag_ = 0 and t.audit_status_ = 'PASS'
  1063. </if>
  1064. </if>
  1065. </if>
  1066. </where>
  1067. order by t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc
  1068. </select>
  1069. <select id="searchAlbum" resultType="java.lang.Long">
  1070. select id_ from music_album t
  1071. <where>
  1072. t.album_status_=1 and del_flag_=0 and audit_version_ = 0
  1073. <if test="param.subjectId != null">
  1074. and ( t.subject_id_ = #{param.subjectId} or t.subject_id_ is null or t.subject_id_ = '')
  1075. </if>
  1076. <if test="param.name != null and param.name != ''">
  1077. and t.album_name_ like concat('%',#{param.name},'%')
  1078. </if>
  1079. </where>
  1080. order by t.sort_number_ desc
  1081. </select>
  1082. <select id="personOwnerList"
  1083. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  1084. select su.id_ userId,su.username_ username
  1085. ,'TEACHER' clientType,su.phone_ phone from teacher t
  1086. left join sys_user su ON su.id_ = t.user_id_
  1087. where su.user_type_ LIKE '%TEACHER%' AND su.del_flag_ = 0 AND su.lock_flag_ = 0 AND t.lock_flag_ = 0
  1088. <if test="param.name != null and param.name != ''">
  1089. AND (su.phone_ LIKE CONCAT('%',#{param.name},'%') OR su.username_ LIKE CONCAT('%',#{param.name},'%'))
  1090. </if>
  1091. <if test="param.userIdList != null and param.userIdList.size > 0">
  1092. AND su.id_ IN
  1093. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  1094. #{item}
  1095. </foreach>
  1096. </if>
  1097. </select>
  1098. <select id="orgOwnerList"
  1099. resultType="com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper$MusicSheetExtend">
  1100. select id_ organizationRoleId,name_ organizationRole,'ORG' clientType,phone_ phone from tenant_info where enable_flag_ = 1
  1101. <if test="param.name != null and param.name != ''">
  1102. AND (phone_ LIKE CONCAT('%',#{param.name},'%') OR name_ LIKE CONCAT('%',#{param.name},'%'))
  1103. </if>
  1104. <if test="param.userIdList != null and param.userIdList.size > 0">
  1105. AND id_ IN
  1106. <foreach collection="param.userIdList" item="item" open="(" close=")" separator=",">
  1107. #{item}
  1108. </foreach>
  1109. </if>
  1110. </select>
  1111. <select id="get" resultType="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
  1112. select <include refid="Base_Column_List"/>
  1113. from music_sheet t
  1114. where t.id_ = #{id}
  1115. </select>
  1116. <select id="selectSyncPage" resultType="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
  1117. select *
  1118. from music_sheet
  1119. where del_flag_ = 0 and audit_status_ = 'PASS' and cbs_music_sheet_id_ is null
  1120. </select>
  1121. <select id="queryTenantRelatedList" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">
  1122. select
  1123. <include refid="Base_Column_List"/>
  1124. from music_sheet t
  1125. left join tenant_album_music t1 on t1.music_sheet_id_ = t.id_
  1126. <where>
  1127. t.tenant_del_flag_ = 0 and t.tenant_state_ =1 and t.cbs_music_sheet_id_ is not null
  1128. and t1.del_flag_=0 and t1.subject_type_ in ('ENSEMBLE', 'MUSIC', 'SUBJECT')
  1129. <if test="queryInfo.albumId != null">
  1130. and t1.tenant_album_id_ = #{queryInfo.albumId}
  1131. </if>
  1132. <if test="queryInfo.albumId == null">
  1133. and 1=2
  1134. </if>
  1135. <if test="queryInfo.musicSheetId != null">
  1136. and t.id_ != #{queryInfo.musicSheetId}
  1137. </if>
  1138. <if test="queryInfo.subjectId != null">
  1139. and find_in_set(#{queryInfo.subjectId},t.music_subject_)
  1140. </if>
  1141. <if test="queryInfo.musicSheetType != null">
  1142. and t.music_sheet_type_ = #{queryInfo.musicSheetType}
  1143. </if>
  1144. </where>
  1145. </select>
  1146. <select id="countTeacherEnable" resultType="int">
  1147. select count(1)
  1148. from music_sheet
  1149. where state_ = 1 and del_flag_ = 0 and source_type_ = 'TEACHER' and create_by_ = #{userId}
  1150. </select>
  1151. <update id="updateTenantByCbsId">
  1152. update music_sheet ms set
  1153. ms.tenant_sort_number_ = #{item.sortNo},ms.tenant_del_flag_ = 0,
  1154. ms.tenant_score_type_ = #{item.scoreType},
  1155. ms.audit_status_ = 'PASS',
  1156. ms.tenant_state_ = #{item.status},
  1157. ms.tenant_notation_ = #{item.isConvertibleScore},
  1158. ms.provider_type_ = CASE WHEN ms.provider_type_ is null or ms.provider_type_ = '' THEN 'TENANT'
  1159. when find_in_set('TENANT',ms.provider_type_) then ms.provider_type_
  1160. else concat(ms.provider_type_,',','TENANT') end
  1161. <if test="item.musicSheetUpdate != null">
  1162. ,ms.music_sheet_name_ = #{item.musicSheetUpdate.name},
  1163. ms.music_subject_ = #{item.musicSheetUpdate.subjectIds},
  1164. ms.music_svg_ = #{item.musicSheetUpdate.musicSvg},
  1165. ms.composer_ = #{item.musicSheetUpdate.composer},
  1166. ms.accompaniment_type_ = #{item.musicSheetUpdate.audioType},
  1167. ms.play_speed_ = #{item.musicSheetUpdate.playSpeed},
  1168. ms.music_sheet_type_ = #{item.musicSheetUpdate.musicSheetType},
  1169. ms.create_by_ = #{item.musicSheetUpdate.userId},
  1170. ms.audio_type_ = #{item.musicSheetUpdate.playMode},
  1171. ms.tenant_category_id_ = #{item.musicSheetUpdate.musicCategoryId},
  1172. ms.show_fingering_ = #{item.musicSheetUpdate.showFingering},
  1173. ms.can_evaluate_ = #{item.musicSheetUpdate.canEvaluate},
  1174. ms.upload_time_ = #{item.musicSheetUpdate.createTime},
  1175. ms.source_type_ = CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  1176. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER' ELSE 'TENANT' END
  1177. </if>
  1178. where ms.cbs_music_sheet_id_ = #{item.musicSheetId}
  1179. </update>
  1180. <update id="updatePlatformByCbsId">
  1181. update music_sheet ms set
  1182. ms.music_tag_ = #{item.musicTagIds},ms.payment_type_ = #{item.paymentType},
  1183. ms.first_pass_audit_time_ = IF((#{item.musicSheetUpdate.sourceType} = 'PERSON' and ms.first_pass_audit_time_ is null) or !find_in_set('PLATFORM',ms.provider_type_),
  1184. now(), ms.first_pass_audit_time_),
  1185. ms.charge_type_ = #{item.paymentType},
  1186. ms.music_price_ = #{item.musicPrice},ms.top_flag_ = #{item.topFlag},
  1187. ms.exquisite_flag_ = #{item.exquisiteFlag},ms.sort_number_ = #{item.sortNo},ms.del_flag_ = 0,
  1188. ms.audit_status_ = 'PASS',
  1189. ms.score_type_ = #{item.scoreType},
  1190. ms.state_ = #{item.status},
  1191. ms.client_state_ = #{item.clientStatus},
  1192. ms.notation_ = #{item.isConvertibleScore},
  1193. ms.provider_type_ = CASE WHEN ms.provider_type_ is null or ms.provider_type_ = '' THEN 'PLATFORM'
  1194. when find_in_set('PLATFORM',ms.provider_type_) then ms.provider_type_
  1195. else concat(ms.provider_type_,',','PLATFORM') end
  1196. <if test="item.musicSheetUpdate != null">
  1197. ,ms.music_sheet_name_ = #{item.musicSheetUpdate.name}
  1198. ,ms.platform_state_ = #{item.musicSheetUpdate.platformStatus},
  1199. ms.music_subject_ = #{item.musicSheetUpdate.subjectIds},
  1200. ms.music_svg_ = #{item.musicSheetUpdate.musicSvg},
  1201. ms.composer_ = #{item.musicSheetUpdate.composer},
  1202. ms.accompaniment_type_ = #{item.musicSheetUpdate.audioType},
  1203. ms.play_speed_ = #{item.musicSheetUpdate.playSpeed},
  1204. ms.notation_ = #{item.musicSheetUpdate.notation},
  1205. ms.music_sheet_type_ = #{item.musicSheetUpdate.musicSheetType},
  1206. ms.create_by_ = #{item.musicSheetUpdate.userId},
  1207. ms.audio_type_ = #{item.musicSheetUpdate.playMode},
  1208. ms.show_fingering_ = #{item.musicSheetUpdate.showFingering},
  1209. ms.can_evaluate_ = #{item.musicSheetUpdate.canEvaluate},
  1210. ms.source_type_ = CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  1211. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER' ELSE 'TENANT' END
  1212. </if>
  1213. where ms.cbs_music_sheet_id_ = #{item.musicSheetId}
  1214. </update>
  1215. <insert id="tenantInsert">
  1216. insert into music_sheet
  1217. (cbs_music_sheet_id_,tenant_sort_number_,tenant_score_type_,tenant_state_,tenant_notation_,tenant_category_id_,tenant_del_flag_
  1218. ,music_sheet_name_,music_subject_,music_svg_,composer_,accompaniment_type_,play_speed_,
  1219. music_sheet_type_,provider_type_,audio_type_,show_fingering_,
  1220. can_evaluate_,create_by_,user_id_,audit_status_,upload_time_,source_type_
  1221. )
  1222. values
  1223. (#{item.musicSheetId},
  1224. #{item.sortNo},#{item.scoreType},#{item.status},#{item.isConvertibleScore}
  1225. ,#{item.musicSheetUpdate.musicCategoryId}
  1226. ,#{item.delFlag}
  1227. ,#{item.musicSheetUpdate.name},
  1228. #{item.musicSheetUpdate.subjectIds},
  1229. #{item.musicSheetUpdate.musicSvg},
  1230. #{item.musicSheetUpdate.composer},
  1231. #{item.musicSheetUpdate.audioType},
  1232. #{item.musicSheetUpdate.playSpeed},
  1233. #{item.musicSheetUpdate.musicSheetType},
  1234. 'TENANT',
  1235. #{item.musicSheetUpdate.playMode},
  1236. #{item.musicSheetUpdate.showFingering},
  1237. #{item.musicSheetUpdate.canEvaluate},
  1238. #{item.musicSheetUpdate.userId},
  1239. #{item.musicSheetUpdate.userId},
  1240. 'PASS',
  1241. #{item.musicSheetUpdate.createTime},
  1242. CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  1243. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER'
  1244. ELSE 'TENANT' END
  1245. )
  1246. </insert>
  1247. <insert id="platformInsert">
  1248. insert into music_sheet
  1249. (cbs_music_sheet_id_,music_tag_,payment_type_,charge_type_,top_flag_,exquisite_flag_,sort_number_,state_,audit_status_
  1250. ,music_sheet_name_,music_subject_,music_svg_,composer_,accompaniment_type_,play_speed_,
  1251. music_price_,notation_,music_sheet_type_,source_type_,provider_type_,audio_type_,show_fingering_,
  1252. can_evaluate_,create_by_,user_id_,score_type_,platform_state_,client_state_,first_pass_audit_time_
  1253. )
  1254. values
  1255. (#{item.musicSheetId},
  1256. #{item.musicTagIds},#{item.paymentType},#{item.paymentType},
  1257. #{item.topFlag},#{item.exquisiteFlag},#{item.sortNo},0
  1258. ,'PASS'
  1259. ,#{item.musicSheetUpdate.name},
  1260. #{item.musicSheetUpdate.subjectIds},
  1261. #{item.musicSheetUpdate.musicSvg},
  1262. #{item.musicSheetUpdate.composer},
  1263. #{item.musicSheetUpdate.audioType},
  1264. #{item.musicSheetUpdate.playSpeed},
  1265. #{item.musicSheetUpdate.musicPrice},
  1266. #{item.isConvertibleScore},
  1267. #{item.musicSheetUpdate.musicSheetType},
  1268. CASE WHEN #{item.musicSheetUpdate.sourceType} = 'PLATFORM' THEN 'PLATFORM'
  1269. WHEN #{item.musicSheetUpdate.sourceType} = 'PERSON' THEN 'TEACHER'
  1270. ELSE 'TENANT' END,
  1271. 'PLATFORM',
  1272. #{item.musicSheetUpdate.playMode},
  1273. #{item.musicSheetUpdate.showFingering},
  1274. #{item.musicSheetUpdate.canEvaluate},
  1275. #{item.musicSheetUpdate.userId},#{item.musicSheetUpdate.userId},
  1276. #{item.scoreType},
  1277. #{item.musicSheetUpdate.platformStatus},
  1278. #{item.clientStatus},
  1279. now()
  1280. )
  1281. </insert>
  1282. <update id="updateState">
  1283. update music_sheet
  1284. set state_ = client_state_ and platform_state_
  1285. where FIND_IN_SET(cbs_music_sheet_id_,#{ids})
  1286. </update>
  1287. <update id="delPractice">
  1288. update sys_music_compare_record
  1289. set hidden_flag_ = 1
  1290. where user_id_ = #{userId} and music_sheet_id_ = #{musicSheetId} and client_id_ = #{clientEnum}
  1291. </update>
  1292. <!--单曲专辑数量统计-->
  1293. </mapper>