diff --git a/src/main/java/com/teaching/backend/controller/courseResource/CourseResourceController.java b/src/main/java/com/teaching/backend/controller/courseResource/CourseResourceController.java index 6abf652..6da377e 100644 --- a/src/main/java/com/teaching/backend/controller/courseResource/CourseResourceController.java +++ b/src/main/java/com/teaching/backend/controller/courseResource/CourseResourceController.java @@ -72,13 +72,26 @@ public class CourseResourceController { /** * 编辑 - * @param resourceId + * @param resources * @return */ @ApiOperation("编辑课程资源") - @PostMapping("/edit") - public BaseResponse editCourseResource(@RequestParam String resourceId){ + @PutMapping("/edit") + public BaseResponse editCourseResource(@RequestBody CourseResources resources){ + System.out.println(resources); + courseResourcesService.updateById(resources); + return ResultUtils.success("编辑成功"); + } + + /** + * 根据id查询课程资源 + * @param resourceId + * @return + */ + @ApiOperation("根据id查询课程资源") + @PostMapping("/getone") + public BaseResponse getOne(@RequestParam String resourceId){ System.out.println(resourceId); - return ResultUtils.success(courseResourcesService.editCourseResource(resourceId)); + return ResultUtils.success(courseResourcesService.getById(resourceId)); } } diff --git a/src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java b/src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java index 4f769e5..47de994 100644 --- a/src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java +++ b/src/main/java/com/teaching/backend/controller/records/LearningRecordsController.java @@ -47,20 +47,15 @@ public class LearningRecordsController { long total = cs.size(); // 总记录数 Page pageInfo = new Page<>(pagenum,pagesize,total); pageInfo.setRecords(pageCs); -// System.out.println("总记录数"+pageInfo.getTotal()); -// System.out.println("当前页面:"+pagenum); -// System.out.println("当前页面大小:"+pagesize); -// System.out.println("当前页面内容:"+pageCs); -// System.out.println("页面数:"+pageInfo.getPages()); pageInfo.setPages((int)(Math.ceil((double) total / pagesize)));//设置总页数 -// System.out.println(pageInfo.getPages()); return ResultUtils.success(pageInfo); } @ApiOperation("查询所有") @GetMapping("/all") public BaseResponse> All(){ - System.out.println("学习记录:"+learningRecordsService.list()); +// System.out.println("学习记录:"+learningRecordsService.list()); + return ResultUtils.success(learningRecordsService.list()); } @@ -74,7 +69,7 @@ public class LearningRecordsController { @ValidateParams({"userId","type","coursesId"}) @PostMapping("/saverecords") public BaseResponse saveRecords(@RequestBody LearningRecords learningRecords){ - System.out.println(learningRecords); +// System.out.println(learningRecords); return ResultUtils.success(learningRecordsService.saveRecords(learningRecords)); } diff --git a/src/main/java/com/teaching/backend/mapper/records/CourseLearningRecordMapper.java b/src/main/java/com/teaching/backend/mapper/records/CourseLearningRecordMapper.java new file mode 100644 index 0000000..20b8386 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/records/CourseLearningRecordMapper.java @@ -0,0 +1,17 @@ +package com.teaching.backend.mapper.records; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.records.CourseLearningRecord; + +/** + *

+ * Mapper 接口 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface CourseLearningRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/teaching/backend/mapper/records/KnowledgeLearningRecordMapper.java b/src/main/java/com/teaching/backend/mapper/records/KnowledgeLearningRecordMapper.java new file mode 100644 index 0000000..d9dbbe5 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/records/KnowledgeLearningRecordMapper.java @@ -0,0 +1,17 @@ +package com.teaching.backend.mapper.records; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; + +/** + *

+ * Mapper 接口 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface KnowledgeLearningRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/teaching/backend/mapper/records/ResourceLearningRecordMapper.java b/src/main/java/com/teaching/backend/mapper/records/ResourceLearningRecordMapper.java new file mode 100644 index 0000000..c1235c1 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/records/ResourceLearningRecordMapper.java @@ -0,0 +1,17 @@ +package com.teaching.backend.mapper.records; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.records.ResourceLearningRecord; + +/** + *

+ * Mapper 接口 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface ResourceLearningRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/teaching/backend/model/entity/CourseResources.java b/src/main/java/com/teaching/backend/model/entity/CourseResources.java index e1819c4..637c2a6 100644 --- a/src/main/java/com/teaching/backend/model/entity/CourseResources.java +++ b/src/main/java/com/teaching/backend/model/entity/CourseResources.java @@ -25,8 +25,13 @@ import java.util.stream.Stream; @AllArgsConstructor @TableName("Resource") public class CourseResources { - @TableId(value = "id", type = IdType.AUTO) - private int id; + private static final long serialVersionUID = 1L; + + /** + * 内部编号 + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private String id; private String name; private int type; private int status; diff --git a/src/main/java/com/teaching/backend/model/entity/records/CourseLearningRecord.java b/src/main/java/com/teaching/backend/model/entity/records/CourseLearningRecord.java new file mode 100644 index 0000000..acd207b --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/records/CourseLearningRecord.java @@ -0,0 +1,57 @@ +package com.teaching.backend.model.entity.records; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author author + * @since 2024-07-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("course_learning_record") +@ApiModel(value="CourseLearningRecord对象", description="") +public class CourseLearningRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = " 课程记录id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + @ApiModelProperty(value = "课程id") + @TableField("course_id") + private String courseId; + + @ApiModelProperty(value = "用户id") + @TableField("user_id") + private String userId; + + @ApiModelProperty(value = "观看人数") + @TableField("number") + private Integer number; + + @ApiModelProperty(value = "记录封面") + @TableField("img") + private String img; + + @ApiModelProperty(value = "最近学习时间") + @TableField("time") + private LocalDateTime time; + + +} diff --git a/src/main/java/com/teaching/backend/model/entity/records/KnowledgeLearningRecord.java b/src/main/java/com/teaching/backend/model/entity/records/KnowledgeLearningRecord.java new file mode 100644 index 0000000..f7c1ed5 --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/records/KnowledgeLearningRecord.java @@ -0,0 +1,57 @@ +package com.teaching.backend.model.entity.records; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author author + * @since 2024-07-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("knowledge_learning_record") +@ApiModel(value="KnowledgeLearningRecord对象", description="") +public class KnowledgeLearningRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "知识点学习记录id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + @ApiModelProperty(value = "知识点id") + @TableField("knowledge_id") + private String knowledgeId; + + @ApiModelProperty(value = "用户id") + @TableField("user_id") + private String userId; + + @ApiModelProperty(value = "观看人数") + @TableField("number") + private Integer number; + + @ApiModelProperty(value = "记录封面") + @TableField("img") + private String img; + + @ApiModelProperty(value = "最近访问时间") + @TableField("time") + private LocalDateTime time; + + +} diff --git a/src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java b/src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java index 067e2e8..44f7d8c 100644 --- a/src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java +++ b/src/main/java/com/teaching/backend/model/entity/records/LearningRecords.java @@ -33,18 +33,6 @@ public class LearningRecords { * 课程id */ private String coursesId; - /** - * 章节id - */ - private String chapterId; - /** - * 知识点id - */ - private String knowledgePointId; - /** - * 资源id - */ - private String resourceId; /** * 访问时间 */ diff --git a/src/main/java/com/teaching/backend/model/entity/records/ResourceLearningRecord.java b/src/main/java/com/teaching/backend/model/entity/records/ResourceLearningRecord.java new file mode 100644 index 0000000..95de9f2 --- /dev/null +++ b/src/main/java/com/teaching/backend/model/entity/records/ResourceLearningRecord.java @@ -0,0 +1,73 @@ +package com.teaching.backend.model.entity.records; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author author + * @since 2024-07-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("resource_learning_record") +@ApiModel(value="ResourceLearningRecord对象", description="") +public class ResourceLearningRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "资源学习记录id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + @ApiModelProperty(value = "资源id") + @TableField("resource_id") + private String resourceId; + + @ApiModelProperty(value = "用户id") + @TableField("user_id") + private String userId; + + @ApiModelProperty(value = "观看人数") + @TableField("number") + private Integer number; + + @ApiModelProperty(value = "是否打开, 1:开打了; 2:未打开;") + @TableField("open") + private Integer open; + + @ApiModelProperty(value = "是否下载, 1:下载了; 2:未下载;") + @TableField(" download") + private Integer download; + + @ApiModelProperty(value = "学习时长") + @TableField("duration") + private Integer duration; + + @ApiModelProperty(value = "是否完成观看") + @TableField("finish") + private Integer finish; + + @ApiModelProperty(value = "记录封面") + @TableField("img") + private String img; + + @ApiModelProperty(value = "最近学习时间") + @TableField("time") + private LocalDateTime time; + + +} diff --git a/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java index 5340db3..628614d 100644 --- a/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/CourseResourcesServiceImpl.java @@ -57,7 +57,7 @@ public class CourseResourcesServiceImpl extends ServiceImpl + * 服务实现类 + *

+ * + * @author author + * @since 2024-07-24 + */ +@Service +public class CourseLearningRecordServiceImpl extends ServiceImpl implements ICourseLearningRecordService { + +} diff --git a/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java new file mode 100644 index 0000000..f4d8a5f --- /dev/null +++ b/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java @@ -0,0 +1,22 @@ +package com.teaching.backend.service.impl.records; + + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.teaching.backend.mapper.records.KnowledgeLearningRecordMapper; +import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; +import com.teaching.backend.service.records.IKnowledgeLearningRecordService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author author + * @since 2024-07-24 + */ +@Service +public class KnowledgeLearningRecordServiceImpl extends ServiceImpl implements IKnowledgeLearningRecordService { + +} diff --git a/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java index 562a697..598b156 100644 --- a/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java @@ -18,6 +18,7 @@ import com.teaching.backend.service.records.LearningRecordsService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; import java.time.LocalDateTime; @@ -35,8 +36,6 @@ public class LearningRecordsServiceImpl extends ServiceImpl + * 服务实现类 + *

+ * + * @author author + * @since 2024-07-24 + */ +@Service +public class ResourceLearningRecordServiceImpl extends ServiceImpl implements IResourceLearningRecordService { + +} diff --git a/src/main/java/com/teaching/backend/service/records/ICourseLearningRecordService.java b/src/main/java/com/teaching/backend/service/records/ICourseLearningRecordService.java new file mode 100644 index 0000000..6cdaadf --- /dev/null +++ b/src/main/java/com/teaching/backend/service/records/ICourseLearningRecordService.java @@ -0,0 +1,17 @@ +package com.teaching.backend.service.records; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.teaching.backend.model.entity.records.CourseLearningRecord; + +/** + *

+ * 服务类 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface ICourseLearningRecordService extends IService { + +} diff --git a/src/main/java/com/teaching/backend/service/records/IKnowledgeLearningRecordService.java b/src/main/java/com/teaching/backend/service/records/IKnowledgeLearningRecordService.java new file mode 100644 index 0000000..c8387d1 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/records/IKnowledgeLearningRecordService.java @@ -0,0 +1,17 @@ +package com.teaching.backend.service.records; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; + +/** + *

+ * 服务类 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface IKnowledgeLearningRecordService extends IService { + +} diff --git a/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java b/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java new file mode 100644 index 0000000..8b191b6 --- /dev/null +++ b/src/main/java/com/teaching/backend/service/records/IResourceLearningRecordService.java @@ -0,0 +1,17 @@ +package com.teaching.backend.service.records; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.teaching.backend.model.entity.records.ResourceLearningRecord; + +/** + *

+ * 服务类 + *

+ * + * @author author + * @since 2024-07-24 + */ +public interface IResourceLearningRecordService extends IService { + +} diff --git a/src/main/java/com/teaching/backend/service/resource/CourseResourcesService.java b/src/main/java/com/teaching/backend/service/resource/CourseResourcesService.java index 41d042d..0ed7cb2 100644 --- a/src/main/java/com/teaching/backend/service/resource/CourseResourcesService.java +++ b/src/main/java/com/teaching/backend/service/resource/CourseResourcesService.java @@ -31,5 +31,5 @@ public interface CourseResourcesService extends IService { public void saveCourseResource(CourseResources courseResources); - public CourseResources editCourseResource(String resourceId); + public void editCourseResource(String resourceId); }