Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
online-edu
online-edu-backend
Commits
987ff803
Commit
987ff803
authored
Jun 01, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug
parent
fd8db1b2
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
188 additions
and
289 deletions
+188
-289
MainPageTagConfigController.java
...iz/management/controller/MainPageTagConfigController.java
+7
-5
RecommendConfigController.java
.../biz/management/controller/RecommendConfigController.java
+25
-4
CourseMapper.java
...n/java/com/qkdata/biz/management/mapper/CourseMapper.java
+6
-2
CourseTagMapper.java
...ava/com/qkdata/biz/management/mapper/CourseTagMapper.java
+3
-2
RecommendConfigMapper.java
...m/qkdata/biz/management/mapper/RecommendConfigMapper.java
+1
-1
CourseService.java
...java/com/qkdata/biz/management/service/CourseService.java
+51
-133
CourseTagService.java
...a/com/qkdata/biz/management/service/CourseTagService.java
+3
-1
RecommendConfigService.java
...qkdata/biz/management/service/RecommendConfigService.java
+3
-55
QueryCourseModel.java
...n/java/com/qkdata/biz/management/vo/QueryCourseModel.java
+11
-0
RecommendConfigModel.java
...va/com/qkdata/biz/management/vo/RecommendConfigModel.java
+1
-32
SwiperConfigModel.java
.../java/com/qkdata/biz/management/vo/SwiperConfigModel.java
+1
-0
MainPageController.java
...ava/com/qkdata/biz/web/controller/MainPageController.java
+9
-6
MainPageModel.java
src/main/java/com/qkdata/biz/web/vo/MainPageModel.java
+0
-2
courseMapper.xml
src/main/resources/mappers/management/courseMapper.xml
+48
-35
course_tagMapper.xml
src/main/resources/mappers/management/course_tagMapper.xml
+4
-2
recommend_configMapper.xml
...n/resources/mappers/management/recommend_configMapper.xml
+6
-8
swiper_configMapper.xml
...main/resources/mappers/management/swiper_configMapper.xml
+0
-1
Test.java
src/test/java/com/qkdata/autogenerator/Test.java
+9
-0
No files found.
src/main/java/com/qkdata/biz/management/controller/MainPageTagConfigController.java
View file @
987ff803
...
@@ -43,11 +43,13 @@ public class MainPageTagConfigController {
...
@@ -43,11 +43,13 @@ public class MainPageTagConfigController {
@ApiOperation
(
"添加标签"
)
@ApiOperation
(
"添加标签"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
String
>
add
(
@RequestBody
AddMainPageTagConfigModel
model
){
public
Result
<
String
>
add
(
@RequestBody
List
<
Long
>
tagIds
){
CourseTagPO
po
=
new
CourseTagPO
();
for
(
Long
tagId
:
tagIds
){
po
.
setId
(
model
.
getTagId
());
CourseTagPO
po
=
new
CourseTagPO
();
po
.
setRecommend
(
true
);
po
.
setId
(
tagId
);
tagService
.
updateById
(
po
);
po
.
setRecommend
(
true
);
tagService
.
updateById
(
po
);
}
return
Result
.
succeed
(
"ok"
);
return
Result
.
succeed
(
"ok"
);
}
}
@ApiOperation
(
"删除标签"
)
@ApiOperation
(
"删除标签"
)
...
...
src/main/java/com/qkdata/biz/management/controller/RecommendConfigController.java
View file @
987ff803
...
@@ -3,7 +3,12 @@ package com.qkdata.biz.management.controller;
...
@@ -3,7 +3,12 @@ package com.qkdata.biz.management.controller;
import
com.qkdata.biz.common.BizConstants
;
import
com.qkdata.biz.common.BizConstants
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.qkdata.biz.management.service.CourseService
;
import
com.qkdata.biz.management.service.RecommendConfigService
;
import
com.qkdata.biz.management.service.RecommendConfigService
;
import
com.qkdata.biz.management.vo.CourseListItemModel
;
import
com.qkdata.biz.management.vo.QueryCourseModel
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.common.base.model.PageResult
;
import
com.qkdata.common.base.model.Result
;
import
com.qkdata.common.base.model.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -13,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -13,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
...
@@ -29,18 +35,33 @@ public class RecommendConfigController {
...
@@ -29,18 +35,33 @@ public class RecommendConfigController {
@Autowired
@Autowired
private
RecommendConfigService
configService
;
private
RecommendConfigService
configService
;
@Autowired
private
CourseService
courseService
;
@ApiOperation
(
"待选课程列表"
)
@PostMapping
(
"/select"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
PageResult
<
CourseListItemModel
>
select
(
@RequestBody
QueryCourseModel
model
){
List
<
RecommendConfigPO
>
list
=
configService
.
list
();
List
<
Long
>
courseIds
=
list
.
stream
().
map
(
RecommendConfigPO:
:
getCourseId
).
collect
(
Collectors
.
toList
());
model
.
setNotInIdList
(
courseIds
);
return
courseService
.
queryPageList
(
model
);
}
@ApiOperation
(
"获取推荐列表"
)
@ApiOperation
(
"获取推荐列表"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
List
<
RecommendConfig
PO
>>
list
(){
public
Result
<
List
<
RecommendConfig
Model
>>
list
(){
return
Result
.
succeed
(
configService
.
list
());
return
Result
.
succeed
(
configService
.
list
Config
());
}
}
@ApiOperation
(
"添加推荐"
)
@ApiOperation
(
"添加推荐"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
String
>
add
(
@RequestBody
RecommendConfigPO
po
){
public
Result
<
String
>
add
(
@RequestBody
List
<
RecommendConfigPO
>
list
){
configService
.
save
(
po
);
for
(
RecommendConfigPO
po
:
list
){
configService
.
save
(
po
);
}
return
Result
.
succeed
(
"ok"
);
return
Result
.
succeed
(
"ok"
);
}
}
@ApiOperation
(
"删除推荐"
)
@ApiOperation
(
"删除推荐"
)
...
...
src/main/java/com/qkdata/biz/management/mapper/CourseMapper.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
mapper
;
package
com
.
qkdata
.
biz
.
management
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.qkdata.biz.enums.CourseStatusEnum
;
import
com.qkdata.biz.enums.CourseStatusEnum
;
import
com.qkdata.biz.management.entity.CoursePO
;
import
com.qkdata.biz.management.entity.CoursePO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.qkdata.biz.management.vo.CourseAllowEnterpriseModel
;
import
com.qkdata.biz.management.vo.CourseAllowEnterpriseModel
;
import
com.qkdata.biz.management.vo.CourseAttachmentModel
;
import
com.qkdata.biz.management.vo.CourseAttachmentModel
;
import
com.qkdata.biz.management.vo.CourseListItemModel
;
import
com.qkdata.biz.management.vo.CourseListItemModel
;
...
@@ -34,5 +34,9 @@ public interface CourseMapper extends BaseMapper<CoursePO> {
...
@@ -34,5 +34,9 @@ public interface CourseMapper extends BaseMapper<CoursePO> {
List
<
CourseAllowEnterpriseModel
>
selectOrgListByCourseId
(
Long
id
);
List
<
CourseAllowEnterpriseModel
>
selectOrgListByCourseId
(
Long
id
);
List
<
SearchCourseResultModel
>
searchPageList
(
Page
page
,
@Param
(
"p"
)
SearchCourseConditionModel
model
,
@Param
(
"enterpriseId"
)
Long
enterpriseId
);
List
<
SearchCourseResultModel
>
searchPageList
(
Page
page
,
@Param
(
"p"
)
SearchCourseConditionModel
model
);
List
<
SearchCourseResultModel
>
recommendList
(
Page
page
,
@Param
(
"p"
)
SearchCourseConditionModel
model
);
List
<
CoursePO
>
findListByTags
(
List
<
Long
>
tagIds
);
}
}
src/main/java/com/qkdata/biz/management/mapper/CourseTagMapper.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
mapper
;
package
com
.
qkdata
.
biz
.
management
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.
baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.
qkdata.biz.management.vo.CourseTagsModel
;
import
com.qkdata.biz.management.vo.QueryCourseTagModel
;
import
com.qkdata.biz.management.vo.QueryCourseTagModel
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -22,5 +23,5 @@ public interface CourseTagMapper extends BaseMapper<CourseTagPO> {
...
@@ -22,5 +23,5 @@ public interface CourseTagMapper extends BaseMapper<CourseTagPO> {
List
<
CourseTagPO
>
queryPageList
(
Page
page
,
@Param
(
"p"
)
QueryCourseTagModel
param
);
List
<
CourseTagPO
>
queryPageList
(
Page
page
,
@Param
(
"p"
)
QueryCourseTagModel
param
);
List
<
CourseTag
PO
>
selectListByCourseId
(
Long
courseId
);
List
<
CourseTag
sModel
>
selectListByCourseId
(
Long
courseId
);
}
}
src/main/java/com/qkdata/biz/management/mapper/RecommendConfigMapper.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
mapper
;
package
com
.
qkdata
.
biz
.
management
.
mapper
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
src/main/java/com/qkdata/biz/management/service/CourseService.java
View file @
987ff803
...
@@ -3,7 +3,6 @@ package com.qkdata.biz.management.service;
...
@@ -3,7 +3,6 @@ package com.qkdata.biz.management.service;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.vod.model.v20170321.GetPlayInfoResponse
;
import
com.aliyuncs.vod.model.v20170321.GetVideoInfoResponse
;
import
com.aliyuncs.vod.model.v20170321.GetVideoInfoResponse
;
import
com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse
;
import
com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
@@ -66,101 +65,23 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -66,101 +65,23 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
private
SysUserService
sysUserService
;
private
SysUserService
sysUserService
;
@Autowired
@Autowired
private
UserFavoritesService
userFavoritesService
;
private
UserFavoritesService
userFavoritesService
;
@Autowired
private
RecommendConfigService
recommendConfigService
;
public
PageResult
<
CourseListItemModel
>
queryPageList
(
QueryCourseModel
param
)
{
public
PageResult
<
CourseListItemModel
>
queryPageList
(
QueryCourseModel
param
)
{
Page
page
=
new
Page
(
param
.
getPageIndex
(),
param
.
getPageSize
());
Page
page
=
new
Page
(
param
.
getPageIndex
(),
param
.
getPageSize
());
List
<
CourseListItemModel
>
list
=
baseMapper
.
queryPageList
(
page
,
param
);
List
<
CourseListItemModel
>
list
=
baseMapper
.
queryPageList
(
page
,
param
);
for
(
CourseListItemModel
course
:
list
)
{
for
(
CourseListItemModel
course
:
list
)
{
List
<
CourseTag
PO
>
tagsList
=
tagService
.
findListByCourseId
(
course
.
getId
());
List
<
CourseTag
sModel
>
tagsList
=
tagService
.
findListByCourseId
(
course
.
getId
());
if
(
CollUtil
.
isNotEmpty
(
tagsList
))
{
if
(
CollUtil
.
isNotEmpty
(
tagsList
))
{
List
<
String
>
tagNameList
=
tagsList
.
stream
().
map
(
CourseTag
PO:
:
get
Name
).
collect
(
Collectors
.
toList
());
List
<
String
>
tagNameList
=
tagsList
.
stream
().
map
(
CourseTag
sModel:
:
getTag
Name
).
collect
(
Collectors
.
toList
());
course
.
setTags
(
tagNameList
);
course
.
setTags
(
tagNameList
);
}
}
}
}
return
PageResult
.<
CourseListItemModel
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
list
).
build
();
return
PageResult
.<
CourseListItemModel
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
list
).
build
();
}
}
// @Transactional
// public Long saveStep1(CourseStep1SaveModel model) {
// CoursePO po = convertToPO(model);
// if (po.getId() == null){
// save(po);
// }else {
// updateById(po);
// }
//
// if (CollUtil.isNotEmpty(model.getTagIds())){
// updateCourseTags(po.getId(),model.getTagIds());
// }
// if (model.getAllow() == CourseAllowEnum.SPECIFY){
// updateCourseAllowOrg(po.getId(),model.getAllowOrgIds());
// }
// return po.getId();
// }
// private void updateCourseAllowOrg(Long id, List<Long> allowOrgIds) {
// //TODO
// }
//
// private void updateCourseTags(Long id, List<Long> tagIds) {
// //TODO
// }
// private CoursePO convertToPO(CourseStep1SaveModel model) {
// CoursePO po = new CoursePO();
// po.setId(model.getId());
// po.setName(model.getName());
// po.setType(model.getType());
// po.setIntroduce(model.getIntroduce());
// po.setDetail(model.getDetail());
// po.setLogoUrl(model.getLogoUrl());
// po.setStatus(CourseStatusEnum.UP);
// po.setTeacherId(model.getTeacherId());
// po.setChargeModel(model.getChargeModel());
// if (po.getChargeModel() == CourseChargeModelEnum.PAY) {
// po.setPrice(model.getPrice());
// po.setValidPeriod(model.getValidPeriod());
// po.setVipPrice(model.getVipPrice());
// }
// po.setModel(CourseModelEnum.VOD);
// po.setAllow(model.getAllow());
// po.setSeriesId(model.getSeriesId());
// return po;
// }
// @Transactional
// public void saveStep2(CourseStep2SaveModel model) {
// try {
// Long resourceId = saveToResource(model.getVideoId());
// CourseChapterPO po = new CourseChapterPO();
// po.setCourseId(model.getCourseId());
// po.setName(model.getChaperName());
// po.setResourceId(resourceId);
// po.setSortNo(model.getSortNo());
// chapterMapper.insert(po);
// } catch (ClientException e) {
// throw new BusinessException("获取视频信息错误");
// }
//
//
// }
//
// private Long saveToResource(String videoId) throws ClientException {
// //根据视频ID,获取视频信息
// GetVideoInfoResponse videoInfoResponse = aliyunService.getVideoInfo(videoId);
// Float duration = videoInfoResponse.getVideo().getDuration();
// Long size = videoInfoResponse.getVideo().getSize();
// String title = videoInfoResponse.getVideo().getTitle();
// ResourcePO po = resourceService.getByVideoId(videoId);
// if (po == null) {
// po = new ResourcePO();
// }
// po.setName(title);
// po.setSize(size);
// po.setVideoDuration(duration);
// resourceService.saveOrUpdate(po);
// return po.getId();
// }
public
CourseDetailModel
getCourseDetail
(
Long
id
)
{
public
CourseDetailModel
getCourseDetail
(
Long
id
)
{
CoursePO
po
=
getById
(
id
);
CoursePO
po
=
getById
(
id
);
...
@@ -428,9 +349,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -428,9 +349,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
public
PageResult
<
SearchCourseResultModel
>
search
(
SearchCourseConditionModel
model
)
{
public
PageResult
<
SearchCourseResultModel
>
search
(
SearchCourseConditionModel
model
)
{
Page
page
=
new
Page
(
model
.
getPageIndex
(),
model
.
getPageSize
());
Page
page
=
new
Page
(
model
.
getPageIndex
(),
model
.
getPageSize
());
String
username
=
UserContext
.
getUser
().
getUsername
();
List
<
SearchCourseResultModel
>
list
=
baseMapper
.
searchPageList
(
page
,
model
);
FullUserInfo
userInfo
=
sysUserService
.
findFullUserInfo
(
username
);
List
<
SearchCourseResultModel
>
list
=
baseMapper
.
searchPageList
(
page
,
model
,
userInfo
.
getEnterpriseId
());
for
(
SearchCourseResultModel
m
:
list
){
for
(
SearchCourseResultModel
m
:
list
){
List
<
CourseTagsModel
>
tags
=
tagRelMapper
.
selectModelList
(
m
.
getCourseId
());
List
<
CourseTagsModel
>
tags
=
tagRelMapper
.
selectModelList
(
m
.
getCourseId
());
m
.
setTags
(
tags
);
m
.
setTags
(
tags
);
...
@@ -519,79 +438,58 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -519,79 +438,58 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
}
}
return
null
;
return
null
;
}
}
private
List
<
CoursePO
>
findListByTags
(
List
<
Long
>
tagIds
){
return
baseMapper
.
findListByTags
(
tagIds
);
}
/**
/**
* 推荐课程列表
*
根据课程标签关联
推荐课程列表
* 默认推荐4个课程
* 默认推荐4个课程
* 优先推荐相同
系列
下的其它课程
* 优先推荐相同
标签
下的其它课程
* 如果相同
系列
下没有其它课程,则随机推荐其它课程
* 如果相同
标签
下没有其它课程,则随机推荐其它课程
* 注意过滤指定企业可见范围的课程
* 注意过滤指定企业可见范围的课程
* @return
* @return
*/
*/
public
List
<
RecommendConfigModel
>
r
ecommend
(
Long
courseId
)
{
public
List
<
SearchCourseResultModel
>
relationR
ecommend
(
Long
courseId
)
{
CoursePO
coursePO
=
getById
(
courseId
);
CoursePO
coursePO
=
getById
(
courseId
);
if
(
coursePO
!=
null
){
if
(
coursePO
!=
null
){
throw
new
BusinessException
(
"请求错误,课程不存在"
);
throw
new
BusinessException
(
"请求错误,课程不存在"
);
}
}
List
<
RecommendConfigModel
>
resultList
=
Lists
.
newArrayList
();
List
<
SearchCourseResultModel
>
resultList
=
Lists
.
newArrayList
();
Long
seriesId
=
coursePO
.
getSeriesId
();
List
<
CourseTagsModel
>
courseTagsModelList
=
tagService
.
findListByCourseId
(
courseId
);
Long
enterpriseId
=
sysUserService
.
getCurrentUserEnterpriseId
();
List
<
Long
>
tagIds
=
courseTagsModelList
.
stream
().
map
(
CourseTagsModel:
:
getTagId
).
collect
(
Collectors
.
toList
());
List
<
CoursePO
>
sameSeriesCourseList
=
list
(
Wrappers
.<
CoursePO
>
lambdaQuery
().
eq
(
CoursePO:
:
getSeriesId
,
seriesId
).
eq
(
CoursePO:
:
getStatus
,
CourseStatusEnum
.
UP
));
List
<
CoursePO
>
courseList
=
findListByTags
(
tagIds
);
for
(
CoursePO
course
:
sameSeriesCourseList
){
int
index
=
0
;
if
(
course
.
getAllow
()
==
CourseAllowEnum
.
SPECIFY
){
for
(
CoursePO
course
:
courseList
){
List
<
Long
>
orgIds
=
getAllowEnterpriseList
(
courseId
);
if
(
index
==
3
){
boolean
hasPerm
=
false
;
break
;
for
(
Long
orgId
:
orgIds
){
if
(
enterpriseId
!=
null
){
if
(
orgId
.
longValue
()
==
enterpriseId
.
longValue
()){
hasPerm
=
true
;
break
;
}
}
}
if
(
hasPerm
){
RecommendConfigModel
model
=
new
RecommendConfigModel
();
model
.
setCourseId
(
courseId
);
model
.
setCourseName
(
course
.
getName
());
model
.
setCourseLogoUrl
(
course
.
getLogoUrl
());
model
.
setChargeModel
(
course
.
getChargeModel
());
model
.
setAllow
(
course
.
getAllow
());
resultList
.
add
(
model
);
}
else
{
continue
;
}
}
else
{
}
else
{
RecommendConfigModel
model
=
new
RecommendConfig
Model
();
SearchCourseResultModel
model
=
new
SearchCourseResult
Model
();
model
.
setCourseId
(
course
Id
);
model
.
setCourseId
(
course
.
getId
()
);
model
.
setCourseName
(
course
.
getName
());
model
.
setCourseName
(
course
.
getName
());
model
.
setCourseLogoUrl
(
course
.
getLogoUrl
());
model
.
setCourseLogoUrl
(
course
.
getLogoUrl
());
model
.
setChargeModel
(
course
.
getChargeModel
());
model
.
setAllow
(
course
.
getAllow
());
resultList
.
add
(
model
);
resultList
.
add
(
model
);
index
++;
}
}
if
(
resultList
.
size
()
==
4
){
break
;
}
}
}
if
(
resultList
.
size
()
<
4
){
if
(
resultList
.
size
()
<
4
){
int
diff
=
4
-
resultList
.
size
();
int
diff
=
4
-
resultList
.
size
();
List
<
Long
>
ids
=
resultList
.
stream
().
map
(
RecommendConfig
Model:
:
getCourseId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
ids
=
resultList
.
stream
().
map
(
SearchCourseResult
Model:
:
getCourseId
).
collect
(
Collectors
.
toList
());
List
<
CoursePO
>
courseList
=
list
(
Wrappers
.<
CoursePO
>
lambdaQuery
()
courseList
=
list
(
Wrappers
.<
CoursePO
>
lambdaQuery
()
.
notIn
(
CoursePO:
:
getId
,
ids
)
.
notIn
(
CoursePO:
:
getId
,
ids
)
.
eq
(
CoursePO:
:
getStatus
,
CourseStatusEnum
.
UP
)
.
eq
(
CoursePO:
:
getStatus
,
CourseStatusEnum
.
UP
)
.
eq
(
CoursePO:
:
getAllow
,
CourseAllowEnum
.
ALL
)
.
last
(
"limit "
+
diff
));
.
last
(
"limit "
+
diff
));
for
(
CoursePO
course
:
courseList
){
for
(
CoursePO
course
:
courseList
){
RecommendConfigModel
model
=
new
RecommendConfig
Model
();
SearchCourseResultModel
model
=
new
SearchCourseResult
Model
();
model
.
setCourseId
(
course
Id
);
model
.
setCourseId
(
course
.
getId
()
);
model
.
setCourseName
(
course
.
getName
());
model
.
setCourseName
(
course
.
getName
());
model
.
setCourseLogoUrl
(
course
.
getLogoUrl
());
model
.
setCourseLogoUrl
(
course
.
getLogoUrl
());
model
.
setChargeModel
(
course
.
getChargeModel
());
model
.
setAllow
(
course
.
getAllow
());
resultList
.
add
(
model
);
resultList
.
add
(
model
);
}
}
}
}
for
(
RecommendConfig
Model
model
:
resultList
){
for
(
SearchCourseResult
Model
model
:
resultList
){
List
<
CourseTag
PO
>
tagList
=
tagService
.
findListByCourseId
(
model
.
getCourseId
());
List
<
CourseTag
sModel
>
tagList
=
tagService
.
findListByCourseId
(
model
.
getCourseId
());
model
.
setTags
(
tagList
);
model
.
setTags
(
tagList
);
List
<
CourseChaperModel
>
chaperList
=
chaperList
(
model
.
getCourseId
());
List
<
CourseChaperModel
>
chaperList
=
chaperList
(
model
.
getCourseId
());
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
...
@@ -603,7 +501,26 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -603,7 +501,26 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
}
}
}
}
}
}
return
resultList
;
return
resultList
;
}
}
public
PageResult
<
SearchCourseResultModel
>
mainPageRecommendList
(
SearchCourseConditionModel
model
)
{
Page
page
=
new
Page
(
model
.
getPageIndex
(),
model
.
getPageSize
());
List
<
SearchCourseResultModel
>
list
=
baseMapper
.
recommendList
(
page
,
model
);
for
(
SearchCourseResultModel
recommend
:
list
){
List
<
CourseTagsModel
>
tagList
=
tagService
.
findListByCourseId
(
recommend
.
getCourseId
());
recommend
.
setTags
(
tagList
);
List
<
CourseChaperModel
>
chaperList
=
chaperList
(
recommend
.
getCourseId
());
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
CourseChaperModel
chaperModel
=
chaperList
.
get
(
0
);
ResourcePO
resourcePO
=
resourceService
.
getById
(
chaperModel
.
getResourceId
());
if
(
resourcePO
!=
null
){
recommend
.
setDuration
(
resourcePO
.
getVideoDuration
());
}
}
}
return
PageResult
.<
SearchCourseResultModel
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
list
).
build
();
}
}
}
\ No newline at end of file
src/main/java/com/qkdata/biz/management/service/CourseTagService.java
View file @
987ff803
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.mapper.CourseTagMapper
;
import
com.qkdata.biz.management.mapper.CourseTagMapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.qkdata.biz.management.vo.CourseTagsModel
;
import
com.qkdata.biz.management.vo.QueryCourseTagModel
;
import
com.qkdata.biz.management.vo.QueryCourseTagModel
;
import
com.qkdata.common.base.enums.CodeEnum
;
import
com.qkdata.common.base.enums.CodeEnum
;
import
com.qkdata.common.base.model.PageResult
;
import
com.qkdata.common.base.model.PageResult
;
...
@@ -28,7 +29,7 @@ public class CourseTagService extends ServiceImpl<CourseTagMapper, CourseTagPO>
...
@@ -28,7 +29,7 @@ public class CourseTagService extends ServiceImpl<CourseTagMapper, CourseTagPO>
return
PageResult
.<
CourseTagPO
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
pageList
).
build
();
return
PageResult
.<
CourseTagPO
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
pageList
).
build
();
}
}
public
List
<
CourseTag
PO
>
findListByCourseId
(
Long
courseId
)
{
public
List
<
CourseTag
sModel
>
findListByCourseId
(
Long
courseId
)
{
return
baseMapper
.
selectListByCourseId
(
courseId
);
return
baseMapper
.
selectListByCourseId
(
courseId
);
}
}
}
}
\ No newline at end of file
src/main/java/com/qkdata/biz/management/service/RecommendConfigService.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
service
;
package
com
.
qkdata
.
biz
.
management
.
service
;
import
cn.hutool.core.collection.CollUtil
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.google.common.collect.Lists
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.qkdata.biz.management.entity.RecommendConfigPO
;
import
com.qkdata.biz.management.entity.ResourcePO
;
import
com.qkdata.biz.management.mapper.RecommendConfigMapper
;
import
com.qkdata.biz.management.mapper.RecommendConfigMapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.qkdata.biz.management.vo.CourseChaperModel
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.biz.management.vo.VideoInfoModel
;
import
com.qkdata.biz.sys.service.SysUserService
;
import
com.qkdata.biz.web.vo.FullUserInfo
;
import
com.qkdata.common.util.UserContext
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,52 +20,11 @@ import java.util.List;
...
@@ -32,52 +20,11 @@ import java.util.List;
@Slf4j
@Slf4j
@Service
@Service
public
class
RecommendConfigService
extends
ServiceImpl
<
RecommendConfigMapper
,
RecommendConfigPO
>
{
public
class
RecommendConfigService
extends
ServiceImpl
<
RecommendConfigMapper
,
RecommendConfigPO
>
{
@Autowired
private
CourseService
courseService
;
@Autowired
private
ResourceService
resourceService
;
@Autowired
private
CourseTagService
tagService
;
@Autowired
private
SysUserService
sysUserService
;
public
List
<
RecommendConfigModel
>
listConfig
()
{
public
List
<
RecommendConfigModel
>
listConfig
()
{
List
<
RecommendConfigModel
>
modelList
=
baseMapper
.
listConfig
();
List
<
RecommendConfigModel
>
modelList
=
baseMapper
.
listConfig
();
List
<
RecommendConfigModel
>
resultList
=
Lists
.
newArrayList
();
for
(
RecommendConfigModel
model
:
modelList
){
if
(
model
.
getAllow
()
==
CourseAllowEnum
.
SPECIFY
){
List
<
Long
>
orgIds
=
courseService
.
getAllowEnterpriseList
(
model
.
getCourseId
());
String
username
=
UserContext
.
getUser
().
getUsername
();
FullUserInfo
userInfo
=
sysUserService
.
findFullUserInfo
(
username
);
boolean
hasPerm
=
false
;
for
(
Long
orgId
:
orgIds
){
if
(
userInfo
.
getEnterpriseId
()
!=
null
){
if
(
orgId
.
longValue
()
==
userInfo
.
getEnterpriseId
().
longValue
()){
hasPerm
=
true
;
break
;
}
}
}
if
(
hasPerm
){
resultList
.
add
(
model
);
}
else
{
continue
;
}
}
else
{
resultList
.
add
(
model
);
}
List
<
CourseChaperModel
>
chaperList
=
courseService
.
chaperList
(
model
.
getCourseId
());
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
CourseChaperModel
chaperModel
=
chaperList
.
get
(
0
);
ResourcePO
resourcePO
=
resourceService
.
getById
(
chaperModel
.
getResourceId
());
if
(
resourcePO
!=
null
){
model
.
setDuration
(
resourcePO
.
getVideoDuration
());
}
return
modelList
;
}
List
<
CourseTagPO
>
tagList
=
tagService
.
findListByCourseId
(
model
.
getCourseId
());
model
.
setTags
(
tagList
);
}
return
resultList
;
}
}
}
}
\ No newline at end of file
src/main/java/com/qkdata/biz/management/vo/QueryCourseModel.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
vo
;
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.enums.CourseStatusEnum
;
import
com.qkdata.biz.enums.CourseStatusEnum
;
import
com.qkdata.common.constants.Constants
;
import
com.qkdata.common.constants.Constants
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
@Data
@Data
public
class
QueryCourseModel
{
public
class
QueryCourseModel
{
private
int
pageIndex
=
Constants
.
DEFAULT_PAGE
;
private
int
pageIndex
=
Constants
.
DEFAULT_PAGE
;
...
@@ -25,4 +28,12 @@ public class QueryCourseModel {
...
@@ -25,4 +28,12 @@ public class QueryCourseModel {
* 课程状态
* 课程状态
*/
*/
private
CourseStatusEnum
status
;
private
CourseStatusEnum
status
;
/**
* 可见范围
*/
private
CourseAllowEnum
allow
;
/**
* 不包含课程ID列表
*/
private
List
<
Long
>
notInIdList
;
}
}
src/main/java/com/qkdata/biz/management/vo/RecommendConfigModel.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
management
.
vo
;
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
@Data
@Data
public
class
RecommendConfigModel
{
public
class
RecommendConfigModel
{
/**
private
Long
id
;
* 课程ID
*/
private
Long
courseId
;
private
Long
courseId
;
/**
* 课程名称
*/
private
String
courseName
;
private
String
courseName
;
/**
* 课程封面url
*/
private
String
courseLogoUrl
;
private
String
courseLogoUrl
;
/**
* 收费模式
*/
private
CourseChargeModelEnum
chargeModel
;
/**
* 视频时长
*/
private
Float
duration
;
/**
* 标签
*/
private
List
<
CourseTagPO
>
tags
;
/**
* 可见范围
*/
private
CourseAllowEnum
allow
;
}
}
src/main/java/com/qkdata/biz/management/vo/SwiperConfigModel.java
View file @
987ff803
...
@@ -5,6 +5,7 @@ import lombok.Data;
...
@@ -5,6 +5,7 @@ import lombok.Data;
@Data
@Data
public
class
SwiperConfigModel
{
public
class
SwiperConfigModel
{
private
Long
id
;
/**
/**
* 封面图片url
* 封面图片url
*/
*/
...
...
src/main/java/com/qkdata/biz/web/controller/MainPageController.java
View file @
987ff803
...
@@ -10,7 +10,6 @@ import com.qkdata.biz.management.service.CourseTagService;
...
@@ -10,7 +10,6 @@ import com.qkdata.biz.management.service.CourseTagService;
import
com.qkdata.biz.management.service.RecommendConfigService
;
import
com.qkdata.biz.management.service.RecommendConfigService
;
import
com.qkdata.biz.management.service.SwiperConfigService
;
import
com.qkdata.biz.management.service.SwiperConfigService
;
import
com.qkdata.biz.management.vo.CourseDetailModel
;
import
com.qkdata.biz.management.vo.CourseDetailModel
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.biz.management.vo.SwiperConfigModel
;
import
com.qkdata.biz.management.vo.SwiperConfigModel
;
import
com.qkdata.biz.web.service.UserCenterService
;
import
com.qkdata.biz.web.service.UserCenterService
;
import
com.qkdata.biz.web.vo.MainPageModel
;
import
com.qkdata.biz.web.vo.MainPageModel
;
...
@@ -52,14 +51,18 @@ public class MainPageController {
...
@@ -52,14 +51,18 @@ public class MainPageController {
public
Result
<
MainPageModel
>
get
(){
public
Result
<
MainPageModel
>
get
(){
List
<
SwiperConfigModel
>
swiperConfigModels
=
swiperConfigService
.
listConfig
(
SwiperStatusEnum
.
ENABLE
);
List
<
SwiperConfigModel
>
swiperConfigModels
=
swiperConfigService
.
listConfig
(
SwiperStatusEnum
.
ENABLE
);
List
<
CourseTagPO
>
tagList
=
courseTagService
.
list
(
Wrappers
.<
CourseTagPO
>
lambdaQuery
().
eq
(
CourseTagPO:
:
getRecommend
,
true
));
List
<
CourseTagPO
>
tagList
=
courseTagService
.
list
(
Wrappers
.<
CourseTagPO
>
lambdaQuery
().
eq
(
CourseTagPO:
:
getRecommend
,
true
));
List
<
RecommendConfigModel
>
recommendConfigList
=
recommendConfigService
.
listConfig
();
MainPageModel
model
=
new
MainPageModel
();
MainPageModel
model
=
new
MainPageModel
();
model
.
setTags
(
tagList
);
model
.
setTags
(
tagList
);
model
.
setSwiperConfigs
(
swiperConfigModels
);
model
.
setSwiperConfigs
(
swiperConfigModels
);
model
.
setRecommendConfigs
(
recommendConfigList
);
return
Result
.
succeed
(
model
);
return
Result
.
succeed
(
model
);
}
}
@ApiOperation
(
"首页推存课程列表"
)
@PostMapping
(
"/course/recommend/list"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_USER
,
BizConstants
.
ROLE_ENTERPRISE_ADMIN
},
logical
=
Logical
.
OR
)
public
PageResult
<
SearchCourseResultModel
>
recommendCourseList
(
@RequestBody
SearchCourseConditionModel
model
){
return
courseService
.
mainPageRecommendList
(
model
);
}
@ApiOperation
(
"搜索课程"
)
@ApiOperation
(
"搜索课程"
)
@PostMapping
(
"/course/search"
)
@PostMapping
(
"/course/search"
)
...
@@ -77,11 +80,11 @@ public class MainPageController {
...
@@ -77,11 +80,11 @@ public class MainPageController {
return
Result
.
succeed
(
tags
);
return
Result
.
succeed
(
tags
);
}
}
@ApiOperation
(
"
获取推荐课程
"
)
@ApiOperation
(
"
详情页关联课程推荐
"
)
@GetMapping
(
"/course/recommend/{courseId}"
)
@GetMapping
(
"/course/recommend/{courseId}"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_USER
,
BizConstants
.
ROLE_ENTERPRISE_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_USER
,
BizConstants
.
ROLE_ENTERPRISE_ADMIN
},
logical
=
Logical
.
OR
)
public
Result
<
List
<
RecommendConfig
Model
>>
courseRecommend
(
Long
courseId
){
public
Result
<
List
<
SearchCourseResult
Model
>>
courseRecommend
(
Long
courseId
){
List
<
RecommendConfigModel
>
list
=
courseService
.
r
ecommend
(
courseId
);
List
<
SearchCourseResultModel
>
list
=
courseService
.
relationR
ecommend
(
courseId
);
return
Result
.
succeed
(
list
);
return
Result
.
succeed
(
list
);
}
}
...
...
src/main/java/com/qkdata/biz/web/vo/MainPageModel.java
View file @
987ff803
package
com
.
qkdata
.
biz
.
web
.
vo
;
package
com
.
qkdata
.
biz
.
web
.
vo
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.entity.CourseTagPO
;
import
com.qkdata.biz.management.vo.RecommendConfigModel
;
import
com.qkdata.biz.management.vo.SwiperConfigModel
;
import
com.qkdata.biz.management.vo.SwiperConfigModel
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -11,5 +10,4 @@ import java.util.List;
...
@@ -11,5 +10,4 @@ import java.util.List;
public
class
MainPageModel
{
public
class
MainPageModel
{
List
<
SwiperConfigModel
>
swiperConfigs
;
List
<
SwiperConfigModel
>
swiperConfigs
;
List
<
CourseTagPO
>
tags
;
List
<
CourseTagPO
>
tags
;
List
<
RecommendConfigModel
>
recommendConfigs
;
}
}
src/main/resources/mappers/management/courseMapper.xml
View file @
987ff803
...
@@ -28,6 +28,15 @@
...
@@ -28,6 +28,15 @@
<if
test=
"p.status != null"
>
<if
test=
"p.status != null"
>
AND c.`status` = #{p.status}
AND c.`status` = #{p.status}
</if>
</if>
<if
test=
"p.allow != null"
>
and c.allow = #{p.allow}
</if>
<if
test=
"p.notInIdList != null and p.notInIdList.size > 0"
>
and c.id not in
<foreach
collection=
"p.notInIdList"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
ORDER BY c.create_time DESC
ORDER BY c.create_time DESC
</select>
</select>
...
@@ -50,48 +59,52 @@
...
@@ -50,48 +59,52 @@
WHERE r.course_id = #{id}
WHERE r.course_id = #{id}
</select>
</select>
<select
id=
"searchPageList"
resultType=
"com.qkdata.biz.web.vo.SearchCourseResultModel"
>
<select
id=
"searchPageList"
resultType=
"com.qkdata.biz.web.vo.SearchCourseResultModel"
>
SELECT
SELECT DISTINCT
*
c.id course_id,
c.`name` course_name,
c.charge_model,
c.logo_url course_logo_url,
c.teacher_id
FROM
FROM
(
course c
SELECT
LEFT JOIN course_tag_rel r on c.id = r.course_id
c.id course_id,
WHERE
c.`name` course_name,
c.is_del = 0
c.charge_model,
AND c.allow = 'ALL'
c.logo_url course_logo_url,
AND c.`status` = 'UP'
c.teacher_id
FROM
course c
WHERE
c.is_del = 0
AND c.allow = 'ALL'
and c.status = 'UP'
UNION
SELECT
c.id course_id,
c.`name` course_name,
c.charge_model,
c.logo_url course_logo_url,
c.teacher_id
FROM
course c
INNER JOIN allow_org_course o ON c.id = o.course_id
WHERE
c.is_del = 0
and c.status = 'UP'
AND c.allow = 'SPECIFY'
AND o.org_id = #{enterpriseId}
) tmp
LEFT JOIN course_tag_rel r on tmp.course_id = r.course_id
WHERE 1= 1
<if
test=
"p.courseName != null and p.courseName != ''"
>
<if
test=
"p.courseName != null and p.courseName != ''"
>
and
tmp.course_name
like concat ('%',#{p.courseName},'%')
and
c.`name`
like concat ('%',#{p.courseName},'%')
</if>
</if>
<if
test=
"p.tagId != null"
>
<if
test=
"p.tagId != null"
>
and r.tag_id = #{p.tagId}
and r.tag_id = #{p.tagId}
</if>
</if>
<if
test=
"p.teacherId != null"
>
<if
test=
"p.teacherId != null"
>
and
tmp
.teacher_id = #{p.teacherId}
and
c
.teacher_id = #{p.teacherId}
</if>
</if>
</select>
</select>
<select
id=
"recommendList"
resultType=
"com.qkdata.biz.web.vo.SearchCourseResultModel"
>
SELECT c.id course_id,
c.`name` course_name,
c.logo_url course_logo_url,
c.charge_model,
c.allow
from course c
LEFT JOIN recommend_config r on r.course_id = c.id
WHERE c.is_del = 0
and c.`status` = 'UP'
and c.allow = 'ALL'
ORDER BY r.sort_no ASC,c.create_time DESC
</select>
<select
id=
"findListByTags"
resultType=
"com.qkdata.biz.management.entity.CoursePO"
>
SELECT c.*
FROM course c
INNER JOIN course_tag_rel r on c.id = r.course_id
WHERE c.is_del = 0
and c.`status` = 'UP'
and c.allow = 'ALL'
and r.tag_id in
<foreach
collection=
"tagIds"
item=
"tagId"
open=
"("
close=
")"
separator=
","
>
#{tagId}
</foreach>
</select>
</mapper>
</mapper>
src/main/resources/mappers/management/course_tagMapper.xml
View file @
987ff803
...
@@ -12,8 +12,10 @@
...
@@ -12,8 +12,10 @@
and recommend = 0
and recommend = 0
</if>
</if>
</select>
</select>
<select
id=
"selectListByCourseId"
resultType=
"com.qkdata.biz.management.entity.CourseTagPO"
>
<select
id=
"selectListByCourseId"
resultType=
"com.qkdata.biz.management.vo.CourseTagsModel"
>
select t.*
select t.id tag_id,
t.`name` tag_name,
r.course_id
from course_tag t
from course_tag t
inner join course_tag_rel r on t.id = r.tag_id
inner join course_tag_rel r on t.id = r.tag_id
where r.course_id = #{courseId}
where r.course_id = #{courseId}
...
...
src/main/resources/mappers/management/recommend_configMapper.xml
View file @
987ff803
...
@@ -3,14 +3,12 @@
...
@@ -3,14 +3,12 @@
<mapper
namespace=
"com.qkdata.biz.management.mapper.RecommendConfigMapper"
>
<mapper
namespace=
"com.qkdata.biz.management.mapper.RecommendConfigMapper"
>
<select
id=
"listConfig"
resultType=
"com.qkdata.biz.management.vo.RecommendConfigModel"
>
<select
id=
"listConfig"
resultType=
"com.qkdata.biz.management.vo.RecommendConfigModel"
>
SELECT c.id course_id,
SELECT r.id,
c.id course_id,
c.`name` course_name,
c.`name` course_name,
c.charge_model,
c.logo_url course_logo_url
c.logo_url course_logo_url,
from course c
c.allow
INNER JOIN recommend_config r on c.id = r.course_id
from recommend_config cfg
INNER JOIN course c on cfg.course_id = c.id
and c.status = 'UP'
ORDER BY cfg.sort_no ASC
</select>
</select>
</mapper>
</mapper>
src/main/resources/mappers/management/swiper_configMapper.xml
View file @
987ff803
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
s.`name` course_name
s.`name` course_name
from swiper_config c
from swiper_config c
INNER JOIN course s on c.course_id = s.id
INNER JOIN course s on c.course_id = s.id
and s.status = 'UP'
<if
test=
"status != null"
>
<if
test=
"status != null"
>
and c.status = #{status}
and c.status = #{status}
</if>
</if>
...
...
src/test/java/com/qkdata/autogenerator/Test.java
0 → 100644
View file @
987ff803
package
com
.
qkdata
.
autogenerator
;
import
cn.hutool.core.util.RandomUtil
;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
RandomUtil
.
randomString
(
32
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment