GoodsMapper.xml 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.goods.mapper.GoodsMapper">
  6. <resultMap type="com.zhongzheng.modules.goods.domain.Goods" id="GoodsResult">
  7. <result property="goodsId" column="goods_id"/>
  8. <result property="year" column="year"/>
  9. <result property="supplyId" column="supply_id"/>
  10. <result property="goodsType" column="goods_type"/>
  11. <result property="educationTypeId" column="education_type_id"/>
  12. <result property="businessId" column="business_id"/>
  13. <result property="schoolId" column="school_id"/>
  14. <result property="majorId" column="major_id"/>
  15. <result property="goodsName" column="goods_name"/>
  16. <result property="standPrice" column="stand_price"/>
  17. <result property="lowestPrice" column="lowest_price"/>
  18. <result property="createTime" column="create_time"/>
  19. <result property="updateTime" column="update_time"/>
  20. <result property="status" column="status"/>
  21. <result property="validityStartTime" column="validity_start_time"/>
  22. <result property="validityEndTime" column="validity_end_time"/>
  23. <result property="studyStartTime" column="study_start_time"/>
  24. <result property="studyEndTime" column="study_end_time"/>
  25. <result property="certificateIds" column="certificate_ids"/>
  26. <result property="introduce" column="introduce"/>
  27. <result property="suitableObject" column="suitable_object"/>
  28. <result property="buyNote" column="buy_note"/>
  29. <result property="pcDetailHtml" column="pc_detail_html"/>
  30. <result property="mobileDetailHtml" column="mobile_detail_html"/>
  31. <result property="goodsStatus" column="goods_status"/>
  32. <result property="coverUrl" column="cover_url"/>
  33. <result property="classHours" column="class_hours"/>
  34. <result property="standPriceJson" column="stand_price_json"/>
  35. <result property="code" column="code"/>
  36. <result property="supplyName" column="supply_name"/>
  37. <result property="projectId" column="project_id"/>
  38. <result property="goodsAuditionConfig" column="goods_audition_config"/>
  39. <result property="goodsPhotographConfig" column="goods_photograph_config"/>
  40. <result property="goodsPlayConfig" column="goods_play_config"/>
  41. <result property="goodsExamConfig" column="goods_exam_config"/>
  42. <result property="handoutsId" column="handouts_id"/>
  43. <result property="serviceTimeType" column="service_time_type"/>
  44. <result property="serviceTimeNum" column="service_time_num"/>
  45. <result property="sectionMaxNum" column="section_max_num"/>
  46. <result property="examNumber" column="exam_number"/>
  47. <result property="doNumber" column="do_number"/>
  48. <result property="teacherId" column="teacher_id"/>
  49. <result property="subjectIds" column="subject_ids"/>
  50. <result property="certificateTypeId" column="certificate_type_id"/>
  51. <result property="certificateId" column="certificate_id"/>
  52. <result property="certificateTpId" column="certificate_tp_id"/>
  53. <result property="commitPeriodStatus" column="commit_period_status"/>
  54. <result property="commitPeriodRemark" column="commit_period_remark"/>
  55. <result property="gradeType" column="grade_type"/>
  56. </resultMap>
  57. <resultMap type="com.zhongzheng.modules.goods.vo.GoodsVo" id="GoodsResultVo">
  58. <result property="goodsId" column="goods_id"/>
  59. <result property="year" column="year"/>
  60. <result property="supplyId" column="supply_id"/>
  61. <result property="goodsType" column="goods_type"/>
  62. <result property="gradeId" column="grade_id"/>
  63. <result property="educationTypeId" column="education_type_id"/>
  64. <result property="businessId" column="business_id"/>
  65. <result property="schoolId" column="school_id"/>
  66. <result property="majorId" column="major_id"/>
  67. <result property="goodsName" column="goods_name"/>
  68. <result property="standPrice" column="stand_price"/>
  69. <result property="lowestPrice" column="lowest_price"/>
  70. <result property="createTime" column="create_time"/>
  71. <result property="updateTime" column="update_time"/>
  72. <result property="status" column="status"/>
  73. <result property="validityStartTime" column="validity_start_time"/>
  74. <result property="validityEndTime" column="validity_end_time"/>
  75. <result property="studyStartTime" column="study_start_time"/>
  76. <result property="studyEndTime" column="study_end_time"/>
  77. <result property="certificateIds" column="certificate_ids"/>
  78. <result property="introduce" column="introduce"/>
  79. <result property="suitableObject" column="suitable_object"/>
  80. <result property="buyNote" column="buy_note"/>
  81. <result property="pcDetailHtml" column="pc_detail_html"/>
  82. <result property="mobileDetailHtml" column="mobile_detail_html"/>
  83. <result property="goodsStatus" column="goods_status"/>
  84. <result property="coverUrl" column="cover_url"/>
  85. <result property="classHours" column="class_hours"/>
  86. <result property="standPriceJson" column="stand_price_json"/>
  87. <result property="code" column="code"/>
  88. <result property="projectId" column="project_id"/>
  89. <result property="goodsAuditionConfig" column="goods_audition_config"/>
  90. <result property="goodsPhotographConfig" column="goods_photograph_config"/>
  91. <result property="goodsAuditionExamConfig" column="goods_audition_exam_config"/>
  92. <result property="goodsPlayConfig" column="goods_play_config"/>
  93. <result property="goodsExamConfig" column="goods_exam_config"/>
  94. <result property="sectionMaxNum" column="section_max_num"/>
  95. <result property="specTemplateId" column="spec_template_id"/>
  96. <result property="showStatus" column="show_status"/>
  97. <result property="showSort" column="show_sort"/>
  98. <result property="specialGoods" column="special_goods"/>
  99. <result property="externalLink" column="external_link"/>
  100. <result property="externalLinkStatus" column="external_link_status"/>
  101. <result property="sevenYear" column="seven_year"/>
  102. <result property="supplyName" column="supply_name"/>
  103. <result property="educationName" column="education_name"/>
  104. <result property="projectName" column="project_name"/>
  105. <result property="businessName" column="business_name"/>
  106. <result property="schoolName" column="school_name"/>
  107. <result property="categoryName" column="category_name"/>
  108. <result property="handoutsId" column="handouts_id"/>
  109. <result property="templateType" column="template_type"/>
  110. <result property="period" column="period"/>
  111. <result property="makeStartTime" column="make_start_time"/>
  112. <result property="makeEndTime" column="make_end_time"/>
  113. <result property="studyCount" column="study_count"/>
  114. <result property="makeGoodsName" column="make_goods_name"/>
  115. <result property="makeGoodsCode" column="make_goods_code"/>
  116. <result property="courseNum" column="course_num"/>
  117. <result property="sectionNum" column="section_num"/>
  118. <result property="serviceTimeType" column="service_time_type"/>
  119. <result property="serviceTimeNum" column="service_time_num"/>
  120. <result property="gradeNum" column="grade_num"/>
  121. <result property="gradeId" column="grade_id"/>
  122. <result property="gradeName" column="grade_name"/>
  123. <result property="examNumber" column="exam_number"/>
  124. <result property="doNumber" column="do_number"/>
  125. <result property="orderNum" column="order_num"/>
  126. <result property="teacherId" column="teacher_id"/>
  127. <result property="goodsLiveNum" column="goods_live_num"/>
  128. <result property="subjectIds" column="subject_ids"/>
  129. <result property="certificateTypeId" column="certificate_type_id"/>
  130. <result property="certificateId" column="certificate_id"/>
  131. <result property="certificateTpId" column="certificate_tp_id"/>
  132. <result property="subjectNames" column="subject_names"/>
  133. <result property="buyUserNum" column="buy_user_num"/>
  134. <result property="chapterNum" column="chapter_num"/>
  135. <result property="examNum" column="exam_num"/>
  136. <result property="linePrice" column="line_price"/>
  137. <result property="specTemplateNumber" column="spec_template_number"/>
  138. <result property="goodsLearningOrder" column="goods_learning_order"/>
  139. <result property="commitPeriodStatus" column="commit_period_status"/>
  140. <result property="commitPeriodRemark" column="commit_period_remark"/>
  141. <result property="gradeType" column="grade_type"/>
  142. <result property="optionalYear" column="optional_year"/>
  143. </resultMap>
  144. <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
  145. <result property="id" column="id"/>
  146. <result property="examNumberId" column="exam_number_id"/>
  147. <result property="goodsId" column="goods_id"/>
  148. <result property="goodsName" column="goods_name"/>
  149. <result property="code" column="code"/>
  150. <result property="standPrice" column="stand_price"/>
  151. <result property="goodsStatus" column="goods_status"/>
  152. <result property="validityStartTime" column="validity_start_time"/>
  153. <result property="validityEndTime" column="validity_end_time"/>
  154. <result property="goodsStatus" column="goods_status"/>
  155. <result property="status" column="status"/>
  156. <result property="selectStatus" column="select_status"/>
  157. </resultMap>
  158. <select id="getSectionNum" parameterType="Long" resultType="Long">
  159. SELECT COUNT(m.id) + (
  160. SELECT COUNT(n.id)
  161. FROM course_chapter_section n
  162. LEFT JOIN course_module_chapter p ON n.chapter_id = p.chapter_id
  163. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  164. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  165. WHERE gc.goods_id = #{goodsId}
  166. AND m.type = 1) + (
  167. SELECT COUNT(n.id)
  168. FROM course_chapter_section n
  169. LEFT JOIN course_menu m ON m.menu_id = n.chapter_id
  170. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  171. WHERE gc.goods_id = #{goodsId}
  172. AND m.type = 2)
  173. FROM course_menu m
  174. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  175. WHERE gc.goods_id = #{goodsId}
  176. AND m.type = 3
  177. </select>
  178. <select id="selectAllList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="GoodsResultVo">
  179. SELECT
  180. g.*,
  181. ps.supply_name,
  182. cet.education_name,
  183. cpt.project_name,
  184. cb.business_name,
  185. cb.goods_learning_order,
  186. s.school_name,
  187. m.category_name,
  188. (SELECT GROUP_CONCAT(subject_name) from course_subject where FIND_IN_SET(id,g.subject_ids)) subject_names,
  189. (SELECT COUNT( DISTINCT gar.spec_template_id ) FROM goods_spec_attribute_relation gar WHERE gar.goods_id =
  190. g.goods_id AND gar.`status` = 1 ) spec_template_number,
  191. ot.type AS template_type,
  192. (SELECT gs.goods_name FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_name,
  193. (SELECT gs.code FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_code
  194. <if test="chapterNum ==1">
  195. ,(SELECT COUNT(m.id)+(SELECT COUNT(p.id) FROM course_module_chapter p LEFT JOIN course_menu m on m.menu_id =
  196. p.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and
  197. m.type in(1))+(SELECT COUNT(cmc.id) FROM course_module_chapter cmc LEFT JOIN course_menu m on m.menu_id =
  198. cmc.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and
  199. m.type in(2)) FROM course_menu m LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id =
  200. g.goods_id and m.type in(3)) as chapter_num
  201. </if>
  202. ,(case WHEN g.goods_type =1 then (SELECT count(*) FROM goods_course gc LEFT JOIN course c on gc.course_id =
  203. c.course_id where gc.goods_id =g.goods_id and c.course_show=1) ELSE 0 end) as course_num
  204. <if test="goodsType ==1">
  205. , (SELECT count(*) FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id where
  206. cgg.goods_id = g.goods_id and cg.`status` = 1 ) as grade_num
  207. </if>
  208. <if test="goodsType ==2">
  209. , (SELECT count(*) from order_goods og where og.goods_id = g.goods_id and og.pay_status IN ( 2, 3, 4 )
  210. AND og.refund_status IN (0,3,1) ) as order_num
  211. </if>
  212. <if test="getOrderNum != null and getOrderNum == 1">
  213. ,ou.goods_live_num
  214. </if>
  215. <if test="getUserNum != null and getUserNum == 1">
  216. ,(SELECT count(*) from order_goods og where og.goods_id = g.goods_id and og.`status` = 1
  217. AND og.refund_status in (0,1,3)
  218. AND og.pay_status in (2,3,4)) as buy_user_num
  219. </if>
  220. FROM
  221. goods g
  222. LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
  223. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  224. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  225. LEFT JOIN course_business cb ON g.business_id = cb.id
  226. LEFT JOIN school s ON s.id = g.school_id
  227. LEFT JOIN major m ON g.major_id = m.id
  228. LEFT JOIN order_input_template ot ON cb.template_status = ot.id
  229. <if test="getOrderNum != null and getOrderNum == 1">
  230. LEFT JOIN (
  231. SELECT
  232. og.goods_id,
  233. sum( CASE WHEN g.goods_type = 6 THEN 1 ELSE 0 END ) AS goods_live_num
  234. FROM
  235. `order` o
  236. LEFT JOIN order_goods og ON o.order_sn = og.order_sn
  237. LEFT JOIN goods g ON og.goods_id = g.goods_id
  238. WHERE o.`status` = 1
  239. AND og.refund_status in (0,1,3)
  240. AND og.pay_status in (2,3,4)
  241. GROUP BY
  242. og.goods_id
  243. ) ou ON g.goods_id = ou.goods_id
  244. </if>
  245. WHERE
  246. 1 = 1
  247. AND g.goods_type != 5
  248. <if test="status != null and status.size()!=0 ">
  249. AND g.status in
  250. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  251. #{item}
  252. </foreach>
  253. </if>
  254. <if test="goodsIds != null and goodsIds.size()!=0 ">
  255. AND g.goods_id in
  256. <foreach collection="goodsIds" item="item" index="index" open="(" close=")" separator=",">
  257. #{item}
  258. </foreach>
  259. </if>
  260. <if test="goodsTypes != null and goodsTypes.size()!=0 ">
  261. AND g.goods_type in
  262. <foreach collection="goodsTypes" item="item" index="index" open="(" close=")" separator=",">
  263. #{item}
  264. </foreach>
  265. </if>
  266. <if test="goodsType != null and goodsType != ''">
  267. AND g.goods_type = #{goodsType}
  268. </if>
  269. <if test="showStatus != null and showStatus != ''">
  270. AND g.show_status = #{showStatus}
  271. </if>
  272. <if test="code != null and code != ''">
  273. AND g.code = #{code}
  274. </if>
  275. <if test="makeGoodsId != null and makeGoodsId != ''">
  276. AND g.make_goods_id = #{makeGoodsId}
  277. </if>
  278. <if test="goodsName != null and goodsName != ''">
  279. AND g.goods_name like concat('%', #{goodsName}, '%')
  280. </if>
  281. <if test="educationTypeId != null and educationTypeId != ''">
  282. AND g.education_type_id = #{educationTypeId}
  283. </if>
  284. <if test="projectId != null and projectId != ''">
  285. AND g.project_id = #{projectId}
  286. </if>
  287. <if test="businessIds != null and businessIds.size()!=0 ">
  288. AND g.business_id in
  289. <foreach collection="businessIds" item="item" index="index" open="(" close=")" separator=",">
  290. #{item}
  291. </foreach>
  292. </if>
  293. <if test="businessId != null and businessId != ''">
  294. AND g.business_id = #{businessId}
  295. </if>
  296. <if test="projectId != null and projectId != ''">
  297. AND g.project_id = #{projectId}
  298. </if>
  299. <if test="schoolId != null and schoolId != ''">
  300. AND g.school_id = #{schoolId}
  301. </if>
  302. <if test="majorId != null and majorId != ''">
  303. AND g.major_id = #{majorId}
  304. </if>
  305. <if test="standPrice != null ">
  306. AND g.stand_price = #{standPrice}
  307. </if>
  308. <if test="searchKey != null and searchKey != ''">
  309. and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
  310. </if>
  311. <if test="goodsStatus != null ">
  312. AND g.goods_status = #{goodsStatus}
  313. </if>
  314. <if test="commitPeriodStatus != null ">
  315. AND g.commit_period_status = #{commitPeriodStatus}
  316. </if>
  317. <if test="studyStartTime != null and studyStartTime != '' and studyEndTime != null and studyEndTime != ''">
  318. and #{studyStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{studyEndTime} BETWEEN
  319. g.validity_start_time and g.validity_end_time
  320. </if>
  321. <if test="validityStartTime != null or validityEndTime != null ">
  322. AND (#{validityStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{validityEndTime}
  323. BETWEEN g.validity_start_time and g.validity_end_time)
  324. </if>
  325. <if test="subjectId != null and subjectId >0">
  326. AND FIND_IN_SET(#{subjectId},g.subject_ids)
  327. </if>
  328. <if test="subjectIdList != null and subjectIdList.size > 0 ">
  329. AND (
  330. <foreach collection="subjectIdList" item="item" index="index">
  331. <if test=" index == 0 ">
  332. FIND_IN_SET(#{item},g.subject_ids)
  333. </if>
  334. <if test=" index != 0 ">
  335. OR FIND_IN_SET(#{item},g.subject_ids)
  336. </if>
  337. </foreach>
  338. )
  339. </if>
  340. <if test="goodsType ==1 and haveCourse != null and haveCourse == 1">
  341. AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id
  342. = g.goods_id and c.`status` = 1
  343. ) >0
  344. </if>
  345. <if test="gradeType != null and gradeType != ''">
  346. AND g.grade_type = #{gradeType}
  347. </if>
  348. <!-- 数据范围过滤 -->
  349. ${params.dataScope}
  350. <if test="sortType != null and sortType == 2">
  351. ORDER BY g.show_sort DESC,g.stand_price ASC
  352. </if>
  353. <if test="sortType != null and sortType == 3">
  354. ORDER BY g.show_sort DESC,g.stand_price DESC
  355. </if>
  356. <if test="sortType != null and sortType == 1">
  357. ORDER BY g.show_sort DESC,g.create_time DESC
  358. </if>
  359. <if test="sortType == null">
  360. ORDER BY g.create_time DESC
  361. </if>
  362. </select>
  363. <select id="selectListToInput" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
  364. resultMap="GoodsResultVo">
  365. SELECT
  366. g.*,
  367. ps.supply_name,
  368. cet.education_name,
  369. cpt.project_name,
  370. cb.business_name,
  371. s.school_name,
  372. m.category_name,
  373. ot.type AS template_type,
  374. (SELECT gs.goods_name FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_name,
  375. (SELECT gs.code FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_code
  376. <if test="sectionNum ==1">
  377. ,(SELECT COUNT(m.id)+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_module_chapter p on
  378. n.chapter_id = p.chapter_id LEFT JOIN course_menu m on m.menu_id = p.module_id LEFT JOIN goods_course gc on
  379. gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(1))+(SELECT COUNT(n.id) FROM
  380. course_chapter_section n LEFT JOIN course_menu m on m.menu_id = n.chapter_id LEFT JOIN goods_course gc on
  381. gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(2)) FROM course_menu m LEFT JOIN
  382. goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(3)) as
  383. section_num
  384. </if>
  385. <if test="goodsType ==1">
  386. , (SELECT count(*) FROM goods_course where goods_id =g.goods_id ) as course_num
  387. , (SELECT count(*) FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id where
  388. cgg.goods_id = g.goods_id and cg.`status` = 1 ) as grade_num
  389. , (SELECT cg.grade_id FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
  390. where cgg.goods_id = g.goods_id and cg.`status` = 1 AND (unix_timestamp(now()) &lt; cg.class_end_time or
  391. cg.class_start_time is null) AND cg.`status` = 1 AND (SELECT COUNT(a.id) FROM class_grade_user a where
  392. a.grade_id = cg.grade_id and a.status =1) &lt; cg.student_upper limit 1) as grade_id
  393. , (SELECT cg.class_name FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
  394. where cgg.goods_id = g.goods_id and cg.`status` = 1 AND (unix_timestamp(now()) &lt; cg.class_end_time or
  395. cg.class_start_time is null) AND cg.`status` = 1 AND (SELECT COUNT(a.id) FROM class_grade_user a where
  396. a.grade_id = cg.grade_id and a.status =1) &lt; cg.student_upper limit 1) as grade_name
  397. </if>
  398. FROM
  399. goods g
  400. LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
  401. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  402. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  403. LEFT JOIN course_business cb ON g.business_id = cb.id
  404. LEFT JOIN school s ON s.id = g.school_id
  405. LEFT JOIN major m ON g.major_id = m.id
  406. LEFT JOIN order_input_template ot ON cb.template_status = ot.id
  407. WHERE
  408. 1 = 1
  409. AND g.goods_type != 5
  410. <if test="status != null and status.size()!=0 ">
  411. AND g.status in
  412. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  413. #{item}
  414. </foreach>
  415. </if>
  416. <if test="goodsIds != null and goodsIds.size()!=0 ">
  417. AND g.goods_id in
  418. <foreach collection="goodsIds" item="item" index="index" open="(" close=")" separator=",">
  419. #{item}
  420. </foreach>
  421. </if>
  422. <if test="goodsType != null and goodsType != ''">
  423. AND g.goods_type = #{goodsType}
  424. </if>
  425. <if test="makeGoodsId != null and makeGoodsId != ''">
  426. AND g.make_goods_id = #{makeGoodsId}
  427. </if>
  428. <if test="goodsName != null and goodsName != ''">
  429. AND g.goods_name like concat('%', #{goodsName}, '%')
  430. </if>
  431. <if test="educationTypeId != null and educationTypeId != ''">
  432. AND g.education_type_id = #{educationTypeId}
  433. </if>
  434. <if test="projectId != null and projectId != ''">
  435. AND g.project_id = #{projectId}
  436. </if>
  437. <if test="businessIds != null and businessIds.size()!=0 ">
  438. AND g.business_id in
  439. <foreach collection="businessIds" item="item" index="index" open="(" close=")" separator=",">
  440. #{item}
  441. </foreach>
  442. </if>
  443. <if test="businessId != null and businessId != ''">
  444. AND g.business_id = #{businessId}
  445. </if>
  446. <if test="projectId != null and projectId != ''">
  447. AND g.project_id = #{projectId}
  448. </if>
  449. <if test="schoolId != null and schoolId != ''">
  450. AND g.school_id = #{schoolId}
  451. </if>
  452. <if test="majorId != null and majorId != ''">
  453. AND g.major_id = #{majorId}
  454. </if>
  455. <if test="standPrice != null and standPrice != ''">
  456. AND g.stand_price = #{standPrice}
  457. </if>
  458. <if test="searchKey != null and searchKey != ''">
  459. and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
  460. </if>
  461. <if test="goodsStatus != null ">
  462. AND g.goods_status = #{goodsStatus}
  463. </if>
  464. <if test="studyStartTime != null and studyStartTime != '' and studyEndTime != null and studyEndTime != ''">
  465. and #{studyStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{studyEndTime} BETWEEN
  466. g.validity_start_time and g.validity_end_time
  467. </if>
  468. <if test="validityStartTime != null or validityEndTime != null ">
  469. AND (#{validityStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{validityEndTime}
  470. BETWEEN g.validity_start_time and g.validity_end_time)
  471. </if>
  472. <if test="subjectId != null and subjectId >0">
  473. AND FIND_IN_SET(#{subjectId},g.subject_ids)
  474. </if>
  475. <if test="goodsType ==1 and haveCourse != null and haveCourse == 1">
  476. AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id
  477. = g.goods_id and c.`status` = 1
  478. ) >0
  479. </if>
  480. <if test="sortType != null and sortType == 2">
  481. ORDER BY g.stand_price
  482. </if>
  483. <if test="sortType != null and sortType == 3">
  484. ORDER BY g.stand_price DESC
  485. </if>
  486. <if test="sortType == null or sortType == 1">
  487. ORDER BY g.create_time DESC
  488. </if>
  489. </select>
  490. <select id="selectDetail" parameterType="Long" resultMap="GoodsResultVo">
  491. SELECT g.*,
  492. ps.supply_name,
  493. cet.education_name,
  494. cpt.project_name,
  495. cb.business_name,
  496. cb.template_status as special_goods,
  497. s.school_name,
  498. m.category_name,
  499. ot.type AS template_type,
  500. (SELECT gs.goods_name FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_name,
  501. (SELECT gs.code FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_code,
  502. (SELECT count(DISTINCT c.subject_id)
  503. FROM course c
  504. LEFT JOIN goods_course gc ON gc.course_id = c.course_id
  505. WHERE gc.goods_id = g.goods_id) as subject_num,
  506. (SELECT GROUP_CONCAT(subject_name)
  507. from course_subject
  508. where FIND_IN_SET(id, g.subject_ids)) subject_names
  509. FROM goods g
  510. LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
  511. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  512. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  513. LEFT JOIN course_business cb ON g.business_id = cb.id
  514. LEFT JOIN school s ON s.id = g.school_id
  515. LEFT JOIN major m ON g.major_id = m.id
  516. LEFT JOIN order_input_template ot ON cb.template_status = ot.id
  517. WHERE g.goods_id = #{goodsId}
  518. </select>
  519. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo"
  520. resultMap="ExamNumberGoodsVoResult">
  521. SELECT
  522. goods_id,
  523. goods_name,
  524. validity_start_time,
  525. validity_end_time,
  526. goods_status,
  527. status,
  528. CODE,
  529. stand_price,
  530. <if test="filtration != null and filtration == 1">
  531. (case WHEN (SELECT COUNT(gs.goods_id) FROM goods gs where 1=1 and gs.make_goods_id = g.goods_id and
  532. gs.status =1 and gs.goods_type =4) >0 then 0 ELSE 1 end) as select_status
  533. </if>
  534. <if test="filtration != null and filtration == 2">
  535. (case WHEN (SELECT COUNT(gs.goods_id) FROM goods gs where 1=1 and gs.make_goods_id = g.goods_id and
  536. gs.status =1 and gs.goods_type =3) >0 then 0 ELSE 1 end) as select_status
  537. </if>
  538. FROM
  539. goods g
  540. WHERE
  541. 1 = 1
  542. and g.status in(1)
  543. and g.goods_type=1
  544. <if test="businessId != null and businessId != ''">
  545. and g.business_id = #{businessId}
  546. </if>
  547. <if test="goodsId != null and goodsId != ''">
  548. and g.goods_id = #{goodsId}
  549. </if>
  550. <if test="projectId != null and projectId != ''">
  551. and g.project_id = #{projectId}
  552. </if>
  553. <if test="goodsType != null and goodsType != ''">
  554. and g.goods_type = #{goodsType}
  555. </if>
  556. <if test="goodsStatus != null and goodsStatus != ''">
  557. and g.goods_status = #{goodsStatus}
  558. </if>
  559. <if test="searchKey != null and searchKey != ''">
  560. and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
  561. </if>
  562. order by g.create_time desc
  563. </select>
  564. <select id="selectUserDetail" parameterType="map" resultMap="GoodsResultVo">
  565. SELECT g.*,
  566. ps.supply_name,
  567. cet.education_name,
  568. cpt.project_name,
  569. cb.business_name,
  570. cb.template_status AS special_goods,
  571. s.school_name,
  572. m.category_name,
  573. ot.type AS template_type,
  574. (SELECT gs.goods_name FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_name,
  575. (SELECT gs.code FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_code,
  576. (SELECT DISTINCT cg.grade_id
  577. FROM class_grade_user cgu
  578. LEFT JOIN class_grade_goods cgg on cgg.grade_id = cgu.grade_id
  579. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  580. where cgu.user_id = #{userId}
  581. and cgg.goods_id = g.goods_id
  582. and cg.`status` = 1
  583. and unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time) as grade_id
  584. FROM goods g
  585. LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
  586. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  587. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  588. LEFT JOIN course_business cb ON g.business_id = cb.id
  589. LEFT JOIN school s ON s.id = g.school_id
  590. LEFT JOIN major m ON g.major_id = m.id
  591. LEFT JOIN order_input_template ot ON cb.template_status = ot.id
  592. WHERE g.goods_id = #{goodsId}
  593. </select>
  594. <select id="getQuestionNum" parameterType="Long" resultType="Long">
  595. SELECT count(DISTINCT question_id) question_num
  596. FROM exam_question
  597. WHERE find_in_set(
  598. exam_id, (
  599. SELECT concat(
  600. IFNULL((
  601. SELECT GROUP_CONCAT(exam_id)
  602. FROM question_chapter_exam
  603. WHERE FIND_IN_SET(chapter_exam_id,
  604. (SELECT concat(
  605. IFNULL(
  606. (SELECT GROUP_CONCAT(major_id) eids
  607. FROM goods_attached
  608. WHERE goods_id = #{goodsId}
  609. AND type = 2), ''),
  610. ',',
  611. IFNULL(
  612. (
  613. SELECT GROUP_CONCAT(chapter_exam_id) eids2
  614. FROM question_module_chapter
  615. WHERE module_exam_id IN
  616. (SELECT major_id
  617. FROM goods_attached
  618. WHERE goods_id = #{goodsId} AND type = 1)),
  619. ''
  620. ))))),
  621. ''
  622. ),
  623. ',',
  624. IFNULL((SELECT GROUP_CONCAT(major_id)
  625. FROM goods_attached
  626. WHERE goods_id = #{goodsId} AND type = 3), ''))))
  627. </select>
  628. <select id="getRandomQuestionNum" parameterType="map" resultType="Long">
  629. SELECT count(DISTINCT eq.question_id) question_num
  630. FROM exam_question eq
  631. LEFT JOIN exam e on eq.exam_id = e.exam_id
  632. WHERE find_in_set(
  633. eq.exam_id, (
  634. SELECT concat(
  635. IFNULL((
  636. SELECT GROUP_CONCAT(exam_id)
  637. FROM question_chapter_exam
  638. WHERE FIND_IN_SET(chapter_exam_id,
  639. (SELECT concat(
  640. IFNULL(
  641. (SELECT GROUP_CONCAT(major_id) eids
  642. FROM goods_attached
  643. WHERE goods_id = #{goodsId}
  644. AND type = 2), ''),
  645. ',',
  646. IFNULL(
  647. (
  648. SELECT GROUP_CONCAT(chapter_exam_id) eids2
  649. FROM question_module_chapter
  650. WHERE module_exam_id IN
  651. (SELECT major_id
  652. FROM goods_attached
  653. WHERE goods_id = #{goodsId} AND type = 1)),
  654. ''
  655. ))))),
  656. ''
  657. ),
  658. ',',
  659. IFNULL((SELECT GROUP_CONCAT(major_id)
  660. FROM goods_attached
  661. WHERE goods_id = #{goodsId} AND type = 3), ''))))
  662. and e.exam_paper_id = #{examPaperId}
  663. </select>
  664. <update id="queryUpGoods">
  665. update goods g
  666. set g.goods_status=0
  667. where unix_timestamp(now()) > g.validity_end_time
  668. and g.goods_status = 1
  669. </update>
  670. <select id="getExamNum" parameterType="Long" resultType="Long">
  671. SELECT count(exam_id) + ((
  672. SELECT count(major_id)
  673. FROM goods_attached
  674. WHERE goods_id = #{goodsId}
  675. AND type = 3
  676. )) AS exam_num
  677. FROM question_chapter_exam
  678. WHERE FIND_IN_SET(
  679. chapter_exam_id,
  680. (
  681. SELECT concat(
  682. IFNULL((SELECT GROUP_CONCAT(major_id) eids
  683. FROM goods_attached
  684. WHERE goods_id = #{goodsId} AND type = 2), ''),
  685. ',',
  686. IFNULL(
  687. (
  688. SELECT GROUP_CONCAT(chapter_exam_id) eids2
  689. FROM question_module_chapter
  690. WHERE module_exam_id IN (SELECT major_id
  691. FROM goods_attached
  692. WHERE goods_id = #{goodsId} AND type = 1)),
  693. ''
  694. ))))
  695. </select>
  696. <select id="getSectionNumByBo" parameterType="Long" resultMap="GoodsResultVo">
  697. SELECT (SELECT IFNULL(COUNT(m.id), 0) + (SELECT IFNULL(COUNT(n.id), 0)
  698. FROM course_chapter_section n
  699. LEFT JOIN course_module_chapter p on n.chapter_id = p.chapter_id
  700. LEFT JOIN course_menu m on m.menu_id = p.module_id
  701. LEFT JOIN goods_course gc on gc.course_id = m.course_id
  702. where gc.goods_id = g.goods_id
  703. and m.type in (1)) + (SELECT IFNULL(COUNT(n.id), 0)
  704. FROM course_chapter_section n
  705. LEFT JOIN course_menu m on m.menu_id = n.chapter_id
  706. LEFT JOIN goods_course gc on gc.course_id = m.course_id
  707. where gc.goods_id = g.goods_id
  708. and m.type in (2))
  709. FROM course_menu m
  710. LEFT JOIN goods_course gc on gc.course_id = m.course_id
  711. where gc.goods_id = g.goods_id
  712. and m.type in (3)) as section_num,
  713. (SELECT IFNULL(COUNT(1), 0) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
  714. (SELECT IFNULL(COUNT(m.id), 0)
  715. FROM goods_course c
  716. LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
  717. where m.type = 1
  718. and c.goods_id = g.goods_id) as exam_num
  719. FROM goods g
  720. WHERE g.goods_id = #{goodsId}
  721. </select>
  722. <select id="getOrderGoodsListByUser" parameterType="Long"
  723. resultType="com.zhongzheng.modules.goods.vo.UserGoodsListVo">
  724. SELECT og.goods_id AS goodsId,
  725. og.order_goods_id as orderGoodsId,
  726. o.order_id as orderId,
  727. g.goods_name as categoryName,
  728. m.category_name as majorName,
  729. o.tenant_id as tenantId,
  730. g.goods_type as courseType,
  731. concat('https://file.xyyxt.net/', g.cover_url) as imageUrl,
  732. o.create_time as createTimeStr,
  733. og.grade_id as gradeId
  734. FROM `order` o
  735. LEFT JOIN order_goods og ON o.order_sn = og.order_sn
  736. LEFT JOIN goods g ON og.goods_id = g.goods_id
  737. LEFT JOIN major m ON g.major_id = m.id
  738. WHERE o.user_id = #{userId}
  739. AND og.pay_status IN (2, 3, 4)
  740. AND og.refund_status !=2
  741. </select>
  742. <select id="countUserOrderGoods" parameterType="Long" resultType="com.zhongzheng.modules.goods.vo.UserOrderGoodsVo">
  743. SELECT og.order_goods_id,
  744. og.goods_id,
  745. og.grade_id
  746. FROM `order` o
  747. LEFT JOIN order_goods og ON o.order_sn = og.order_sn
  748. WHERE o.user_id = #{userId}
  749. AND og.goods_id = #{goodsId}
  750. AND og.pay_status IN (2, 3, 4)
  751. AND og.refund_status != 2
  752. AND og.`status` = 1
  753. AND o.`status` = 1
  754. AND o.tenant_id = #{tenantId}
  755. AND og.tenant_id = #{tenantId}
  756. </select>
  757. <select id="queryGoodsByIdTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
  758. SELECT *
  759. FROM `goods`
  760. WHERE goods_id = #{goodsId}
  761. AND tenant_id = #{tenantId}
  762. </select>
  763. <select id="queryGoodsByTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
  764. SELECT *
  765. FROM `goods`
  766. WHERE `code` = #{code}
  767. AND tenant_id = #{tenantId}
  768. </select>
  769. <select id="getGoodsByIdNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.goods.domain.Goods">
  770. SELECT *
  771. FROM `goods`
  772. WHERE goods_id = #{goodsId}
  773. </select>
  774. <select id="getGoodsByTenantTwo" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
  775. SELECT *
  776. FROM `goods`
  777. WHERE goods_name = #{goodsName} and code = #{code} and tenant_id = #{tenantId}
  778. </select>
  779. <update id="updateByTenant" parameterType="com.zhongzheng.modules.goods.domain.Goods">
  780. UPDATE goods
  781. SET `year` = #{year},
  782. supply_id = #{supplyId},
  783. goods_type = #{goodsType},
  784. education_type_id = #{educationTypeId},
  785. business_id = #{businessId},
  786. school_id = #{schoolId},
  787. major_id = #{majorId},
  788. goods_name = #{goodsName},
  789. stand_price = #{standPrice},
  790. lowest_price = #{lowestPrice},
  791. create_time = #{createTime},
  792. update_time = #{updateTime},
  793. `status` = #{status},
  794. validity_start_time = #{validityStartTime},
  795. validity_end_time = #{validityEndTime},
  796. study_start_time = #{studyStartTime},
  797. study_end_time = #{studyEndTime},
  798. certificate_ids = #{certificateIds},
  799. introduce = #{introduce},
  800. suitable_object = #{suitableObject},
  801. buy_note = #{buyNote},
  802. pc_detail_html = #{pcDetailHtml},
  803. mobile_detail_html = #{mobileDetailHtml},
  804. goods_status = #{goodsStatus},
  805. cover_url = #{coverUrl},
  806. class_hours = #{classHours},
  807. stand_price_json = #{standPriceJson},
  808. tenant_id = #{tenantId},
  809. `code` = #{code},
  810. project_id = #{projectId},
  811. goods_audition_config = #{goodsAuditionConfig},
  812. goods_photograph_config = #{goodsPhotographConfig},
  813. goods_play_config = #{goodsPlayConfig},
  814. goods_exam_config = #{goodsExamConfig},
  815. handouts_id = #{handoutsId},
  816. make_start_time = #{makeStartTime},
  817. make_end_time = #{makeEndTime},
  818. study_count = #{studyCount},
  819. goods_photo_exam_config = #{goodsPhotoExamConfig},
  820. make_goods_id = #{makeGoodsId},
  821. service_time_type = #{serviceTimeType},
  822. service_time_num = #{serviceTimeNum},
  823. section_max_num = #{sectionMaxNum},
  824. exam_number = #{examNumber},
  825. do_number = #{doNumber},
  826. teacher_id = #{teacherId},
  827. subject_ids = #{subjectIds},
  828. certificate_type_id = #{certificateTypeId},
  829. certificate_id = #{certificateId},
  830. certificate_tp_id = #{certificateTpId},
  831. line_price = #{linePrice},
  832. spec_template_id = #{specTemplateId},
  833. show_status = #{showStatus},
  834. show_sort = #{showSort}
  835. WHERE goods_id = #{goodsId}
  836. and tenant_id = #{tenantId}
  837. </update>
  838. <select id="getUserGoodsListAll" parameterType="com.zhongzheng.modules.goods.bo.UserGoodsListAllBo"
  839. resultType="com.zhongzheng.modules.goods.vo.GoodsListAllVo">
  840. SELECT
  841. o.order_id,
  842. og.order_goods_id,
  843. g.goods_id,
  844. g.goods_name,
  845. g.goods_type,
  846. g.class_hours,
  847. g.validity_start_time,
  848. g.validity_end_time,
  849. g.study_start_time AS serviceStartTime,
  850. g.study_end_time AS serviceEndTime,
  851. cg.class_status,
  852. cg.class_start_time,
  853. cg.class_end_time
  854. FROM
  855. order_goods og
  856. LEFT JOIN `order` o ON og.order_sn = o.order_sn
  857. LEFT JOIN goods g ON og.goods_id = g.goods_id
  858. LEFT JOIN class_grade cg ON og.grade_id = cg.grade_id
  859. WHERE
  860. og.pay_status IN ( 2, 3, 4 )
  861. AND og.refund_status != 2
  862. <if test="goodsType != null and goodsType != ''">
  863. AND g.goods_type = #{goodsType}
  864. </if>
  865. <if test="goodsName != null and goodsName != ''">
  866. AND g.goods_name like concat('%', #{goodsName}, '%')
  867. </if>
  868. <if test="educationTypeId != null and educationTypeId != ''">
  869. AND g.education_type_id = #{educationTypeId}
  870. </if>
  871. <if test="businessId != null and businessId != ''">
  872. AND g.business_id = #{businessId}
  873. </if>
  874. <if test="userId != null and userId != ''">
  875. AND o.user_id = #{userId}
  876. </if>
  877. </select>
  878. <select id="getCourseExamNum" parameterType="java.lang.Long" resultType="java.lang.Long">
  879. SELECT
  880. COUNT(*)
  881. FROM
  882. course_menu_exam cme
  883. LEFT JOIN goods_course gc ON cme.course_id = gc.course_id
  884. WHERE
  885. cme.type != 2
  886. AND gc.goods_id = #{goodsId}
  887. </select>
  888. <select id="getUserStudyNum" parameterType="java.lang.Long" resultType="java.lang.Long">
  889. SELECT COUNT(*) FROM
  890. (SELECT COUNT(*) num FROM user_study_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} GROUP BY course_id,module_id,chapter_id,section_id UNION ALL
  891. SELECT COUNT(*) num FROM user_bank_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} AND type != 2 GROUP BY course_id,module_id,chapter_id,exam_id) a
  892. </select>
  893. <select id="getAlikeGoods" parameterType="com.zhongzheng.modules.goods.domain.Goods" resultType="com.zhongzheng.modules.goods.vo.GoodsVo">
  894. SELECT g.*,
  895. cet.education_name as educationName,
  896. cb.business_name as businessName,
  897. cpt.project_name as projectName,
  898. m.category_name as categoryName
  899. from goods g
  900. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id and cet.tenant_id = #{tenantId}
  901. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id and cpt.tenant_id = #{tenantId}
  902. LEFT JOIN course_business cb ON g.business_id = cb.id and cb.tenant_id = #{tenantId}
  903. LEFT JOIN major m ON g.major_id = m.id and m.tenant_id = #{tenantId}
  904. where
  905. g.goods_status = 1
  906. and g.status = 1
  907. and g.education_type_id = #{educationTypeId}
  908. and g.project_id = #{projectId}
  909. and g.business_id = #{businessId}
  910. and g.stand_price = #{standPrice}
  911. and g.tenant_id = #{tenantId}
  912. </select>
  913. <update id="updateHandoutsId" parameterType="java.lang.Long">
  914. UPDATE goods SET handouts_id = #{handoutsId} WHERE goods_id = #{goodsId} and tenant_id = #{tenantId}
  915. </update>
  916. <select id="getGoodsBusinessName" parameterType="java.lang.Long" resultType="java.lang.String">
  917. SELECT
  918. CONCAT( cet.education_name, cb.business_name, cpt.project_name )
  919. FROM
  920. goods g
  921. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  922. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  923. LEFT JOIN course_business cb ON g.business_id = cb.id
  924. WHERE
  925. g.goods_id = #{goodsId}
  926. </select>
  927. </mapper>