子查询 以及 扫描路径
This commit is contained in:
@@ -2,31 +2,31 @@
|
||||
<!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="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="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
|
||||
|
||||
Reference in New Issue
Block a user