123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- <?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.bank.mapper.QuestionMapper">
- <resultMap type="com.zhongzheng.modules.bank.domain.Question" id="QuestionResult">
- <result property="questionId" column="question_id"/>
- <result property="content" column="content"/>
- <result property="type" column="type"/>
- <result property="answerQuestion" column="answer_question"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="analysisContent" column="analysis_content"/>
- <result property="imgUrl" column="img_url"/>
- <result property="jsonStr" column="json_str"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="knowledgeIds" column="knowledge_ids"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="code" column="code"/>
- <result property="importNo" column="import_no"/>
- <result property="createBy" column="create_by"/>
- <result property="importSort" column="import_sort"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
- <result property="questionId" column="question_id"/>
- <result property="content" column="content"/>
- <result property="type" column="type"/>
- <result property="answerQuestion" column="answer_question"/>
- <result property="status" column="status"/>
- <result property="analysisContent" column="analysis_content"/>
- <result property="imgUrl" column="img_url"/>
- <result property="jsonStr" column="json_str"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="knowledgeIds" column="knowledge_ids"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="code" column="code"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="importSort" column="import_sort"/>
- <collection property="businessList" column="question_id" select="findBusinessList" />
- <collection property="knowledgeList" column="knowledge_ids" select="findKnowledge"/>
- <collection property="examList" column="question_id" select="findExamList" />
- </resultMap>
- <resultMap type="com.zhongzheng.modules.bank.vo.ExamVo" id="ExamVoResult">
- <result property="examId" column="exam_id"/>
- <result property="examName" column="exam_name"/>
- </resultMap>
- <select id="findExamList" resultMap="ExamVoResult">
- SELECT
- e.exam_id,
- e.exam_name
- FROM
- exam_question eq
- LEFT JOIN exam e ON eq.exam_id = e.exam_id
- WHERE
- eq.question_id = #{question_id} AND e.status !=-1
- </select>
- <select id="findKnowledge" resultMap="ExamKnowledge">
- SELECT
- ek.knowledge_name,
- ek.knowledge_id
- FROM
- exam_knowledge ek
- WHERE
- FIND_IN_SET( ek.knowledge_id, #{knowledge_ids} ) AND ek.status !=-1
- </select>
- <select id="findBusinessList" resultMap="QuestionBusiness">
- SELECT
- qb.education_type_id,
- qb.business_id,
- qb.project_id,
- qb.subject_id,
- qb.type as business_type,
- cet.education_name,
- cpt.project_name,
- cb.business_name,
- cs.subject_name
- FROM
- question_business qb
- LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id AND cet.status =1
- LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id AND cpt.status =1
- LEFT JOIN course_business cb ON qb.business_id = cb.id AND cb.status =1
- LEFT JOIN course_subject cs ON cs.id = qb.subject_id AND cs.status =1
- WHERE
- qb.major_id=#{question_id} and qb.type = 1
- </select>
- <resultMap type="com.zhongzheng.modules.bank.domain.QuestionBusiness" id="QuestionBusiness">
- <result property="id" column="id"/>
- <result property="subjectId" column="subject_id"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="projectId" column="project_id"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="subjectName" column="subject_name"/>
- <result property="type" column="business_type"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.exam.domain.ExamKnowledge" id="ExamKnowledge">
- <result property="knowledgeId" column="knowledge_id"/>
- <result property="knowledgeName" column="knowledge_name"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.goods.vo.GoodsUserQuestionVo" id="GoodsUserQuestionVo">
- <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="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="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="serviceStartTime" column="service_start_time"/>
- <result property="serviceEndTime" column="service_end_time"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="realName" column="realname"/>
- <result property="idCard" column="id_card"/>
- <result property="userId" column="user_id"/>
- <result property="orderSn" column="order_sn"/>
- <result property="doStartTime" column="do_start_time"/>
- <result property="doEndTime" column="do_end_time"/>
- <result property="doExamNum" column="do_exam_num"/>
- <result property="subjectNames" column="subject_names"/>
- </resultMap>
- <select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
- SELECT
- q.*
- FROM
- question q
- LEFT JOIN (SELECT
- major_id,
- type,
- any_value ( education_type_id ) as education_type_id,
- any_value ( business_id ) as business_id,
- any_value ( project_id )as project_id,
- any_value ( subject_id ) as subject_id
- FROM
- question_business
- where type = 1
- GROUP BY
- major_id,
- type ) qb ON q.question_id = qb.major_id
- WHERE
- 1 = 1 AND q.status !=-1
- <if test="status != null and status.size()!=0 ">
- AND q.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND qb.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND qb.subject_id = #{subjectId}
- </if>
- <if test="type != null and type != ''">
- AND q.type = #{type}
- </if>
- <if test="businessId != null and businessId != ''">
- AND qb.business_id = #{businessId}
- </if>
- <if test="publishStatus != null ">
- AND q.publish_status = #{publishStatus}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND q.prefix_name like concat('%', #{prefixName}, '%')
- </if>
- <if test="key != null and key != ''">
- AND (q.content like concat('%', #{key}, '%') or q.prefix_name like concat('%', #{key}, '%') or q.code like concat('%', #{key}, '%'))
- </if>
- <if test="pageSizeSelf != null and pageSizeSelf != ''">
- LIMIT #{currIndex} , #{pageSizeSelf}
- </if>
- ORDER BY q.question_id DESC
- </select>
- <select id="selectList_COUNT" resultType="Long">
- SELECT
- count( q.question_id)
- FROM
- question q
- LEFT JOIN (SELECT
- major_id,
- type,
- any_value ( education_type_id ) as education_type_id,
- any_value ( business_id ) as business_id,
- any_value ( project_id )as project_id,
- any_value ( subject_id ) as subject_id
- FROM
- question_business
- where type = 1
- GROUP BY
- major_id,
- type ) qb ON q.question_id = qb.major_id
- WHERE
- 1 = 1 AND q.status !=-1
- <if test="status != null and status.size()!=0 ">
- AND q.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND qb.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND qb.subject_id = #{subjectId}
- </if>
- <if test="type != null and type != ''">
- AND q.type = #{type}
- </if>
- <if test="businessId != null and businessId != ''">
- AND qb.business_id = #{businessId}
- </if>
- <if test="publishStatus != null ">
- AND q.publish_status = #{publishStatus}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND q.prefix_name like concat('%', #{prefixName}, '%')
- </if>
- <if test="key != null and key != ''">
- AND (q.content like concat('%', #{key}, '%') or q.prefix_name like concat('%', #{key}, '%') or q.code like concat('%', #{key}, '%'))
- </if>
- <if test="pageSizeSelf != null and pageSizeSelf != ''">
- LIMIT #{currIndex} , #{pageSizeSelf}
- </if>
- </select>
- <select id="listGoodsUserQuestionVo" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
- 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,
- o.user_id,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id,
- (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
- LEFT JOIN order_goods og on g.goods_id =og.goods_id
- LEFT JOIN `order` o on o.order_sn = og.order_sn
- WHERE
- 1 = 1
- AND g.goods_type = 2
- AND o.user_id=#{userId}
- AND og.`status` =1
- and og.pay_status in (2,3,4)
- AND og.refund_status in (0,3,1)
- <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>
- ORDER BY og.create_time DESC
- </select>
- <select id="listUserFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
- 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,
- o.user_id,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN order_goods_free ogf ON og.order_goods_id = ogf.order_goods_id
- LEFT JOIN goods g ON ogf.free_goods_id = g.goods_id
- 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
- AND o.user_id = #{userId}
- AND og.`status` = 1
- AND og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status IN (0,3,1)
- <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>
- ORDER BY og.create_time DESC
- </select>
- <select id="listFreeGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
- 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,
- o.user_id,
- o.order_sn,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id,
- u.realname,
- u.id_card,
- (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
- (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
- (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_num
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN order_goods_free ogf ON og.order_goods_id = ogf.order_goods_id
- LEFT JOIN goods g ON ogf.free_goods_id = g.goods_id
- 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
- LEFT JOIN `user` u ON u.user_id = o.user_id
- WHERE
- 1 = 1
- AND g.goods_type = 5
- AND og.`status` = 1
- AND og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status IN (0,3,1)
- <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="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
- </if>
- ORDER BY og.create_time DESC
- </select>
- <select id="listBankGoodsList" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo" resultMap="GoodsUserQuestionVo">
- 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,
- o.user_id,
- o.order_sn,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id,
- u.realname,
- u.id_card,
- u.user_id,
- (SELECT MIN(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_start_time,
- (SELECT MAX(uer.update_time) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_end_time,
- (SELECT count(DISTINCT uer.exam_id) from user_exam_record uer where uer.order_goods_id = og.order_goods_id) do_exam_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
- 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
- LEFT JOIN `user` u ON u.user_id = o.user_id
- WHERE
- 1 = 1
- <if test="goodsType != null and goodsType != ''">
- AND g.goods_type = #{goodsType}
- </if>
- AND og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status IN (0,3,1)
- <if test="goodsId != null and goodsId != ''">
- AND og.goods_id = #{goodsId}
- </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="majorId != null and majorId != ''">
- AND g.major_id = #{majorId}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%') or u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
- </if>
- ORDER BY og.create_time DESC
- </select>
- <select id="listUserFreeUnionBuyGoodsList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="GoodsUserQuestionVo">
- SELECT * from (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,
- o.user_id,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id,
- (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
- LEFT JOIN order_goods og on g.goods_id =og.goods_id
- LEFT JOIN `order` o on o.order_sn = og.order_sn
- WHERE
- 1 = 1
- AND g.goods_type = 2
- AND o.user_id=#{userId}
- AND og.`status` =1
- and og.pay_status in (2,3,4)
- AND og.refund_status in (0,3,1)
- <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>
- UNION
- 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,
- o.user_id,
- og.create_time as order_create_time,
- og.service_start_time,
- og.service_end_time,
- og.order_goods_id,
- (SELECT GROUP_CONCAT(subject_name) from course_subject where FIND_IN_SET(id,g.subject_ids)) subject_names
- FROM `order` o
- LEFT JOIN order_goods og ON o.order_sn = og.order_sn
- LEFT JOIN order_goods_free ogf ON og.order_goods_id = ogf.order_goods_id
- LEFT JOIN goods g ON ogf.free_goods_id = g.goods_id
- 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
- AND o.user_id = #{userId}
- AND og.`status` = 1
- AND og.pay_status IN ( 2, 3, 4 )
- AND og.refund_status IN (0,3,1)
- <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>
- )un ORDER BY un.order_create_time DESC
- </select>
- </mapper>
|