first commit

This commit is contained in:
GYJ
2024-12-02 10:29:28 +08:00
commit 03cd33b658
485 changed files with 63600 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?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.CourseClassificationDao">
<select id="selectCourseClassificationPage" resultType="com.sqx.modules.course.entity.CourseClassification">
select * from course_classification where 1=1 and is_delete=0
<if test ='null != classificationName'>
and classification_name LIKE CONCAT('%', #{classificationName}, '%')
</if>
order by sort
</select>
<select id="selectCourseClassificationList" resultType="com.sqx.modules.course.entity.CourseClassification">
select * from course_classification where 1=1 and is_delete=0
<if test ='null != classificationName'>
and classification_name LIKE CONCAT('%', #{classificationName}, '%')
</if>
order by sort
</select>
<update id="updateDelete">
update course_classification set is_delete=1 where classification_id=#{id}
</update>
<select id="queryClassification" resultType="com.sqx.modules.course.response.ClassificationResponse">
select classification_id ,classification_name from course_classification where is_delete=0;
</select>
</mapper>

View File

@@ -0,0 +1,51 @@
<?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.CourseCollectDao">
<select id="selectCourseByCollect" resultType="com.sqx.modules.course.entity.Course">
SELECT
MAX( u.update_time ) AS produceEndTime,
c.*,
(
SELECT
d.course_details_name
FROM
course_collect cc
LEFT JOIN course_details d ON cc.course_details_id = d.course_details_id
WHERE
d.course_id = u.course_id
AND cc.classify = 3 and cc.user_id=#{userId}
ORDER BY
cc.update_time DESC
LIMIT 1
) AS courseDetailsName,
(
SELECT
d.course_details_id
FROM
course_collect cc
LEFT JOIN course_details d ON cc.course_details_id = d.course_details_id
WHERE
d.course_id = u.course_id
AND cc.classify = 3 and cc.user_id=#{userId}
ORDER BY
cc.update_time DESC
LIMIT 1
) AS courseDetailsId,
( SELECT count(*) FROM course_details d WHERE d.course_id = c.course_id ) AS courseDetailsCount
FROM
course_collect u
LEFT JOIN course c ON u.course_id = c.course_id
WHERE
u.user_id = #{userId}
AND c.course_id IS NOT NULL
AND u.classify = #{classify}
GROUP BY
u.course_id
ORDER BY
produceEndTime DESC
</select>
</mapper>

View File

@@ -0,0 +1,40 @@
<?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.CourseCommentDao">
<update id="updateCourseComment">
<if test='1 == type'>
update course_comment set goods_num=goods_num+1 where course_comment_id=#{courseCommentId}
</if>
<if test='0 == type'>
update course_comment set goods_num=goods_num-1 where course_comment_id=#{courseCommentId}
</if>
</update>
<!--
查询该短剧的所有评论
返回结果 用户名称 用户图像 评论时间 评论内容 点赞数量
-->
<select id="selectCourseComment" resultType="com.sqx.modules.course.entity.CourseComment">
select c.course_comment_id,c.content,c.create_time,c.goods_num,
u.user_name as userName,u.avatar,c.user_id,
(select count(*) from comment_good g where g.course_comment_id=c.course_comment_id and user_id=#{userId}) as isGood
from course_comment c ,tb_user u where u.user_id=c.user_id
and c.course_id =#{courseId}
order by c.create_time desc
</select>
<!--
删除评论点赞的关联关系
-->
<delete id="deleteCommentGood">
delete from comment_good where course_comment_id=#{courseCommentId}
</delete>
<select id="selectCourseCommentByUserId" resultType="Map">
select cc.course_comment_id as courseCommentId,cc.goods_num as goodsNum,cc.content,cc.create_time,c.title,c.title_img as titleImg from course_comment cc
left join course c on c.course_id=cc.course_id
where cc.user_id=#{userId}
order by create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,281 @@
<?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 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.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.view_counts as viewCounts,
c.dy_img_id as dyImgId,
c.dy_course_id as dyCourseId,
c.wx_course_id as wxCourseId,
c.wx_show as wxShow,
c.dy_show as dyShow,
c.sort,
(select sum(good_num) from course_details d where d.course_id=c.course_id ) as goodNum,
(select count(*) from course_details d where d.course_id=c.course_id ) as courseDetailsCount,
<if test="userId!=null">
(
SELECT
cc.course_details_id
FROM
course_collect cc
WHERE
cc.course_id = c.course_id
AND cc.classify = 3
and cc.user_id = #{userId}
ORDER BY
cc.update_time desc
LIMIT 1
) AS courseDetailsId,
</if>
<if test="userId==null">
null AS courseDetailsName,
null AS courseDetailsId,
</if>
(select count(*) from course_collect d where d.course_id=c.course_id
and date_format(create_time,'%Y-%m-%d')>=date_format(#{startTime},'%Y-%m-%d') and
date_format(create_time,'%Y-%m-%d')&lt;=date_format(#{endTime},'%Y-%m-%d') ) as weekGoodNum,
(select count(*) from course_details cd where c.course_id=cd.course_id and cd.good=1 ) as isRecommend
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
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==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
</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="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.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.view_counts as viewCounts,
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,
(select count(*) from course_details where dy_url_status in (1,3) or dy_url_status=null) as dyUrlStatus,
(select sum(o.pay_money) from orders o where o.course_id=c.course_id and o.status=1) as payMoney,
(select sum(good_num) from course_details d where d.course_id=c.course_id ) as goodNum,
(select count(*) from course_details d where d.course_id=c.course_id ) as courseDetailsCount,
(select count(*) from course_collect d where d.course_id=c.course_id
and date_format(create_time,'%Y-%m-%d')>=date_format(#{startTime},'%Y-%m-%d') and
date_format(create_time,'%Y-%m-%d')&lt;=date_format(#{endTime},'%Y-%m-%d') ) as weekGoodNum,
(select count(*) from course_details cd where c.course_id=cd.course_id and cd.good=1 ) as isRecommend
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
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==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.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 #{title}
</if>
order by create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,63 @@
<?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.CourseDetailsDao">
<!--查找指定短剧的目录 按照顺序数字升序-->
<select id="findByCourseId" resultType="com.sqx.modules.course.entity.CourseDetails">
select c.*,
(select count(*) from course_collect cc where cc.user_id=#{userId} and cc.course_details_id=c.course_details_id and cc.classify=2) as isGood
from course_details c where c.course_id=#{id} order by c.sort asc
</select>
<select id="selectCoursePageByCourseId" resultType="com.sqx.modules.course.entity.CourseDetails">
select * from course_details where course_id=#{id}
<if test="good!=null and good==1">
and good=#{good}
</if>
<if test="good!=null and good==2">
and (good=#{good} or good is null)
</if>
order by sort asc
</select>
<select id="findByCourseIdNotUrl" resultType="com.sqx.modules.course.entity.CourseDetails">
select c.course_details_id as courseDetailsId,c.course_id as courseId,c.wx_course_details_id as wxCourseDetailsId,
c.course_details_name as courseDetailsName,c.create_time as createTime,
c.dy_episode_id as dyEpisodeId,c.advertising,
(select count(*) from course_collect cc where cc.user_id=#{userId} and cc.course_details_id=c.course_details_id and cc.classify=2) as isGood,
c.title_img as titleImg,c.content,c.good_num as goodNum,c.price,if(is_price!=1,c.video_url,'') as videoUrl
from course_details c
where c.course_id=#{id} order by c.sort asc
</select>
<delete id="deleteCourseDetails" parameterType="String">
DELETE FROM course_details WHERE course_details_id IN
<foreach collection="array" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</delete>
<select id="selectCourseDetailsList" resultType="com.sqx.modules.course.entity.CourseDetails">
select cd.*,
MD5( `course_details_id` ) AS `uid`
from course_details cd
left join course c on c.course_id=cd.course_id
where c.course_id is not null and c.is_delete=0 and cd.good=1
<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>
order by SUBSTR(uid, #{randomNum}, 6)
</select>
</mapper>

View File

@@ -0,0 +1,47 @@
<?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.CourseUserDao">
<select id="selectLatelyCourse" resultType="com.sqx.modules.course.entity.Course">
select c.*,(select count(*) from course_user cu where cu.course_id=u.course_id) as courseCount,
(select group_concat(avatar) from
(SELECT tu.avatar,course_id FROM course_user o
left join tb_user tu on tu.user_id=o.user_id
GROUP BY course_id,tu.avatar
limit 3
) a where a.course_id=u.course_id ) as avatar from course_user u
left join course c on u.course_id=c.course_id
where u.user_id=#{userId} and c.is_delete=0 order by update_time desc
</select>
<select id="selectCourseByCourseUser" resultType="com.sqx.modules.course.entity.Course">
select c.*,(select count(*) from course_user cu where cu.course_id=u.course_id) as courseCount,
(select group_concat(avatar) from
(SELECT tu.avatar,course_id FROM course_user o
left join tb_user tu on tu.user_id=o.user_id
GROUP BY course_id,tu.avatar
limit 3
) a where a.course_id=u.course_id ) as avatar
from course_user u
left join course c on u.course_id=c.course_id
where u.user_id=#{userId} and c.is_delete=0
order by u.create_time desc
</select>
<select id="selectCourseUser" resultType="com.sqx.modules.course.entity.CourseUser">
select * from course_user u where u.user_id=#{userId} and u.course_id=#{id} and u.classify=1
</select>
<select id="selectCourseUserList" resultType="com.sqx.modules.course.entity.CourseUser">
select * from course_user u where u.user_id=#{userId} and u.course_id=#{id} and u.classify=2
</select>
<update id="updateCourseTime">
update course_user set update_time =#{courseUser.updateTime}
</update>
<delete id="deleteCourseUserByVipUser">
delete from course_user where order_id in (select orders_id from orders where user_id= #{userId} and pay_way=5 and status=1)
</delete>
</mapper>