|
@@ -104,7 +104,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<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"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
|
|
@@ -243,6 +244,129 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
</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 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 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
|
|
|
+ <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="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="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="goodsType ==1 and subjectId >0">
|
|
|
+ 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
|
|
|
+ AND c.subject_id = #{subjectId}) >0
|
|
|
+ </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="goodsType ==2 and subjectId >0">
|
|
|
+ AND g.goods_id in(
|
|
|
+ SELECT
|
|
|
+ ga.goods_id
|
|
|
+ FROM
|
|
|
+ goods_attached ga
|
|
|
+ LEFT JOIN question_business qb ON ga.major_id = qb.major_id
|
|
|
+ WHERE
|
|
|
+ ((
|
|
|
+ qb.type = 4
|
|
|
+ AND ga.type = 1
|
|
|
+ )
|
|
|
+ OR ( qb.type = 3 AND ga.type = 2 )
|
|
|
+ OR ( qb.type = 2 AND ga.type = 3 ))
|
|
|
+ AND qb.subject_id = #{subjectId}
|
|
|
+ )
|
|
|
+ </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.*,
|