Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
d475f34a0a
|
|
@ -88,7 +88,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||||
|
|
||||||
private void setCache(String key, String value) {
|
private void setCache(String key, String value) {
|
||||||
key = getIndexKey(key);
|
key = getIndexKey(key);
|
||||||
redisUtils.set(key, value, 600);
|
redisUtils.set(key, value, 60 * 60 * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCache(String key) {
|
private String getCache(String key) {
|
||||||
|
|
@ -174,26 +174,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||||
sort, startTime, endTime, userId, isPrice, over, wxCourse, dyCourse, wxShow, dyShow);
|
sort, startTime, endTime, userId, isPrice, over, wxCourse, dyCourse, wxShow, dyShow);
|
||||||
List<Map<String, Object>> records = mapIPage.getRecords();
|
List<Map<String, Object>> records = mapIPage.getRecords();
|
||||||
for (Map<String, Object> map : records) {
|
for (Map<String, Object> map : records) {
|
||||||
Object courseDetailsId = map.get("courseDetailsId");
|
map.put("courseDetailsId", null);
|
||||||
Object courseId = map.get("courseId");
|
map.put("courseDetailsName", "");
|
||||||
if (courseDetailsId != null) {
|
map.put("dyEpisodeId", "");
|
||||||
CourseDetails courseDetails = courseDetailsDao.selectById(Long.parseLong(String.valueOf(courseDetailsId)));
|
map.put("wxCourseDetailsId", "");
|
||||||
if (courseDetails != null) {
|
|
||||||
map.put("courseDetailsName", courseDetails.getCourseDetailsName());
|
|
||||||
map.put("dyEpisodeId", courseDetails.getDyEpisodeId());
|
|
||||||
map.put("wxCourseDetailsId", courseDetails.getWxCourseDetailsId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//默认取第一集
|
|
||||||
CourseDetails courseDetails = courseDetailsDao.selectOne(new QueryWrapper<CourseDetails>().eq("course_id", courseId)
|
|
||||||
.orderByAsc("sort").last(" limit 1"));
|
|
||||||
if (courseDetails != null) {
|
|
||||||
map.put("courseDetailsId", courseDetails.getCourseDetailsId());
|
|
||||||
map.put("courseDetailsName", courseDetails.getCourseDetailsName());
|
|
||||||
map.put("dyEpisodeId", courseDetails.getDyEpisodeId());
|
|
||||||
map.put("wxCourseDetailsId", courseDetails.getWxCourseDetailsId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setCache(cacheKey, JSONUtil.toJsonStr(new PageUtils(mapIPage)));
|
setCache(cacheKey, JSONUtil.toJsonStr(new PageUtils(mapIPage)));
|
||||||
return Result.success().put("data", new PageUtils(mapIPage));
|
return Result.success().put("data", new PageUtils(mapIPage));
|
||||||
|
|
@ -202,16 +186,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
||||||
sort, startTime, endTime, userId, isPrice, over, wxCourse, dyCourse, wxShow, dyShow);
|
sort, startTime, endTime, userId, isPrice, over, wxCourse, dyCourse, wxShow, dyShow);
|
||||||
List<Map<String, Object>> records = mapIPage.getRecords();
|
List<Map<String, Object>> records = mapIPage.getRecords();
|
||||||
for (Map<String, Object> map : records) {
|
for (Map<String, Object> map : records) {
|
||||||
Object courseId = map.get("courseId");
|
map.put("courseDetailsId", null);
|
||||||
//默认取第一集
|
map.put("courseDetailsName", "");
|
||||||
CourseDetails courseDetails = courseDetailsDao.selectOne(new QueryWrapper<CourseDetails>().eq("course_id", courseId)
|
map.put("dyEpisodeId", "");
|
||||||
.orderByAsc("sort").last(" limit 1"));
|
map.put("wxCourseDetailsId", "");
|
||||||
if (courseDetails != null) {
|
|
||||||
map.put("courseDetailsId", courseDetails.getCourseDetailsId());
|
|
||||||
map.put("courseDetailsName", courseDetails.getCourseDetailsName());
|
|
||||||
map.put("dyEpisodeId", courseDetails.getDyEpisodeId());
|
|
||||||
map.put("wxCourseDetailsId", courseDetails.getWxCourseDetailsId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setCache(cacheKey, JSONUtil.toJsonStr(new PageUtils(mapIPage)));
|
setCache(cacheKey, JSONUtil.toJsonStr(new PageUtils(mapIPage)));
|
||||||
return Result.success().put("data", new PageUtils(mapIPage));
|
return Result.success().put("data", new PageUtils(mapIPage));
|
||||||
|
|
|
||||||
|
|
@ -31,39 +31,19 @@
|
||||||
c.course_type as courseType,
|
c.course_type as courseType,
|
||||||
c.banner_id as bannerId,
|
c.banner_id as bannerId,
|
||||||
b.name as bannerName,
|
b.name as bannerName,
|
||||||
(select sum(cd.view_count) from course_details cd where cd.course_id = c.course_id ) as viewCounts,
|
0 as viewCounts,
|
||||||
c.dy_img_id as dyImgId,
|
c.dy_img_id as dyImgId,
|
||||||
c.dy_course_id as dyCourseId,
|
c.dy_course_id as dyCourseId,
|
||||||
c.wx_course_id as wxCourseId,
|
c.wx_course_id as wxCourseId,
|
||||||
c.wx_show as wxShow,
|
c.wx_show as wxShow,
|
||||||
c.dy_show as dyShow,
|
c.dy_show as dyShow,
|
||||||
c.sort,
|
c.sort,
|
||||||
(select sum(good_num) from course_details d where d.course_id=c.course_id ) as goodNum,
|
0 as goodNum,
|
||||||
(select count(*) from course_details d where d.course_id=c.course_id ) as courseDetailsCount,
|
0 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 courseDetailsName,
|
||||||
null AS courseDetailsId,
|
null AS courseDetailsId,
|
||||||
</if>
|
0 as weekGoodNum,
|
||||||
|
0 as isRecommend
|
||||||
(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')<=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
|
FROM
|
||||||
course AS c
|
course AS c
|
||||||
LEFT JOIN course_classification AS cc ON c.classify_id = cc.classification_id
|
LEFT JOIN course_classification AS cc ON c.classify_id = cc.classification_id
|
||||||
|
|
@ -113,6 +93,8 @@
|
||||||
<if test="dyCourse!=null">
|
<if test="dyCourse!=null">
|
||||||
and c.dy_status=4
|
and c.dy_status=4
|
||||||
</if>
|
</if>
|
||||||
|
order by c.sort asc,c.create_time desc
|
||||||
|
<!--
|
||||||
<if test="sort==null">
|
<if test="sort==null">
|
||||||
order by c.sort asc
|
order by c.sort asc
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -122,6 +104,7 @@
|
||||||
<if test="sort!=null and sort==2">
|
<if test="sort!=null and sort==2">
|
||||||
order by weekGoodNum desc
|
order by weekGoodNum desc
|
||||||
</if>
|
</if>
|
||||||
|
-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCourseAdmin" resultType="Map">
|
<select id="selectCourseAdmin" resultType="Map">
|
||||||
|
|
@ -241,6 +224,8 @@
|
||||||
<if test="dyCourse!=null">
|
<if test="dyCourse!=null">
|
||||||
and c.dy_status=4
|
and c.dy_status=4
|
||||||
</if>
|
</if>
|
||||||
|
order by c.sort asc,c.create_time desc
|
||||||
|
<!--
|
||||||
<if test="sort==null">
|
<if test="sort==null">
|
||||||
order by c.sort asc,c.create_time desc
|
order by c.sort asc,c.create_time desc
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -250,6 +235,7 @@
|
||||||
<if test="sort!=null and sort==2">
|
<if test="sort!=null and sort==2">
|
||||||
order by weekGoodNum desc
|
order by weekGoodNum desc
|
||||||
</if>
|
</if>
|
||||||
|
-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCourseTitle" resultType="Map">
|
<select id="selectCourseTitle" resultType="Map">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue