|
@@ -1,7 +1,7 @@
|
|
|
<?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">
|
|
|
+ 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">
|
|
@@ -151,33 +151,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</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
|
|
|
+ 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
|
|
|
+ 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">
|
|
@@ -190,26 +181,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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,
|
|
|
+ (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
|
|
|
+ ,(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
|
|
|
+ , (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 )
|
|
|
+ , (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" >
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
,ou.goods_live_num
|
|
|
</if>
|
|
|
- <if test="getUserNum != null and getUserNum == 1" >
|
|
|
+ <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
|
|
@@ -223,7 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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" >
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
og.goods_id,
|
|
@@ -255,7 +254,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="goodsTypes != null and goodsTypes.size()!=0 ">
|
|
|
- AND g.goods_type in
|
|
|
+ AND g.goods_type in
|
|
|
<foreach collection="goodsTypes" item="item" index="index" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
@@ -305,14 +304,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="searchKey != null and searchKey != ''">
|
|
|
and (g.goods_name like concat('%', #{searchKey}, '%') or g.code like concat('%', #{searchKey}, '%'))
|
|
|
</if>
|
|
|
- <if test="goodsStatus != null ">
|
|
|
+ <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
|
|
|
+ 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)
|
|
|
+ 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)
|
|
@@ -330,7 +331,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
)
|
|
|
</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
|
|
|
+ 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>
|
|
|
<!-- 数据范围过滤 -->
|
|
@@ -344,12 +346,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="sortType != null and sortType == 1">
|
|
|
ORDER BY g.show_sort DESC,g.create_time DESC
|
|
|
</if>
|
|
|
- <if test="sortType == null" >
|
|
|
+ <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 id="selectListToInput" parameterType="com.zhongzheng.modules.goods.bo.GoodsQueryBo"
|
|
|
+ resultMap="GoodsResultVo">
|
|
|
SELECT
|
|
|
g.*,
|
|
|
ps.supply_name,
|
|
@@ -362,13 +365,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
(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
|
|
|
+ ,(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
|
|
|
+ , (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
|
|
@@ -437,16 +453,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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
|
|
|
+ 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)
|
|
|
+ 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
|
|
|
+ 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">
|
|
@@ -462,40 +481,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</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 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 id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo"
|
|
|
+ resultMap="ExamNumberGoodsVoResult">
|
|
|
SELECT
|
|
|
goods_id,
|
|
|
goods_name,
|
|
@@ -506,10 +522,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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
|
|
|
+ (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
|
|
|
+ (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
|
|
@@ -539,232 +557,323 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</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} 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) 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 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}
|
|
|
+ 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) 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 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 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 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 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="getSectionNum" 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 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 )
|
|
|
+ <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="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}
|
|
|
+ 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.pay_status IN (2, 3, 4)
|
|
|
AND og.refund_status != 2
|
|
|
AND o.tenant_id = #{tenantId}
|
|
|
AND og.tenant_id = #{tenantId}
|
|
|
</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 *
|
|
|
+ FROM `goods`
|
|
|
+ WHERE goods_id = #{goodsId}
|
|
|
+ AND tenant_id = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
<select id="queryGoodsByTenant" parameterType="map" resultType="com.zhongzheng.modules.goods.domain.Goods">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `goods`
|
|
|
- WHERE
|
|
|
- `code` = #{code} AND tenant_id = #{tenantId}
|
|
|
+ SELECT *
|
|
|
+ FROM `goods`
|
|
|
+ WHERE `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 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="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>
|
|
|
</mapper>
|