12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.zhongzheng.modules.goods.mapper.GoodsMapper">
- <resultMap type="com.zhongzheng.modules.goods.domain.Goods" id="GoodsResult">
- <result property="goodsId" column="goods_id"/>
- <result property="year" column="year"/>
- <result property="supplyId" column="supply_id"/>
- <result property="goodsType" column="goods_type"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="majorId" column="major_id"/>
- <result property="goodsName" column="goods_name"/>
- <result property="standPrice" column="stand_price"/>
- <result property="lowestPrice" column="lowest_price"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="status" column="status"/>
- <result property="validityStartTime" column="validity_start_time"/>
- <result property="validityEndTime" column="validity_end_time"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="certificateIds" column="certificate_ids"/>
- <result property="introduce" column="introduce"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="buyNote" column="buy_note"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="goodsStatus" column="goods_status"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="classHours" column="class_hours"/>
- <result property="standPriceJson" column="stand_price_json"/>
- <result property="code" column="code"/>
- <result property="supplyName" column="supply_name"/>
- <result property="projectId" column="project_id"/>
- <result property="goodsAuditionConfig" column="goods_audition_config"/>
- <result property="goodsPhotographConfig" column="goods_photograph_config"/>
- <result property="goodsPlayConfig" column="goods_play_config"/>
- <result property="goodsExamConfig" column="goods_exam_config"/>
- <result property="handoutsId" column="handouts_id"/>
- <result property="serviceTimeType" column="service_time_type"/>
- <result property="serviceTimeNum" column="service_time_num"/>
- <result property="sectionMaxNum" column="section_max_num"/>
- <result property="examNumber" column="exam_number"/>
- <result property="doNumber" column="do_number"/>
- <result property="teacherId" column="teacher_id"/>
- <result property="subjectIds" column="subject_ids"/>
- <result property="certificateTypeId" column="certificate_type_id"/>
- <result property="certificateId" column="certificate_id"/>
- <result property="certificateTpId" column="certificate_tp_id"/>
- <result property="commitPeriodStatus" column="commit_period_status"/>
- <result property="commitPeriodRemark" column="commit_period_remark"/>
- <result property="gradeType" column="grade_type"/>
- <result property="examLimitClient" column="exam_limit_client"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.goods.vo.GoodsVo" id="GoodsResultVo">
- <result property="goodsId" column="goods_id"/>
- <result property="year" column="year"/>
- <result property="supplyId" column="supply_id"/>
- <result property="goodsType" column="goods_type"/>
- <result property="gradeId" column="grade_id"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="schoolId" column="school_id"/>
- <result property="majorId" column="major_id"/>
- <result property="goodsName" column="goods_name"/>
- <result property="standPrice" column="stand_price"/>
- <result property="lowestPrice" column="lowest_price"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="status" column="status"/>
- <result property="validityStartTime" column="validity_start_time"/>
- <result property="validityEndTime" column="validity_end_time"/>
- <result property="studyStartTime" column="study_start_time"/>
- <result property="studyEndTime" column="study_end_time"/>
- <result property="certificateIds" column="certificate_ids"/>
- <result property="introduce" column="introduce"/>
- <result property="suitableObject" column="suitable_object"/>
- <result property="buyNote" column="buy_note"/>
- <result property="pcDetailHtml" column="pc_detail_html"/>
- <result property="mobileDetailHtml" column="mobile_detail_html"/>
- <result property="goodsStatus" column="goods_status"/>
- <result property="coverUrl" column="cover_url"/>
- <result property="classHours" column="class_hours"/>
- <result property="standPriceJson" column="stand_price_json"/>
- <result property="code" column="code"/>
- <result property="projectId" column="project_id"/>
- <result property="goodsAuditionConfig" column="goods_audition_config"/>
- <result property="goodsPhotographConfig" column="goods_photograph_config"/>
- <result property="goodsAuditionExamConfig" column="goods_audition_exam_config"/>
- <result property="goodsPlayConfig" column="goods_play_config"/>
- <result property="goodsExamConfig" column="goods_exam_config"/>
- <result property="sectionMaxNum" column="section_max_num"/>
- <result property="specTemplateId" column="spec_template_id"/>
- <result property="showStatus" column="show_status"/>
- <result property="showSort" column="show_sort"/>
- <result property="specialGoods" column="special_goods"/>
- <result property="externalLink" column="external_link"/>
- <result property="externalLinkStatus" column="external_link_status"/>
- <result property="sevenYear" column="seven_year"/>
- <result property="supplyName" column="supply_name"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="schoolName" column="school_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="handoutsId" column="handouts_id"/>
- <result property="templateType" column="template_type"/>
- <result property="period" column="period"/>
- <result property="makeStartTime" column="make_start_time"/>
- <result property="makeEndTime" column="make_end_time"/>
- <result property="studyCount" column="study_count"/>
- <result property="makeGoodsName" column="make_goods_name"/>
- <result property="makeGoodsCode" column="make_goods_code"/>
- <result property="courseNum" column="course_num"/>
- <result property="sectionNum" column="section_num"/>
- <result property="serviceTimeType" column="service_time_type"/>
- <result property="serviceTimeNum" column="service_time_num"/>
- <result property="gradeNum" column="grade_num"/>
- <result property="gradeId" column="grade_id"/>
- <result property="gradeName" column="grade_name"/>
- <result property="examNumber" column="exam_number"/>
- <result property="doNumber" column="do_number"/>
- <result property="orderNum" column="order_num"/>
- <result property="teacherId" column="teacher_id"/>
- <result property="goodsLiveNum" column="goods_live_num"/>
- <result property="subjectIds" column="subject_ids"/>
- <result property="certificateTypeId" column="certificate_type_id"/>
- <result property="certificateId" column="certificate_id"/>
- <result property="certificateTpId" column="certificate_tp_id"/>
- <result property="subjectNames" column="subject_names"/>
- <result property="buyUserNum" column="buy_user_num"/>
- <result property="chapterNum" column="chapter_num"/>
- <result property="examNum" column="exam_num"/>
- <result property="linePrice" column="line_price"/>
- <result property="specTemplateNumber" column="spec_template_number"/>
- <result property="goodsLearningOrder" column="goods_learning_order"/>
- <result property="commitPeriodStatus" column="commit_period_status"/>
- <result property="commitPeriodRemark" column="commit_period_remark"/>
- <result property="gradeType" column="grade_type"/>
- <result property="examLimitClient" column="exam_limit_client"/>
- <result property="optionalYear" column="optional_year"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
- <result property="id" column="id"/>
- <result property="examNumberId" column="exam_number_id"/>
- <result property="goodsId" column="goods_id"/>
- <result property="goodsName" column="goods_name"/>
- <result property="code" column="code"/>
- <result property="standPrice" column="stand_price"/>
- <result property="goodsStatus" column="goods_status"/>
- <result property="validityStartTime" column="validity_start_time"/>
- <result property="validityEndTime" column="validity_end_time"/>
- <result property="goodsStatus" column="goods_status"/>
- <result property="status" column="status"/>
- <result property="selectStatus" column="select_status"/>
- </resultMap>
- <select id="getSectionNum" parameterType="Long" resultType="Long">
- SELECT COUNT(m.id) + (
- SELECT COUNT(n.id)
- FROM course_chapter_section n
- LEFT JOIN course_module_chapter p ON n.chapter_id = p.chapter_id
- LEFT JOIN course_menu m ON m.menu_id = p.module_id
- LEFT JOIN goods_course gc ON gc.course_id = m.course_id
- WHERE gc.goods_id = #{goodsId}
- AND m.type = 1) + (
- SELECT COUNT(n.id)
- FROM course_chapter_section n
- LEFT JOIN course_menu m ON m.menu_id = n.chapter_id
- LEFT JOIN goods_course gc ON gc.course_id = m.course_id
- WHERE gc.goods_id = #{goodsId}
- AND m.type = 2)
- FROM course_menu m
- LEFT JOIN goods_course gc ON gc.course_id = m.course_id
- WHERE gc.goods_id = #{goodsId}
- AND m.type = 3
- </select>
- <select id="selectAllList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="GoodsResultVo">
- SELECT
- g.*,
- ps.supply_name,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- cb.goods_learning_order,
- s.school_name,
- m.category_name,
- (SELECT GROUP_CONCAT(subject_name) from course_subject where FIND_IN_SET(id,g.subject_ids)) subject_names,
- (SELECT COUNT( DISTINCT gar.spec_template_id ) FROM goods_spec_attribute_relation gar WHERE gar.goods_id =
- g.goods_id AND gar.`status` = 1 ) spec_template_number,
- ot.type AS template_type,
- (SELECT gs.goods_name FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_name,
- (SELECT gs.code FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_code
- <if test="chapterNum ==1">
- ,(SELECT COUNT(m.id)+(SELECT COUNT(p.id) FROM course_module_chapter p LEFT JOIN course_menu m on m.menu_id =
- p.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and
- m.type in(1))+(SELECT COUNT(cmc.id) FROM course_module_chapter cmc LEFT JOIN course_menu m on m.menu_id =
- cmc.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and
- m.type in(2)) FROM course_menu m LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id =
- g.goods_id and m.type in(3)) as chapter_num
- </if>
- ,(case WHEN g.goods_type =1 then (SELECT count(*) FROM goods_course gc LEFT JOIN course c on gc.course_id =
- c.course_id where gc.goods_id =g.goods_id and c.course_show=1) ELSE 0 end) as course_num
- <if test="goodsType ==1">
- , (SELECT count(*) FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id where
- cgg.goods_id = g.goods_id and cg.`status` = 1 ) as grade_num
- </if>
- <if test="goodsType ==2">
- , (SELECT count(*) from order_goods og where og.goods_id = g.goods_id and og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status IN (0,3,1) ) as order_num
- </if>
- <if test="getOrderNum != null and getOrderNum == 1">
- ,ou.goods_live_num
- </if>
- <if test="getUserNum != null and getUserNum == 1">
- ,(SELECT count(*) from order_goods og where og.goods_id = g.goods_id and og.`status` = 1
- AND og.refund_status in (0,1,3)
- AND og.pay_status in (2,3,4)) as buy_user_num
- </if>
- FROM
- goods g
- LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN school s ON s.id = g.school_id
- LEFT JOIN major m ON g.major_id = m.id
- LEFT JOIN order_input_template ot ON cb.template_status = ot.id
- <if test="getOrderNum != null and getOrderNum == 1">
- LEFT JOIN (
- SELECT
- og.goods_id,
- sum( CASE WHEN g.goods_type = 6 THEN 1 ELSE 0 END ) AS goods_live_num
- FROM
- `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- WHERE o.`status` = 1
- AND og.refund_status in (0,1,3)
- AND og.pay_status in (2,3,4)
- GROUP BY
- og.goods_id
- ) ou ON g.goods_id = ou.goods_id
- </if>
- WHERE
- 1 = 1
- AND g.goods_type != 5
- <if test="status != null and status.size()!=0 ">
- AND g.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="goodsIds != null and goodsIds.size()!=0 ">
- AND g.goods_id in
- <foreach collection="goodsIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="goodsTypes != null and goodsTypes.size()!=0 ">
- AND g.goods_type in
- <foreach collection="goodsTypes" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="goodsType != null and goodsType != ''">
- AND g.goods_type = #{goodsType}
- </if>
- <if test="showStatus != null and showStatus != ''">
- AND g.show_status = #{showStatus}
- </if>
- <if test="code != null and code != ''">
- AND g.code = #{code}
- </if>
- <if test="makeGoodsId != null and makeGoodsId != ''">
- AND g.make_goods_id = #{makeGoodsId}
- </if>
- <if test="goodsName != null and goodsName != ''">
- AND g.goods_name like concat('%', #{goodsName}, '%')
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </if>
- <if test="businessIds != null and businessIds.size()!=0 ">
- AND g.business_id in
- <foreach collection="businessIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND g.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="standPrice != null ">
- AND g.stand_price = #{standPrice}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
- </if>
- <if test="goodsStatus != null ">
- AND g.goods_status = #{goodsStatus}
- </if>
- <if test="commitPeriodStatus != null ">
- AND g.commit_period_status = #{commitPeriodStatus}
- </if>
- <if test="studyStartTime != null and studyStartTime != '' and studyEndTime != null and studyEndTime != ''">
- and #{studyStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{studyEndTime} BETWEEN
- g.validity_start_time and g.validity_end_time
- </if>
- <if test="validityStartTime != null or validityEndTime != null ">
- AND (#{validityStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{validityEndTime}
- BETWEEN g.validity_start_time and g.validity_end_time)
- </if>
- <if test="subjectId != null and subjectId >0">
- AND FIND_IN_SET(#{subjectId},g.subject_ids)
- </if>
- <if test="subjectIdList != null and subjectIdList.size > 0 ">
- AND (
- <foreach collection="subjectIdList" item="item" index="index">
- <if test=" index == 0 ">
- FIND_IN_SET(#{item},g.subject_ids)
- </if>
- <if test=" index != 0 ">
- OR FIND_IN_SET(#{item},g.subject_ids)
- </if>
- </foreach>
- )
- </if>
- <if test="goodsType ==1 and haveCourse != null and haveCourse == 1">
- AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id
- = g.goods_id and c.`status` = 1
- ) >0
- </if>
- <if test="gradeType != null and gradeType != ''">
- AND g.grade_type = #{gradeType}
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- <if test="sortType != null and sortType == 2">
- ORDER BY g.show_sort DESC,g.stand_price ASC
- </if>
- <if test="sortType != null and sortType == 3">
- ORDER BY g.show_sort DESC,g.stand_price DESC
- </if>
- <if test="sortType != null and sortType == 1">
- ORDER BY g.show_sort DESC,g.create_time DESC
- </if>
- <if test="sortType == null">
- ORDER BY g.create_time DESC
- </if>
- </select>
- <select id="selectListToInput" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
- resultMap="GoodsResultVo">
- SELECT
- g.*,
- ps.supply_name,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- s.school_name,
- m.category_name,
- ot.type AS template_type,
- (SELECT gs.goods_name FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_name,
- (SELECT gs.code FROM goods gs where 1=1 and g.make_goods_id = gs.goods_id) as make_goods_code
- <if test="sectionNum ==1">
- ,(SELECT COUNT(m.id)+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_module_chapter p on
- n.chapter_id = p.chapter_id LEFT JOIN course_menu m on m.menu_id = p.module_id LEFT JOIN goods_course gc on
- gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(1))+(SELECT COUNT(n.id) FROM
- course_chapter_section n LEFT JOIN course_menu m on m.menu_id = n.chapter_id LEFT JOIN goods_course gc on
- gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(2)) FROM course_menu m LEFT JOIN
- goods_course gc on gc.course_id = m.course_id where gc.goods_id = g.goods_id and m.type in(3)) as
- section_num
- </if>
- <if test="goodsType ==1">
- , (SELECT count(*) FROM goods_course where goods_id =g.goods_id ) as course_num
- , (SELECT count(*) FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id where
- cgg.goods_id = g.goods_id and cg.`status` = 1 ) as grade_num
- , (SELECT cg.grade_id FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
- where cgg.goods_id = g.goods_id and cg.`status` = 1 AND (unix_timestamp(now()) < cg.class_end_time or
- cg.class_start_time is null) AND cg.`status` = 1 AND (SELECT COUNT(a.id) FROM class_grade_user a where
- a.grade_id = cg.grade_id and a.status =1) < cg.student_upper limit 1) as grade_id
- , (SELECT cg.class_name FROM class_grade cg LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
- where cgg.goods_id = g.goods_id and cg.`status` = 1 AND (unix_timestamp(now()) < cg.class_end_time or
- cg.class_start_time is null) AND cg.`status` = 1 AND (SELECT COUNT(a.id) FROM class_grade_user a where
- a.grade_id = cg.grade_id and a.status =1) < cg.student_upper limit 1) as grade_name
- </if>
- FROM
- goods g
- LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN school s ON s.id = g.school_id
- LEFT JOIN major m ON g.major_id = m.id
- LEFT JOIN order_input_template ot ON cb.template_status = ot.id
- WHERE
- 1 = 1
- AND g.goods_type != 5
- <if test="status != null and status.size()!=0 ">
- AND g.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="goodsIds != null and goodsIds.size()!=0 ">
- AND g.goods_id in
- <foreach collection="goodsIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="goodsType != null and goodsType != ''">
- AND g.goods_type = #{goodsType}
- </if>
- <if test="makeGoodsId != null and makeGoodsId != ''">
- AND g.make_goods_id = #{makeGoodsId}
- </if>
- <if test="goodsName != null and goodsName != ''">
- AND g.goods_name like concat('%', #{goodsName}, '%')
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </if>
- <if test="businessIds != null and businessIds.size()!=0 ">
- AND g.business_id in
- <foreach collection="businessIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="projectId != null and projectId != ''">
- AND g.project_id = #{projectId}
- </if>
- <if test="schoolId != null and schoolId != ''">
- AND g.school_id = #{schoolId}
- </if>
- <if test="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="standPrice != null and standPrice != ''">
- AND g.stand_price = #{standPrice}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
- </if>
- <if test="goodsStatus != null ">
- AND g.goods_status = #{goodsStatus}
- </if>
- <if test="studyStartTime != null and studyStartTime != '' and studyEndTime != null and studyEndTime != ''">
- and #{studyStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{studyEndTime} BETWEEN
- g.validity_start_time and g.validity_end_time
- </if>
- <if test="validityStartTime != null or validityEndTime != null ">
- AND (#{validityStartTime} BETWEEN g.validity_start_time and g.validity_end_time or #{validityEndTime}
- BETWEEN g.validity_start_time and g.validity_end_time)
- </if>
- <if test="subjectId != null and subjectId >0">
- AND FIND_IN_SET(#{subjectId},g.subject_ids)
- </if>
- <if test="goodsType ==1 and haveCourse != null and haveCourse == 1">
- AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id
- = g.goods_id and c.`status` = 1
- ) >0
- </if>
- <if test="sortType != null and sortType == 2">
- ORDER BY g.stand_price
- </if>
- <if test="sortType != null and sortType == 3">
- ORDER BY g.stand_price DESC
- </if>
- <if test="sortType == null or sortType == 1">
- ORDER BY g.create_time DESC
- </if>
- </select>
- <select id="selectDetail" parameterType="Long" resultMap="GoodsResultVo">
- SELECT g.*,
- ps.supply_name,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- cb.template_status as special_goods,
- s.school_name,
- m.category_name,
- ot.type AS template_type,
- (SELECT gs.goods_name FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_name,
- (SELECT gs.code FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_code,
- (SELECT count(DISTINCT c.subject_id)
- FROM course c
- LEFT JOIN goods_course gc ON gc.course_id = c.course_id
- WHERE gc.goods_id = g.goods_id) as subject_num,
- (SELECT GROUP_CONCAT(subject_name)
- from course_subject
- where FIND_IN_SET(id, g.subject_ids)) subject_names
- FROM goods g
- LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN school s ON s.id = g.school_id
- LEFT JOIN major m ON g.major_id = m.id
- LEFT JOIN order_input_template ot ON cb.template_status = ot.id
- WHERE g.goods_id = #{goodsId}
- </select>
- <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo"
- resultMap="ExamNumberGoodsVoResult">
- SELECT
- goods_id,
- goods_name,
- validity_start_time,
- validity_end_time,
- goods_status,
- status,
- CODE,
- stand_price,
- <if test="filtration != null and filtration == 1">
- (case WHEN (SELECT COUNT(gs.goods_id) FROM goods gs where 1=1 and gs.make_goods_id = g.goods_id and
- gs.status =1 and gs.goods_type =4) >0 then 0 ELSE 1 end) as select_status
- </if>
- <if test="filtration != null and filtration == 2">
- (case WHEN (SELECT COUNT(gs.goods_id) FROM goods gs where 1=1 and gs.make_goods_id = g.goods_id and
- gs.status =1 and gs.goods_type =3) >0 then 0 ELSE 1 end) as select_status
- </if>
- FROM
- goods g
- WHERE
- 1 = 1
- and g.status in(1)
- and g.goods_type=1
- <if test="businessId != null and businessId != ''">
- and g.business_id = #{businessId}
- </if>
- <if test="goodsId != null and goodsId != ''">
- and g.goods_id = #{goodsId}
- </if>
- <if test="projectId != null and projectId != ''">
- and g.project_id = #{projectId}
- </if>
- <if test="goodsType != null and goodsType != ''">
- and g.goods_type = #{goodsType}
- </if>
- <if test="goodsStatus != null and goodsStatus != ''">
- and g.goods_status = #{goodsStatus}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
- </if>
- order by g.create_time desc
- </select>
- <select id="selectUserDetail" parameterType="map" resultMap="GoodsResultVo">
- SELECT g.*,
- ps.supply_name,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- cb.template_status AS special_goods,
- s.school_name,
- m.category_name,
- ot.type AS template_type,
- (SELECT gs.goods_name FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_name,
- (SELECT gs.code FROM goods gs where 1 = 1 and g.make_goods_id = gs.goods_id) as make_goods_code,
- (SELECT DISTINCT cg.grade_id
- FROM class_grade_user cgu
- LEFT JOIN class_grade_goods cgg on cgg.grade_id = cgu.grade_id
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
- where cgu.user_id = #{userId}
- <if test="orderGoodsId != null and orderGoodsId != ''">
- and cgu.order_goods_id = #{orderGoodsId}
- </if>
- and cgg.goods_id = g.goods_id
- and cg.`status` = 1
- and unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time limit 1) as grade_id
- FROM goods g
- LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN school s ON s.id = g.school_id
- LEFT JOIN major m ON g.major_id = m.id
- LEFT JOIN order_input_template ot ON cb.template_status = ot.id
- WHERE g.goods_id = #{goodsId}
- </select>
- <select id="getQuestionNum" parameterType="Long" resultType="Long">
- SELECT count(DISTINCT question_id) question_num
- FROM exam_question
- WHERE find_in_set(
- exam_id, (
- SELECT concat(
- IFNULL((
- SELECT GROUP_CONCAT(exam_id)
- FROM question_chapter_exam
- WHERE FIND_IN_SET(chapter_exam_id,
- (SELECT concat(
- IFNULL(
- (SELECT GROUP_CONCAT(major_id) eids
- FROM goods_attached
- WHERE goods_id = #{goodsId}
- AND type = 2), ''),
- ',',
- IFNULL(
- (
- SELECT GROUP_CONCAT(chapter_exam_id) eids2
- FROM question_module_chapter
- WHERE module_exam_id IN
- (SELECT major_id
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 1)),
- ''
- ))))),
- ''
- ),
- ',',
- IFNULL((SELECT GROUP_CONCAT(major_id)
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 3), ''))))
- </select>
- <select id="getRandomQuestionNum" parameterType="map" resultType="Long">
- SELECT count(DISTINCT eq.question_id) question_num
- FROM exam_question eq
- LEFT JOIN exam e on eq.exam_id = e.exam_id
- WHERE find_in_set(
- eq.exam_id, (
- SELECT concat(
- IFNULL((
- SELECT GROUP_CONCAT(exam_id)
- FROM question_chapter_exam
- WHERE FIND_IN_SET(chapter_exam_id,
- (SELECT concat(
- IFNULL(
- (SELECT GROUP_CONCAT(major_id) eids
- FROM goods_attached
- WHERE goods_id = #{goodsId}
- AND type = 2), ''),
- ',',
- IFNULL(
- (
- SELECT GROUP_CONCAT(chapter_exam_id) eids2
- FROM question_module_chapter
- WHERE module_exam_id IN
- (SELECT major_id
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 1)),
- ''
- ))))),
- ''
- ),
- ',',
- IFNULL((SELECT GROUP_CONCAT(major_id)
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 3), ''))))
- and e.exam_paper_id = #{examPaperId}
- </select>
- <update id="queryUpGoods">
- update goods g
- set g.goods_status=0
- where unix_timestamp(now()) > g.validity_end_time
- and g.goods_status = 1
- </update>
- <select id="getExamNum" parameterType="Long" resultType="Long">
- SELECT count(exam_id) + ((
- SELECT count(major_id)
- FROM goods_attached
- WHERE goods_id = #{goodsId}
- AND type = 3
- )) AS exam_num
- FROM question_chapter_exam
- WHERE FIND_IN_SET(
- chapter_exam_id,
- (
- SELECT concat(
- IFNULL((SELECT GROUP_CONCAT(major_id) eids
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 2), ''),
- ',',
- IFNULL(
- (
- SELECT GROUP_CONCAT(chapter_exam_id) eids2
- FROM question_module_chapter
- WHERE module_exam_id IN (SELECT major_id
- FROM goods_attached
- WHERE goods_id = #{goodsId} AND type = 1)),
- ''
- ))))
- </select>
- <select id="getSectionNumByBo" parameterType="Long" resultMap="GoodsResultVo">
- SELECT (SELECT IFNULL(COUNT(m.id), 0) + (SELECT IFNULL(COUNT(n.id), 0)
- FROM course_chapter_section n
- LEFT JOIN course_module_chapter p on n.chapter_id = p.chapter_id
- LEFT JOIN course_menu m on m.menu_id = p.module_id
- LEFT JOIN goods_course gc on gc.course_id = m.course_id
- where gc.goods_id = g.goods_id
- and m.type in (1)) + (SELECT IFNULL(COUNT(n.id), 0)
- FROM course_chapter_section n
- LEFT JOIN course_menu m on m.menu_id = n.chapter_id
- LEFT JOIN goods_course gc on gc.course_id = m.course_id
- where gc.goods_id = g.goods_id
- and m.type in (2))
- FROM course_menu m
- LEFT JOIN goods_course gc on gc.course_id = m.course_id
- where gc.goods_id = g.goods_id
- and m.type in (3)) as section_num,
- (SELECT IFNULL(COUNT(1), 0) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
- (SELECT IFNULL(COUNT(m.id), 0)
- FROM goods_course c
- LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
- where m.type = 1
- and c.goods_id = g.goods_id) as exam_num
- FROM goods g
- WHERE g.goods_id = #{goodsId}
- </select>
- <select id="getOrderGoodsListByUser" parameterType="Long"
- resultType="com.zhongzheng.modules.goods.vo.UserGoodsListVo">
- SELECT og.goods_id AS goodsId,
- og.order_goods_id as orderGoodsId,
- o.order_id as orderId,
- g.goods_name as categoryName,
- m.category_name as majorName,
- o.tenant_id as tenantId,
- g.goods_type as courseType,
- concat('https://file.xyyxt.net/', g.cover_url) as imageUrl,
- o.create_time as createTimeStr,
- og.grade_id as gradeId
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE o.user_id = #{userId}
- AND og.pay_status IN (2, 3, 4)
- AND og.refund_status !=2
- </select>
- <select id="getUserOrderGoodsList" parameterType="Long"
- resultType="com.zhongzheng.modules.goods.vo.UserOrderGoodsListVo">
- SELECT og.goods_id AS goodsId,
- og.order_goods_id as orderGoodsId,
- o.order_id as orderId,
- g.goods_name as categoryName,
- m.category_name as majorName,
- o.tenant_id as tenantId,
- g.goods_type as courseType,
- concat('https://file.xyyxt.net/', g.cover_url) as imageUrl,
- o.create_time as createTimeStr,
- og.grade_id as gradeId
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE o.user_id = #{userId}
- AND og.pay_status IN (2, 3, 4)
- AND og.refund_status !=2
- </select>
- <select id="countUserOrderGoods" parameterType="Long" resultType="com.zhongzheng.modules.goods.vo.UserOrderGoodsVo">
- SELECT og.order_goods_id,
- og.goods_id,
- og.grade_id
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- WHERE o.user_id = #{userId}
- AND og.goods_id = #{goodsId}
- AND og.pay_status IN (2, 3, 4)
- AND og.refund_status != 2
- AND og.`status` = 1
- AND o.`status` = 1
- AND o.tenant_id = #{tenantId}
- AND og.tenant_id = #{tenantId}
- </select>
- <select id="getExternalQuestion" parameterType="com.zhongzheng.modules.course.bo.ExternalQuestionBo" resultType="com.zhongzheng.modules.course.vo.ExternalQuestionVo">
- SELECT
- g.goods_id,
- qm.merchant_id,
- g.goods_name,
- qm.merchant_name,
- qm.do_num,
- g.stand_price AS goodsPrice,
- g.cover_url
- FROM
- question_merchant qm
- LEFT JOIN goods g ON qm.merchant_id = g.question_merchant_id
- WHERE
- qm.`status` = 1
- AND qm.tenant_id = #{tenantId}
- AND g.`status` = 1
- </select>
- <select id="getReplenishExam" parameterType="com.zhongzheng.modules.course.bo.ReplenishExamBo" resultType="com.zhongzheng.modules.course.vo.ReplenishExamVo">
- SELECT
- g.goods_id,
- g.goods_name,
- g.stand_price AS goodsPrice,
- g.cover_url
- FROM
- goods g
- WHERE
- g.`status` = 1
- and g.unify_sign = 1
- </select>
- <select id="queryGoodsByIdTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT *
- FROM `goods`
- WHERE goods_id = #{goodsId}
- AND tenant_id = #{tenantId}
- </select>
- <select id="getRelevanceGoodsNoTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT
- g.*
- FROM
- goods g
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE
- g.`status` = 1
- AND g.goods_status = 1
- AND INSTR(#{businessName}, cet.education_name)
- AND INSTR(#{businessName}, cpt.project_name)
- AND INSTR(#{majName}, m.category_name)
- AND g.goods_id != #{goodsId}
- </select>
- <select id="getRelGoodsNoTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT
- g.*
- FROM
- goods g
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE
- g.`status` = 1
- AND INSTR(#{businessName}, cet.education_name)
- AND INSTR(#{businessName}, cpt.project_name)
- AND INSTR(#{categoryName}, m.category_name)
- AND INSTR(#{businessName},cb.business_name)
- AND g.tenant_id = #{tenantId}
- AND INSTR(g.goods_name,'测试') <= 0
- </select>
- <select id="queryGoodsByTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT *
- FROM `goods`
- WHERE `code` = #{code}
- AND tenant_id = #{tenantId}
- </select>
- <select id="getGoodsByIdNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT *
- FROM `goods`
- WHERE goods_id = #{goodsId}
- </select>
- <select id="getGoodsByTenantTwo" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
- SELECT *
- FROM `goods`
- WHERE goods_name = #{goodsName} and code = #{code} and tenant_id = #{tenantId}
- </select>
- <update id="updateByTenant" parameterType="com.zhongzheng.modules.goods.domain.Goods">
- UPDATE goods
- SET `year` = #{year},
- supply_id = #{supplyId},
- goods_type = #{goodsType},
- education_type_id = #{educationTypeId},
- business_id = #{businessId},
- school_id = #{schoolId},
- major_id = #{majorId},
- goods_name = #{goodsName},
- stand_price = #{standPrice},
- lowest_price = #{lowestPrice},
- create_time = #{createTime},
- update_time = #{updateTime},
- `status` = #{status},
- validity_start_time = #{validityStartTime},
- validity_end_time = #{validityEndTime},
- study_start_time = #{studyStartTime},
- study_end_time = #{studyEndTime},
- certificate_ids = #{certificateIds},
- introduce = #{introduce},
- suitable_object = #{suitableObject},
- buy_note = #{buyNote},
- pc_detail_html = #{pcDetailHtml},
- mobile_detail_html = #{mobileDetailHtml},
- goods_status = #{goodsStatus},
- cover_url = #{coverUrl},
- class_hours = #{classHours},
- stand_price_json = #{standPriceJson},
- tenant_id = #{tenantId},
- `code` = #{code},
- project_id = #{projectId},
- goods_audition_config = #{goodsAuditionConfig},
- goods_photograph_config = #{goodsPhotographConfig},
- goods_play_config = #{goodsPlayConfig},
- goods_exam_config = #{goodsExamConfig},
- handouts_id = #{handoutsId},
- make_start_time = #{makeStartTime},
- make_end_time = #{makeEndTime},
- study_count = #{studyCount},
- goods_photo_exam_config = #{goodsPhotoExamConfig},
- make_goods_id = #{makeGoodsId},
- service_time_type = #{serviceTimeType},
- service_time_num = #{serviceTimeNum},
- section_max_num = #{sectionMaxNum},
- exam_number = #{examNumber},
- do_number = #{doNumber},
- teacher_id = #{teacherId},
- subject_ids = #{subjectIds},
- certificate_type_id = #{certificateTypeId},
- certificate_id = #{certificateId},
- certificate_tp_id = #{certificateTpId},
- line_price = #{linePrice},
- spec_template_id = #{specTemplateId},
- show_status = #{showStatus},
- show_sort = #{showSort}
- WHERE goods_id = #{goodsId}
- and tenant_id = #{tenantId}
- </update>
- <select id="getUserGoodsListAll" parameterType="com.zhongzheng.modules.goods.bo.UserGoodsListAllBo"
- resultType="com.zhongzheng.modules.goods.vo.GoodsListAllVo">
- SELECT
- o.order_id,
- og.order_goods_id,
- g.goods_id,
- g.goods_name,
- g.goods_type,
- g.class_hours,
- g.validity_start_time,
- g.validity_end_time,
- g.study_start_time AS serviceStartTime,
- g.study_end_time AS serviceEndTime,
- cg.class_status,
- cg.class_start_time,
- cg.class_end_time
- FROM
- order_goods og
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN class_grade cg ON og.grade_id = cg.grade_id
- WHERE
- og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status != 2
- <if test="goodsType != null and goodsType != ''">
- AND g.goods_type = #{goodsType}
- </if>
- <if test="goodsName != null and goodsName != ''">
- AND g.goods_name like concat('%', #{goodsName}, '%')
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND g.education_type_id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="userId != null and userId != ''">
- AND o.user_id = #{userId}
- </if>
- </select>
- <select id="getCourseExamNum" parameterType="java.lang.Long" resultType="java.lang.Long">
- SELECT
- COUNT(*)
- FROM
- course_menu_exam cme
- LEFT JOIN goods_course gc ON cme.course_id = gc.course_id
- WHERE
- cme.type != 2
- AND gc.goods_id = #{goodsId}
- </select>
- <select id="getUserStudyNum" parameterType="java.lang.Long" resultType="java.lang.Long">
- SELECT COUNT(*) FROM
- (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
- 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
- </select>
- <select id="getAlikeGoods" parameterType="com.zhongzheng.modules.goods.domain.Goods" resultType="com.zhongzheng.modules.goods.vo.GoodsVo">
- SELECT g.*,
- cet.education_name as educationName,
- cb.business_name as businessName,
- cpt.project_name as projectName,
- m.category_name as categoryName
- from goods g
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id and cet.tenant_id = #{tenantId}
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id and cpt.tenant_id = #{tenantId}
- LEFT JOIN course_business cb ON g.business_id = cb.id and cb.tenant_id = #{tenantId}
- LEFT JOIN major m ON g.major_id = m.id and m.tenant_id = #{tenantId}
- where
- g.goods_status = 1
- and g.status = 1
- and g.education_type_id = #{educationTypeId}
- and g.project_id = #{projectId}
- and g.business_id = #{businessId}
- and g.stand_price = #{standPrice}
- and g.tenant_id = #{tenantId}
- </select>
- <update id="updateHandoutsId" parameterType="java.lang.Long">
- UPDATE goods SET handouts_id = #{handoutsId} WHERE goods_id = #{goodsId} and tenant_id = #{tenantId}
- </update>
- <select id="getNewHandoutsId" parameterType="map" resultType="java.lang.Long">
- SELECT handouts_id FROM course_handouts WHERE INSTR(handouts_name,#{handoutsName}) AND encoder = #{encoder} AND tenant_id = #{newTenantId}
- </select>
- <select id="getGoodsBusinessName" parameterType="java.lang.Long" resultType="java.lang.String">
- SELECT
- CONCAT( cet.education_name, cb.business_name, cpt.project_name )
- FROM
- goods g
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- WHERE
- g.goods_id = #{goodsId}
- </select>
- <select id="getBusinessName" parameterType="java.lang.Long" resultType="java.lang.String">
- SELECT
- CONCAT( cet.education_name, cb.business_name, cpt.project_name ) AS business_name
- FROM
- goods g
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- WHERE
- g.goods_id = #{goodsId}
- </select>
- </mapper>
|