249 lines
8.2 KiB
XML
249 lines
8.2 KiB
XML
<?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.sqx.modules.course.dao.CourseDao">
|
|
<update id="updateDelete">
|
|
update course
|
|
set is_delete=1
|
|
where course_id = #{id}
|
|
</update>
|
|
<select id="selectCourse" resultType="Map">
|
|
SELECT
|
|
c.classify_id AS classifyId,
|
|
c.course_id AS courseId,
|
|
c.course_label AS courseLabel,
|
|
c.create_time AS createTime,
|
|
c.details,
|
|
c.img,
|
|
c.banner_img AS bannerImg,
|
|
c.status,
|
|
c.is_delete AS isDelete,
|
|
c.msg_type AS msgType,
|
|
c.msg_url AS msgUrl,
|
|
c.pay_num AS payNum,
|
|
c.price,
|
|
c.wholesale_price AS wholesalePrice,
|
|
c.is_over AS isOver,
|
|
c.title,
|
|
c.is_price AS isPrice,
|
|
c.title_img AS titleImg,
|
|
c.update_time AS updateTime,
|
|
c.course_type AS courseType,
|
|
c.banner_id AS bannerId
|
|
FROM
|
|
course AS c
|
|
WHERE
|
|
c.is_delete = 0
|
|
|
|
<if test='null != wxShow and wxShow==1'>
|
|
and c.wx_show = #{wxShow}
|
|
</if>
|
|
<if test='null != wxShow and wxShow==2'>
|
|
and (c.wx_show = #{wxShow} or c.wx_show is null)
|
|
</if>
|
|
<if test='null != dyShow and dyShow==1'>
|
|
and c.dy_show = #{dyShow}
|
|
</if>
|
|
<if test='null != dyShow and dyShow==2'>
|
|
and (c.dy_show = #{dyShow} or c.dy_show is null)
|
|
</if>
|
|
<if test='null != title'>
|
|
and c.title LIKE CONCAT('%', #{title}, '%')
|
|
</if>
|
|
<if test='null!= classifyId and classifyId!=0'>
|
|
and c.classify_id = #{classifyId}
|
|
</if>
|
|
<if test='null!= bannerId and bannerId!=0'>
|
|
and c.banner_id = #{bannerId}
|
|
</if>
|
|
<if test="classifyId==0">
|
|
and c.is_recommend=1
|
|
</if>
|
|
<if test="over!=null">
|
|
and c.is_over=#{over}
|
|
</if>
|
|
<!-- <if test="isRecommend!=null and isRecommend!=-1">-->
|
|
<!-- and c.course_id in (select course_id from course_details where good=1)-->
|
|
<!-- </if>-->
|
|
<if test="status!=null and status!=0">
|
|
and c.status=#{status}
|
|
</if>
|
|
<if test="isPrice!=null">
|
|
and c.is_price=#{isPrice}
|
|
</if>
|
|
<if test="wxCourse!=null">
|
|
and c.wx_course_id is not null
|
|
</if>
|
|
<if test="dyCourse!=null">
|
|
and c.dy_status=4
|
|
</if>
|
|
<if test="sort==null">
|
|
order by c.sort asc,c.create_time desc
|
|
</if>
|
|
<if test="sort!=null and sort==1">
|
|
order by week_pay desc
|
|
</if>
|
|
<if test="sort!=null and sort==2">
|
|
order by week_view desc
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectCourseAdmin" resultType="Map">
|
|
SELECT
|
|
c.classify_id as classifyId,
|
|
c.course_id as courseId,
|
|
c.course_label as courseLabel,
|
|
c.course_label_ids as courseLabelIds,
|
|
c.create_time createTime,
|
|
c.details,
|
|
c.img,
|
|
c.banner_img as bannerImg,
|
|
c.status,
|
|
c.is_delete as isDelete,
|
|
c.msg_type msgType,
|
|
c.msg_url as msgUrl,
|
|
c.pay_num as payNum,
|
|
c.price,
|
|
c.wholesale_price as wholesalePrice,
|
|
c.is_over as isOver,
|
|
c.title,
|
|
c.is_price as isPrice,
|
|
c.title_img as titleImg,
|
|
c.update_time as updateTime,
|
|
cc.classification_name as classificationName,
|
|
c.course_type as courseType,
|
|
c.banner_id as bannerId,
|
|
b.name as bannerName,
|
|
c.dy_img_id as dyImgId,
|
|
c.dy_course_id as dyCourseId,
|
|
c.dy_status as dyStatus,
|
|
c.dy_status_content as dyStatusContent,
|
|
c.dy_version as dyVersion,
|
|
c.license_num as licenseNum,
|
|
c.registration_num as registrationNum,
|
|
c.ordinary_record_num as ordinaryRecordNum,
|
|
c.key_record_num as keyRecordNum,
|
|
c.wx_course_id as wxCourseId,
|
|
c.wx_show as wxShow,
|
|
c.dy_show as dyShow,
|
|
c.sort,
|
|
c.`duration`,
|
|
c.`production_organisation` as productionOrganisation,
|
|
c.`director`,
|
|
c.`producer`,
|
|
c.`actor`,
|
|
c.`summary`,
|
|
c.`cost_distribution_uri` as costDistributionUri,
|
|
c.`assurance_uri` as assuranceUri,
|
|
c.`playlet_production_cost` as playletProductionCost,
|
|
c.`qualification_type` as qualificationType,
|
|
c.`registration_number` as registrationNumber,
|
|
c.`qualification_certificate_material_id` as qualificationCertificateMaterialId,
|
|
c.`cost_of_production` as costOfProduction,
|
|
c.`cost_commitment_letter_material_id` as costCommitmentLetterMaterialId,
|
|
c.`wx_course_status` as wxCourseStatus,
|
|
-- t.dyUrlStatus,
|
|
0 as weekGoodNum
|
|
|
|
FROM
|
|
course AS c
|
|
LEFT JOIN course_classification AS cc ON c.classify_id = cc.classification_id
|
|
left join banner as b on b.id=c.banner_id
|
|
-- left join (select 1 as id,count(*) as dyUrlStatus from course_details where dy_url_status in (1,3) or dy_url_status=null group by course_id) t on t.id = 1
|
|
WHERE
|
|
1 = 1
|
|
AND c.is_delete = 0
|
|
<if test='null != wxShow and wxShow==1'>
|
|
and c.wx_show = #{wxShow}
|
|
</if>
|
|
<if test='null != wxShow and wxShow==2'>
|
|
and (c.wx_show = #{wxShow} or c.wx_show is null)
|
|
</if>
|
|
<if test='null != dyShow and dyShow==1'>
|
|
and c.dy_show = #{dyShow}
|
|
</if>
|
|
<if test='null != dyShow and dyShow==2'>
|
|
and (c.dy_show = #{dyShow} or c.dy_show is null)
|
|
</if>
|
|
<if test='null != title'>
|
|
and c.title LIKE CONCAT('%', #{title}, '%')
|
|
</if>
|
|
<if test='null!= classifyId and classifyId!=0'>
|
|
and c.classify_id = #{classifyId}
|
|
</if>
|
|
<if test='null!= bannerId and bannerId!=0'>
|
|
and c.banner_id = #{bannerId}
|
|
</if>
|
|
<if test="classifyId!=null and classifyId==0">
|
|
and c.is_recommend=1
|
|
</if>
|
|
<if test="over!=null and over==1">
|
|
and c.is_over=1
|
|
</if>
|
|
<if test="over!=null and over==2">
|
|
and (c.is_over is null or c.is_over=2)
|
|
</if>
|
|
<!-- <if test="isRecommend!=null and isRecommend!=-1">-->
|
|
<!-- and c.course_id in (select course_id from course_details where good=1)-->
|
|
<!-- </if>-->
|
|
<if test="status!=null and status!=0">
|
|
and c.status=#{status}
|
|
</if>
|
|
<if test="isPrice!=null">
|
|
and c.is_price=#{isPrice}
|
|
</if>
|
|
<if test="wxCourse!=null">
|
|
and c.wx_course_id is not null
|
|
</if>
|
|
<if test="dyCourse!=null">
|
|
and c.dy_status=4
|
|
</if>
|
|
<if test="sort==null">
|
|
order by c.sort asc,c.create_time desc
|
|
</if>
|
|
<if test="sort!=null and sort==1">
|
|
order by goodNum desc
|
|
</if>
|
|
<if test="sort!=null and sort==2">
|
|
order by weekGoodNum desc
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectCourseTitle" resultType="Map">
|
|
SELECT
|
|
c.classify_id as classifyId,
|
|
c.course_id as courseId,
|
|
c.course_label as courseLabel,
|
|
c.create_time createTime,
|
|
c.details,
|
|
c.img,
|
|
c.banner_img as bannerImg,
|
|
c.is_delete as isDelete,
|
|
c.msg_type msgType,
|
|
c.msg_url as msgUrl,
|
|
c.pay_num as payNum,
|
|
c.price,
|
|
c.wholesale_price as wholesalePrice,
|
|
c.status,
|
|
c.title,
|
|
c.title_img as titleImg,
|
|
c.update_time as updateTime
|
|
FROM
|
|
course c
|
|
WHERE
|
|
c.is_delete = 0 and c.status=1
|
|
<if test='null != title'>
|
|
and c.title LIKE concat("%",#{title},"%")
|
|
</if>
|
|
order by create_time desc
|
|
</select>
|
|
<select id="selectGroupCourseId" resultType="com.sqx.modules.app.response.CourseOrderResponse">
|
|
select sum(o.pay_money) as 'coursemoney' ,count(*) as 'coursenum', o.course_id as courseId
|
|
from orders o
|
|
where o.status=1 and o.orders_type=1
|
|
and o.create_time between #{start} and #{end}
|
|
group by o.course_id
|
|
order by coursenum desc
|
|
</select>
|
|
|
|
</mapper>
|