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
6ccfd249
Commit
6ccfd249
authored
May 26, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成课程管理后台接口
parent
c3c43641
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
163 additions
and
20 deletions
+163
-20
CourseController.java
...om/qkdata/biz/management/controller/CourseController.java
+27
-20
AllowOrgCourseMapper.java
...om/qkdata/biz/management/mapper/AllowOrgCourseMapper.java
+1
-0
CourseAttachmentMapper.java
.../qkdata/biz/management/mapper/CourseAttachmentMapper.java
+1
-0
CourseMapper.java
...n/java/com/qkdata/biz/management/mapper/CourseMapper.java
+6
-0
CourseTagRelMapper.java
.../com/qkdata/biz/management/mapper/CourseTagRelMapper.java
+2
-0
CourseService.java
...java/com/qkdata/biz/management/service/CourseService.java
+0
-0
SaveCourseChaperModel.java
...a/com/qkdata/biz/management/vo/SaveCourseChaperModel.java
+11
-0
SaveCourseModel.java
...in/java/com/qkdata/biz/management/vo/SaveCourseModel.java
+88
-0
allow_org_courseMapper.xml
...n/resources/mappers/management/allow_org_courseMapper.xml
+3
-0
courseMapper.xml
src/main/resources/mappers/management/courseMapper.xml
+18
-0
course_attachmentMapper.xml
.../resources/mappers/management/course_attachmentMapper.xml
+3
-0
course_tag_relMapper.xml
...ain/resources/mappers/management/course_tag_relMapper.xml
+3
-0
No files found.
src/main/java/com/qkdata/biz/management/controller/CourseController.java
View file @
6ccfd249
...
@@ -54,31 +54,38 @@ public class CourseController {
...
@@ -54,31 +54,38 @@ public class CourseController {
return
Result
.
succeed
(
"ok"
);
return
Result
.
succeed
(
"ok"
);
}
}
@ApiOperation
(
"课程保存"
)
@ApiOperation
(
"添加课程(第一步保存)"
)
@PostMapping
(
"/save"
)
@PostMapping
(
"/saveStep1"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
@SysLog
(
value
=
"添加课程"
,
includeParam
=
false
)
public
Result
<
Long
>
saveStep1
(
@RequestBody
CourseStep1SaveModel
model
){
Long
id
=
courseService
.
saveStep1
(
model
);
return
Result
.
succeed
(
id
);
}
@ApiOperation
(
"添加课程(第二步保存)"
)
@PostMapping
(
"/saveStep2"
)
@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
>
save
Step2
(
@RequestBody
CourseStep2SaveModel
chaperM
odel
){
public
Result
<
String
>
save
Course
(
@RequestBody
SaveCourseModel
m
odel
){
courseService
.
save
Step2
(
chaperM
odel
);
courseService
.
save
Course
(
m
odel
);
return
Result
.
succeed
(
"ok"
);
return
Result
.
succeed
(
"ok"
);
}
}
// @ApiOperation("添加课程(第一步保存)")
// @PostMapping("/saveStep1")
// @RequiresRoles(value = {BizConstants.ROLE_ADMIN,BizConstants.ROLE_OPERATOR},logical = Logical.OR)
// @SysLog(value = "添加课程",includeParam = false)
// public Result<Long> saveStep1(@RequestBody CourseStep1SaveModel model){
// Long id = courseService.saveStep1(model);
// return Result.succeed(id);
// }
// @ApiOperation("添加课程(第二步保存)")
// @PostMapping("/saveStep2")
// @RequiresRoles(value = {BizConstants.ROLE_ADMIN,BizConstants.ROLE_OPERATOR},logical = Logical.OR)
// public Result<String> saveStep2(@RequestBody CourseStep2SaveModel chaperModel){
// courseService.saveStep2(chaperModel);
// return Result.succeed("ok");
// }
@ApiOperation
(
"添加课程(第二步中获取章节列表"
)
@GetMapping
(
"/chaperList/{courseId}"
)
// @ApiOperation("添加课程(第二步中获取章节列表")
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
// @GetMapping("/chaperList/{courseId}")
public
Result
<
List
<
CourseChaperModel
>>
chaperList
(
@PathVariable
Long
courseId
){
// @RequiresRoles(value = {BizConstants.ROLE_ADMIN,BizConstants.ROLE_OPERATOR},logical = Logical.OR)
List
<
CourseChaperModel
>
modelList
=
courseService
.
chaperList
(
courseId
);
// public Result<List<CourseChaperModel>> chaperList(@PathVariable Long courseId){
return
Result
.
succeed
(
modelList
);
// List<CourseChaperModel> modelList = courseService.chaperList(courseId);
}
// return Result.succeed(modelList);
// }
@ApiOperation
(
"修改章节名称"
)
@ApiOperation
(
"修改章节名称"
)
@PostMapping
(
"/modifyChaperName"
)
@PostMapping
(
"/modifyChaperName"
)
@SysLog
(
"修改章节名称"
)
@SysLog
(
"修改章节名称"
)
...
...
src/main/java/com/qkdata/biz/management/mapper/AllowOrgCourseMapper.java
View file @
6ccfd249
...
@@ -15,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -15,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
AllowOrgCourseMapper
extends
BaseMapper
<
AllowOrgCoursePO
>
{
public
interface
AllowOrgCourseMapper
extends
BaseMapper
<
AllowOrgCoursePO
>
{
void
deleteByCourseId
(
Long
courseId
);
}
}
src/main/java/com/qkdata/biz/management/mapper/CourseAttachmentMapper.java
View file @
6ccfd249
...
@@ -15,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -15,4 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
CourseAttachmentMapper
extends
BaseMapper
<
CourseAttachmentPO
>
{
public
interface
CourseAttachmentMapper
extends
BaseMapper
<
CourseAttachmentPO
>
{
void
deleteByCourseId
(
Long
courseId
);
}
}
src/main/java/com/qkdata/biz/management/mapper/CourseMapper.java
View file @
6ccfd249
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -4,6 +4,8 @@ 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.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.qkdata.biz.management.vo.CourseAllowEnterpriseModel
;
import
com.qkdata.biz.management.vo.CourseAttachmentModel
;
import
com.qkdata.biz.management.vo.CourseListItemModel
;
import
com.qkdata.biz.management.vo.CourseListItemModel
;
import
com.qkdata.biz.management.vo.QueryCourseModel
;
import
com.qkdata.biz.management.vo.QueryCourseModel
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -25,4 +27,8 @@ public interface CourseMapper extends BaseMapper<CoursePO> {
...
@@ -25,4 +27,8 @@ public interface CourseMapper extends BaseMapper<CoursePO> {
List
<
CourseListItemModel
>
queryPageList
(
Page
page
,
@Param
(
"p"
)
QueryCourseModel
param
);
List
<
CourseListItemModel
>
queryPageList
(
Page
page
,
@Param
(
"p"
)
QueryCourseModel
param
);
void
updateStatusById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
CourseStatusEnum
status
);
void
updateStatusById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
CourseStatusEnum
status
);
List
<
CourseAttachmentModel
>
selectAttachmentListByCourseId
(
Long
id
);
List
<
CourseAllowEnterpriseModel
>
selectOrgListByCourseId
(
Long
id
);
}
}
src/main/java/com/qkdata/biz/management/mapper/CourseTagRelMapper.java
View file @
6ccfd249
...
@@ -19,4 +19,6 @@ import java.util.List;
...
@@ -19,4 +19,6 @@ import java.util.List;
public
interface
CourseTagRelMapper
extends
BaseMapper
<
CourseTagRelPO
>
{
public
interface
CourseTagRelMapper
extends
BaseMapper
<
CourseTagRelPO
>
{
List
<
CourseTagsModel
>
selectModelList
(
Long
courseId
);
List
<
CourseTagsModel
>
selectModelList
(
Long
courseId
);
void
deleteByCourseId
(
Long
courseId
);
}
}
src/main/java/com/qkdata/biz/management/service/CourseService.java
View file @
6ccfd249
This diff is collapsed.
Click to expand it.
src/main/java/com/qkdata/biz/management/vo/SaveCourseChaperModel.java
0 → 100644
View file @
6ccfd249
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
lombok.Data
;
@Data
public
class
SaveCourseChaperModel
{
private
Long
chaperId
;
private
String
chaperName
;
private
Integer
sortNo
=
0
;
private
String
videoId
;
}
src/main/java/com/qkdata/biz/management/vo/SaveCourseModel.java
0 → 100644
View file @
6ccfd249
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.enums.CourseTypeEnum
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.List
;
@Data
public
class
SaveCourseModel
{
private
Long
id
;
/**
* 课程名称
*/
private
String
name
;
/**
* 课程类型(单集、系列)
*/
private
CourseTypeEnum
type
;
/**
* 课程简介
*/
private
String
introduce
;
/**
* 课程介绍
*/
private
String
detail
;
/**
* 课程封面url
*/
private
String
logoUrl
;
/**
* 讲师ID
*/
private
Long
teacherId
;
/**
* 讲师名称
*/
private
String
teacherName
;
/**
* 收费模式(免费、会员免费、付费点播)
*/
private
CourseChargeModelEnum
chargeModel
;
/**
* 付费点播普通用户价
*/
private
BigDecimal
price
;
/**
* 付费点播会员价
*/
private
BigDecimal
vipPrice
;
/**
* 有效时间(小时)
*/
private
Integer
validPeriod
;
/**
* 系列ID
*/
private
Long
seriesId
;
/**
* 系列名称
*/
private
String
seriesName
;
/**
* 可见范围(全部、指定企业)
*/
private
CourseAllowEnum
allow
;
/**
* 指定企业的列表
*/
private
List
<
Long
>
allowOrgIds
;
/**
* 标签列表
*/
private
List
<
Long
>
tagIds
;
/**
* 课程章节列表
*/
private
List
<
SaveCourseChaperModel
>
chaperList
;
/**
* 课程附件列表
*/
private
List
<
Long
>
attachmenIds
;
}
src/main/resources/mappers/management/allow_org_courseMapper.xml
View file @
6ccfd249
...
@@ -2,4 +2,7 @@
...
@@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.qkdata.biz.management.mapper.AllowOrgCourseMapper"
>
<mapper
namespace=
"com.qkdata.biz.management.mapper.AllowOrgCourseMapper"
>
<delete
id=
"deleteByCourseId"
>
delete from allow_org_course where course_id = #{courseId}
</delete>
</mapper>
</mapper>
src/main/resources/mappers/management/courseMapper.xml
View file @
6ccfd249
...
@@ -31,4 +31,22 @@
...
@@ -31,4 +31,22 @@
ORDER BY c.create_time DESC
ORDER BY c.create_time DESC
</select>
</select>
<select
id=
"selectAttachmentListByCourseId"
resultType=
"com.qkdata.biz.management.vo.CourseAttachmentModel"
>
SELECT a.course_id,
r.id resource_id,
r.`name` resource_name,
r.url resource_url
from course_attachment a
INNER JOIN resource r on a.resource_id = r.id
WHERE a.course_id = #{id}
</select>
<select
id=
"selectOrgListByCourseId"
resultType=
"com.qkdata.biz.management.vo.CourseAllowEnterpriseModel"
>
SELECT r.course_id,
o.`name` orgName,
o.id orgId
from allow_org_course r
INNER JOIN organization o on r.org_id = o.id
WHERE r.course_id = #{id}
</select>
</mapper>
</mapper>
src/main/resources/mappers/management/course_attachmentMapper.xml
View file @
6ccfd249
...
@@ -2,4 +2,7 @@
...
@@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.qkdata.biz.management.mapper.CourseAttachmentMapper"
>
<mapper
namespace=
"com.qkdata.biz.management.mapper.CourseAttachmentMapper"
>
<delete
id=
"deleteByCourseId"
>
delete from course_attachment where course_id = #{courseId}
</delete>
</mapper>
</mapper>
src/main/resources/mappers/management/course_tag_relMapper.xml
View file @
6ccfd249
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.qkdata.biz.management.mapper.CourseTagRelMapper"
>
<mapper
namespace=
"com.qkdata.biz.management.mapper.CourseTagRelMapper"
>
<delete
id=
"deleteByCourseId"
>
delete from course_tag_rel where course_id = #{courseId}
</delete>
<select
id=
"selectModelList"
resultType=
"com.qkdata.biz.management.vo.CourseTagsModel"
>
<select
id=
"selectModelList"
resultType=
"com.qkdata.biz.management.vo.CourseTagsModel"
>
SELECT r.course_id,r.tag_id,t.`name` tag_name
SELECT r.course_id,r.tag_id,t.`name` tag_name
...
...
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