master
youhang 5 months ago
parent 485e05d0ee
commit 8220281da5
  1. 51
      src/main/java/com/teaching/backend/controller/know/KnowController.java
  2. 48
      src/main/java/com/teaching/backend/model/dto/know/KnowAddRequest.java
  3. 11
      src/main/java/com/teaching/backend/model/entity/know/Know.java
  4. 14
      src/main/java/com/teaching/backend/service/favour/SeResourceFavourService.java
  5. 12
      src/main/java/com/teaching/backend/service/impl/know/IknowServiceimpl.java
  6. 23
      src/main/java/com/teaching/backend/service/impl/know/KnowServiceimpl.java
  7. 4
      src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java
  8. 10
      src/main/java/com/teaching/backend/service/know/IknowService.java
  9. 12
      src/main/java/com/teaching/backend/service/know/KnowService.java
  10. 9
      src/main/java/com/teaching/backend/utils/ParamOutAspect.java

@ -0,0 +1,51 @@
package com.teaching.backend.controller.know;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.model.dto.know.KnowAddRequest;
import com.teaching.backend.service.know.KnowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author:youhang
* @Date:2024-06-17-11:57
* @Description:
*/
@RestController
@RequestMapping("/konw")
public class KnowController {
@Autowired
private KnowService knowService;
/**
* 知识点添加
*
*/
@PostMapping("/add")
// 加上 HttpServletRequest request 在一个fitter里面进行鉴权操作
public BaseResponse<Boolean> doFavour(@RequestBody KnowAddRequest knowAddRequest) {
// todo 字段判空 合法
// todo 字段是否存在
Boolean result = knowService.add(knowAddRequest);
if(!result) {
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
}
return ResultUtils.success(result);
}
}

@ -0,0 +1,48 @@
package com.teaching.backend.model.dto.know;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 知识点请求
*/
@Data
public class KnowAddRequest implements Serializable {
/**
* 知识点名称
*/
private String name;
/**
* 简介
*/
private String info;
/**
* 知识点内容
*/
private String content;
/**
* 知识点图片
*/
private String img;
/**
* 知识点学时
*/
private BigDecimal hour;
/**
* 资源id 运用json
*/
private String resourceid;
}

@ -17,7 +17,6 @@ import java.time.LocalDateTime;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("know") @TableName("know")
public class Know implements Serializable { public class Know implements Serializable {
@ -26,8 +25,8 @@ public class Know implements Serializable {
/** /**
* id * id
*/ */
@TableId(value = "id", type = IdType.ASSIGN_UUID) @TableId(value = "id", type = IdType.AUTO)
private String id; private Long id;
/** /**
* 知识点名称 * 知识点名称
@ -54,10 +53,12 @@ public class Know implements Serializable {
*/ */
private BigDecimal hour; private BigDecimal hour;
/** /**
* 知识点类型 * 资源id 运用json
*/ */
private String type; private String resourceid;
} }

@ -1,8 +1,12 @@
package com.teaching.backend.service.favour; package com.teaching.backend.service.favour;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.common.BaseResponse; import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.favour.SeResourceFavour; import com.teaching.backend.model.entity.favour.SeResourceFavour;
import com.teaching.backend.model.vo.favour.CourseFavourDetailVO;
/** /**
* @Author:youhang * @Author:youhang
@ -20,4 +24,14 @@ public interface SeResourceFavourService extends IService<SeResourceFavour> {
*/ */
BaseResponse<Boolean> doResourceFavour(String courseId, String resourceId, String userId); BaseResponse<Boolean> doResourceFavour(String courseId, String resourceId, String userId);
/**
* 某个用户资源列表全部信息
*
* @param page
* @param queryWrapper
* @return
*/
public Page<CourseFavourDetailVO> listCourseFavourByPage(Page<Courses> page, Wrapper<Courses> queryWrapper);
} }

@ -1,12 +0,0 @@
package com.teaching.backend.service.impl.know;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.know.KnowMapper;
import com.teaching.backend.model.entity.know.Know;
import com.teaching.backend.service.know.IknowService;
import org.springframework.stereotype.Service;
@Service
public class IknowServiceimpl extends ServiceImpl<KnowMapper,Know> implements IknowService {
}

@ -0,0 +1,23 @@
package com.teaching.backend.service.impl.know;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.know.KnowMapper;
import com.teaching.backend.model.dto.favour.knowFavour.KnowFavourAddRequest;
import com.teaching.backend.model.dto.know.KnowAddRequest;
import com.teaching.backend.model.entity.know.Know;
import com.teaching.backend.service.know.KnowService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class KnowServiceimpl extends ServiceImpl<KnowMapper,Know> implements KnowService {
@Autowired
private KnowMapper knowMapper;
@Override
public Boolean add(KnowAddRequest knowAddRequest) {
Know know = new Know();
BeanUtils.copyProperties(knowAddRequest,know);
return (save(know));
}
}

@ -11,7 +11,7 @@ import com.teaching.backend.model.entity.records.LearningRecords;
import com.teaching.backend.model.vo.records.LearningRecordsVo; import com.teaching.backend.model.vo.records.LearningRecordsVo;
import com.teaching.backend.service.impl.chapter.ChapterServiceImpl; import com.teaching.backend.service.impl.chapter.ChapterServiceImpl;
import com.teaching.backend.service.impl.courses.CoursesServiceImpl; import com.teaching.backend.service.impl.courses.CoursesServiceImpl;
import com.teaching.backend.service.impl.know.IknowServiceimpl; import com.teaching.backend.service.impl.know.KnowServiceimpl;
import com.teaching.backend.service.records.LearningRecordsService; import com.teaching.backend.service.records.LearningRecordsService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,7 +34,7 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
// @Autowired // @Autowired
// private LearningResourceServiceImpl learningResourceService; // private LearningResourceServiceImpl learningResourceService;
@Autowired @Autowired
private IknowServiceimpl knowledgePointService; private KnowServiceimpl knowledgePointService;
@Autowired @Autowired
private ChapterServiceImpl chapterService; private ChapterServiceImpl chapterService;

@ -1,10 +0,0 @@
package com.teaching.backend.service.know;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.know.Know;
public interface IknowService extends IService<Know> {
}

@ -0,0 +1,12 @@
package com.teaching.backend.service.know;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.dto.favour.knowFavour.KnowFavourAddRequest;
import com.teaching.backend.model.dto.know.KnowAddRequest;
import com.teaching.backend.model.entity.know.Know;
public interface KnowService extends IService<Know> {
public Boolean add(KnowAddRequest knowAddRequest);
}

@ -0,0 +1,9 @@
package com.teaching.backend.utils;
/**
* @Author:youhang
* @Date:2024-06-17-23:15
* @Description:
*/
public class ParamOutAspect {
}
Loading…
Cancel
Save