删除历史知识点

master
youahng 4 months ago committed by yh
parent ab59e0069f
commit d4054e37c9
  1. 11
      pom.xml
  2. 40
      src/main/java/com/teaching/backend/controller/know/KnowController.java
  3. 42
      src/main/java/com/teaching/backend/controller/know/KnowRelationshipController.java
  4. 10
      src/main/java/com/teaching/backend/mapper/know/KnowMapper.java
  5. 18
      src/main/java/com/teaching/backend/mapper/know/KnowRelationshipMapper.java
  6. 19
      src/main/java/com/teaching/backend/model/dto/know/KnowQueryRequest.java
  7. 48
      src/main/java/com/teaching/backend/model/dto/know/KnowRequest.java
  8. 54
      src/main/java/com/teaching/backend/model/dto/know/KnowupdateRequest.java
  9. 168
      src/main/java/com/teaching/backend/model/entity/courses/Main.java
  10. 66
      src/main/java/com/teaching/backend/model/entity/know/Know.java
  11. 46
      src/main/java/com/teaching/backend/model/entity/know/KnowRelationship.java
  12. 20
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  13. 32
      src/main/java/com/teaching/backend/service/impl/courses/ObjectiveContentKnowServiceImpl.java
  14. 21
      src/main/java/com/teaching/backend/service/impl/know/KnowRelationshipServiceImpl.java
  15. 50
      src/main/java/com/teaching/backend/service/impl/know/KnowServiceimpl.java
  16. 7
      src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java
  17. 16
      src/main/java/com/teaching/backend/service/know/IKnowRelationshipService.java
  18. 23
      src/main/java/com/teaching/backend/service/know/KnowService.java
  19. 34
      src/main/java/com/teaching/backend/utils/ParamOutAspect.java
  20. 38
      src/main/java/com/teaching/backend/utils/getNullPropertyNamesUtil.java
  21. 5
      src/main/resources/application.yml

@ -24,6 +24,17 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!--neo4j 的引入-->
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-spring-boot-starter</artifactId>
<version>4.3.6.0</version>
</dependency>
<!-- neo4j 操作实体注解需要 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter-aop</artifactId>

@ -1,40 +0,0 @@
package com.teaching.backend.controller.know;
import com.teaching.backend.model.dto.know.KnowQueryRequest;
import com.teaching.backend.model.dto.know.KnowRequest;
import com.teaching.backend.model.dto.know.KnowupdateRequest;
import com.teaching.backend.model.entity.know.Know;
import com.teaching.backend.service.know.KnowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author:youhang
* @Date:2024-06-21-10:26
* @Description:
*/
@RestController
@RequestMapping("/api/know")
public class KnowController {
@Autowired
private KnowService knowService;
@PostMapping("/add")
public Boolean add(@RequestBody KnowRequest knowAddRequest) {
return knowService.add(knowAddRequest);
}
@PostMapping("/update")
public Boolean update(@RequestBody KnowupdateRequest knowAddRequest){
return knowService.update(knowAddRequest);
}
@PostMapping("/delete")
public Integer deleteKnow(@RequestBody List<Integer> ids){
return knowService.deleteKnow(ids);
}
@PostMapping("/query")
public List<Know> query(@RequestBody KnowQueryRequest knowQueryRequest){
return knowService.query(knowQueryRequest);
}
}

@ -1,42 +0,0 @@
package com.teaching.backend.controller.know;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.model.entity.know.Know;
import com.teaching.backend.model.entity.know.KnowRelationship;
import com.teaching.backend.service.know.IKnowRelationshipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author author
* @since 2024-06-20
*/
@Api(tags = "知识点章节关系")
@RestController
@RequestMapping("/know-relationship")
public class KnowRelationshipController {
@Autowired
private IKnowRelationshipService knowRelationshipService;
@ApiOperation("添加课程知识点关系")
@PostMapping()
public BaseResponse<Boolean> add(@RequestBody KnowRelationship knowRelationship){
boolean save = knowRelationshipService.save(knowRelationship);
return ResultUtils.success(save);
}
@GetMapping()
public BaseResponse<List<KnowRelationship>> getAll(){
List<KnowRelationship> list = knowRelationshipService.list();
return ResultUtils.success(list);
}
}

@ -1,10 +0,0 @@
package com.teaching.backend.mapper.know;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.know.Know;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface KnowMapper extends BaseMapper<Know> {
}

@ -1,18 +0,0 @@
package com.teaching.backend.mapper.know;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.know.KnowRelationship;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-06-20
*/
@Mapper
public interface KnowRelationshipMapper extends BaseMapper<KnowRelationship> {
}

@ -1,19 +0,0 @@
package com.teaching.backend.model.dto.know;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 知识点请求
*/
@Data
public class KnowQueryRequest implements Serializable {
/**
* 知识点名称
*/
private String name;
}

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

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

@ -0,0 +1,168 @@
package com.teaching.backend.model.entity.courses;
/**
* @Author:youhang
* @Date:2024-07-07-21:21
* @Description:
*/
import java.util.Scanner;
class Num {
public int Zero = 0;
public int One = 0;
public int getZero() {
return Zero;
}
public void setZero(int zero) {
Zero = zero;
}
public int getOne() {
return One;
}
public void setOne(int one) {
One = one;
}
}
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String[] arr = new String[n];
int counts = 0;
Num num = new Num();
for (int i = 0; i < n; i++) {
arr[i] = in.next();
}
int p = 1, q = 1;
while (p < n) {
if (arr[0].charAt(0) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
for (int i = 0; i <= p; i++) {
if (arr[i].charAt(p) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
if (arr[p].charAt(i) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
}
if (arr[p].charAt(p) == '1') {
num.One -= 1;
} else {
num.Zero -= 1;
}
if(num.Zero == num.One){
counts++;
}
num.One = 0;
num.Zero = 0;
if (arr[0].charAt(n-1) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
for (int i = 0; i <= p; i++) {
if (arr[i].charAt(n-1-p) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
if (arr[p].charAt(n-i-1) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
}
if (arr[p].charAt(n-p-1) == '1') {
num.One -= 1;
} else {
num.Zero -= 1;
}
if(num.Zero == num.One){
counts++;
}
//左下
num.One = 0;
num.Zero = 0;
if (arr[n-1].charAt(0) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
for (int i = 0; i <= p; i++) {
if (arr[n-1-i].charAt(p) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
if (arr[n-p-1].charAt(i) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
}
if (arr[n-p-1].charAt(p) == '1') {
num.One -= 1;
} else {
num.Zero -= 1;
}
if(num.Zero == num.One){
counts++;
}
//右下
num.One = 0;
num.Zero = 0;
if (arr[n-1].charAt(n-1) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
for (int i = 0; i <= p; i++) {
if (arr[n-1-i].charAt(n-p-1) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
if (arr[n-p-1].charAt(n-1-i) == '1') {
num.One += 1;
} else {
num.Zero += 1;
}
}
if (arr[n-p-1].charAt(n-1-p) == '1') {
num.One -= 1;
} else {
num.Zero -= 1;
}
if(num.Zero == num.One){
counts++;
}
p++;
}
}
}

@ -1,66 +0,0 @@
package com.teaching.backend.model.entity.know;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("know")
public class Know implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 知识点名称
*/
private String name;
/**
* 简介
*/
private String info;
/**
* 知识点内容
*/
private String content;
/**
* 知识点图片
*/
private String img;
/**
* 知识点学时
*/
private BigDecimal hour;
/**
* 资源id 运用json
*/
private String resourceid;
}

@ -1,46 +0,0 @@
package com.teaching.backend.model.entity.know;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author author
* @since 2024-06-20
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("know_relationship")
@ApiModel(value="KnowRelationship对象", description="")
public class KnowRelationship implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "章节id")
@TableField("chapterId")
private String chapterId;
@ApiModelProperty(value = "课程id")
@TableField("courseId")
private String courseId;
@ApiModelProperty(value = "知识点id")
@TableField("knowId")
private int knowId;
}

@ -12,7 +12,6 @@ import com.teaching.backend.common.ErrorCode;
import com.teaching.backend.exception.BusinessException; import com.teaching.backend.exception.BusinessException;
import com.teaching.backend.mapper.chapter.ChapterMapper; import com.teaching.backend.mapper.chapter.ChapterMapper;
import com.teaching.backend.mapper.courses.*; import com.teaching.backend.mapper.courses.*;
import com.teaching.backend.mapper.know.KnowRelationshipMapper;
import com.teaching.backend.mapper.records.LearningRecordsMapper; import com.teaching.backend.mapper.records.LearningRecordsMapper;
import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper; import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper;
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; import com.teaching.backend.mapper.umsAdmin.UmsUserMapper;
@ -20,7 +19,6 @@ import com.teaching.backend.model.dto.courses.CoursesDTO;
import com.teaching.backend.model.dto.courses.PageDTO; import com.teaching.backend.model.dto.courses.PageDTO;
import com.teaching.backend.model.entity.chapter.Chapter; import com.teaching.backend.model.entity.chapter.Chapter;
import com.teaching.backend.model.entity.courses.*; import com.teaching.backend.model.entity.courses.*;
import com.teaching.backend.model.entity.know.KnowRelationship;
import com.teaching.backend.model.entity.records.LearningRecords; import com.teaching.backend.model.entity.records.LearningRecords;
import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; import com.teaching.backend.model.entity.umsAdmin.UmsTeacher;
import com.teaching.backend.model.entity.umsAdmin.UmsUser; import com.teaching.backend.model.entity.umsAdmin.UmsUser;
@ -43,7 +41,6 @@ import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* <p> * <p>
@ -65,8 +62,6 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
@Autowired @Autowired
CoursesMapper coursesMapper; CoursesMapper coursesMapper;
@Autowired
KnowRelationshipMapper knowRelationshipMapper;
@Autowired @Autowired
CourseObjectivesMapper courseObjectivesMapper; CourseObjectivesMapper courseObjectivesMapper;
@ -307,7 +302,7 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
coursesVO.setTotalHours(countHours(courseid)); coursesVO.setTotalHours(countHours(courseid));
coursesVO.setTotalAssignHours(countChaptersHours(courseid)); coursesVO.setTotalAssignHours(countChaptersHours(courseid));
coursesVO.setTotalNotAssignHours(coursesVO.getTotalHours()-coursesVO.getTotalAssignHours()); coursesVO.setTotalNotAssignHours(coursesVO.getTotalHours()-coursesVO.getTotalAssignHours());
coursesVO.setTotalKnow(countKnow(courseid)); // coursesVO.setTotalKnow(countKnow(courseid));
System.out.println(coursesVO); System.out.println(coursesVO);
return coursesVO; return coursesVO;
} }
@ -322,20 +317,17 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
item.setTotalHours(countHours(item.getId())); item.setTotalHours(countHours(item.getId()));
item.setTotalchapter(countChapters(item.getId())); item.setTotalchapter(countChapters(item.getId()));
item.setTotalKnow(countKnow(item.getId())); // item.setTotalKnow(countKnow(item.getId()));
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return coursesVo; return coursesVo;
} }
// 计算课程知识点个数 // 计算课程知识点个数
public int countKnow(String courseid){ // public Integer countKnow(String courseid){
LambdaQueryWrapper<KnowRelationship> wrapper = new LambdaQueryWrapper<>(); // // 已修改 yh
wrapper.eq(KnowRelationship::getCourseId,courseid); // return knowRepository.findCountsByCourseId(courseid);
List<KnowRelationship> list = knowRelationshipMapper.selectList(wrapper); // }
int total=list.size();
return total;
}
// 计算课程已分配的学时 计算章的学时(即已包含了小节的学时) // 计算课程已分配的学时 计算章的学时(即已包含了小节的学时)
public int countChaptersHours(String courseid){ public int countChaptersHours(String courseid){
LambdaQueryWrapper<Chapter> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Chapter> wrapper = new LambdaQueryWrapper<>();

@ -9,12 +9,10 @@ import com.teaching.backend.mapper.courses.CourseObjectivesMapper;
import com.teaching.backend.mapper.courses.CoursesMapper; import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.mapper.courses.ObjectiveContentKnowMapper; import com.teaching.backend.mapper.courses.ObjectiveContentKnowMapper;
import com.teaching.backend.mapper.courses.ObjectiveContentsMapper; import com.teaching.backend.mapper.courses.ObjectiveContentsMapper;
import com.teaching.backend.mapper.know.KnowMapper;
import com.teaching.backend.model.dto.courses.ObjectiveContentKnowDTO; import com.teaching.backend.model.dto.courses.ObjectiveContentKnowDTO;
import com.teaching.backend.model.entity.courses.CourseObjectives; import com.teaching.backend.model.entity.courses.CourseObjectives;
import com.teaching.backend.model.entity.courses.ObjectiveContentKnow; import com.teaching.backend.model.entity.courses.ObjectiveContentKnow;
import com.teaching.backend.model.entity.courses.ObjectiveContents; import com.teaching.backend.model.entity.courses.ObjectiveContents;
import com.teaching.backend.model.entity.know.Know;
import com.teaching.backend.model.vo.courses.ObjectiveContentKnowVO; import com.teaching.backend.model.vo.courses.ObjectiveContentKnowVO;
import com.teaching.backend.service.courses.IObjectiveContentKnowService; import com.teaching.backend.service.courses.IObjectiveContentKnowService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,11 +21,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -43,8 +39,8 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
@Autowired @Autowired
ObjectiveContentKnowMapper objectiveContentKnowMapper; ObjectiveContentKnowMapper objectiveContentKnowMapper;
@Autowired // @Autowired
KnowMapper knowMapper; // KnowMapper knowMapper;
@Autowired @Autowired
CourseObjectivesMapper courseObjectivesMapper; CourseObjectivesMapper courseObjectivesMapper;
@Autowired @Autowired
@ -147,18 +143,18 @@ public class ObjectiveContentKnowServiceImpl extends ServiceImpl<ObjectiveConten
vo.setKnowsNumber(objectiveContentKnows.size()); vo.setKnowsNumber(objectiveContentKnows.size());
// 计算知识点的总时间 // 计算知识点的总时间
BigDecimal knowsTime = objectiveContentKnows.stream() // BigDecimal knowsTime = objectiveContentKnows.stream()
.map(contentKnow -> { // .map(contentKnow -> {
Know know = knowMapper.selectOne(new LambdaQueryWrapper<Know>() // Know know = knowMapper.selectOne(new LambdaQueryWrapper<Know>()
.eq(Know::getId, contentKnow.getKnow())); // .eq(Know::getId, contentKnow.getKnow()));
if (know == null) { // if (know == null) {
throw new BusinessException(ErrorCode.KNOW_NOT_EXIT); // throw new BusinessException(ErrorCode.KNOW_NOT_EXIT);
} // }
return know.getHour(); // return know.getHour();
}) // })
.reduce(BigDecimal.ZERO, BigDecimal::add); // .reduce(BigDecimal.ZERO, BigDecimal::add);
vo.setKnowsTime(knowsTime); // vo.setKnowsTime(knowsTime);
return vo; return vo;
} }

@ -1,21 +0,0 @@
package com.teaching.backend.service.impl.know;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.know.KnowRelationshipMapper;
import com.teaching.backend.model.entity.know.KnowRelationship;
import com.teaching.backend.service.know.IKnowRelationshipService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author author
* @since 2024-06-20
*/
@Service
public class KnowRelationshipServiceImpl extends ServiceImpl<KnowRelationshipMapper, KnowRelationship> implements IKnowRelationshipService {
}

@ -1,50 +0,0 @@
package com.teaching.backend.service.impl.know;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.know.KnowMapper;
import com.teaching.backend.model.dto.know.KnowQueryRequest;
import com.teaching.backend.model.dto.know.KnowRequest;
import com.teaching.backend.model.dto.know.KnowupdateRequest;
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;
import java.util.List;
@Service
public class KnowServiceimpl extends ServiceImpl<KnowMapper,Know> implements KnowService {
@Autowired
private KnowMapper knowMapper;
@Override
public Boolean add(KnowRequest knowAddRequest) {
Know know = new Know();
BeanUtils.copyProperties(knowAddRequest,know);
return save(know);
}
@Override
public Boolean update(KnowupdateRequest knowAddRequest) {
Know know = new Know();
BeanUtils.copyProperties(knowAddRequest,know);
return (updateById(know));
}
@Override
public Integer deleteKnow(List<Integer> ids) {
Integer result = knowMapper.deleteBatchIds(ids);
return result;
}
@Override
public List<Know> query(KnowQueryRequest knowQueryRequest) {
String name = knowQueryRequest.getName();
QueryWrapper<Know> knowQueryWrapper = new QueryWrapper<>();
knowQueryWrapper.eq("name",name);
List<Know> knows = knowMapper.selectList(knowQueryWrapper);
return knows;
}
}

@ -14,7 +14,6 @@ import com.teaching.backend.model.vo.records.LearningRecordsVo;
import com.teaching.backend.service.impl.CourseResourcesServiceImpl; import com.teaching.backend.service.impl.CourseResourcesServiceImpl;
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.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;
@ -36,8 +35,8 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
private LearningRecordsMapper learningRecordsMapper; private LearningRecordsMapper learningRecordsMapper;
@Autowired @Autowired
private CourseResourcesServiceImpl courseResourcesService; private CourseResourcesServiceImpl courseResourcesService;
@Autowired // @Autowired
private KnowServiceimpl knowledgePointService; // private KnowServiceimpl knowledgePointService;
@Autowired @Autowired
private ChapterServiceImpl chapterService; private ChapterServiceImpl chapterService;
@ -109,7 +108,7 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
// }else { // }else {
// name = "查无次记录"; // name = "查无次记录";
// } // }
learningRecordsVo.setCoursesName(knowledgePointService.getById(learningRecords.getCoursesId()).getName()); // learningRecordsVo.setCoursesName(knowledgePointService.getById(learningRecords.getCoursesId()).getName());
//如果对应的资源不存在 //如果对应的资源不存在
break; break;
case "2": //如果是章节学习记录 case "2": //如果是章节学习记录

@ -1,16 +0,0 @@
package com.teaching.backend.service.know;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.know.KnowRelationship;
/**
* <p>
* 服务类
* </p>
*
* @author author
* @since 2024-06-20
*/
public interface IKnowRelationshipService extends IService<KnowRelationship> {
}

@ -1,23 +0,0 @@
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.KnowQueryRequest;
import com.teaching.backend.model.dto.know.KnowRequest;
import com.teaching.backend.model.dto.know.KnowupdateRequest;
import com.teaching.backend.model.entity.know.Know;
import java.util.List;
public interface KnowService extends IService<Know> {
public Boolean add(KnowRequest knowAddRequest);
public Boolean update(KnowupdateRequest knowAddRequest);
public Integer deleteKnow(List<Integer> ids);
public List<Know> query(KnowQueryRequest knowQueryRequest);
}

@ -21,6 +21,7 @@
// //
//import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse; //import javax.servlet.http.HttpServletResponse;
//import java.lang.reflect.Field;
//import java.lang.reflect.Method; //import java.lang.reflect.Method;
//import java.util.Arrays; //import java.util.Arrays;
//import java.util.List; //import java.util.List;
@ -36,7 +37,7 @@
// private final String executeExpr = "execution(public * com.teaching.backend.controller..*.*(..))"; // private final String executeExpr = "execution(public * com.teaching.backend.controller..*.*(..))";
// //
// @Before(executeExpr) // @Before(executeExpr)
// public void processLog(JoinPoint joinPoint) { // public void processLog(JoinPoint joinPoint) throws IllegalAccessException {
// Method method = ((MethodSignature) joinPoint.getSignature()).getMethod(); // Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
// //获取方法名称 // //获取方法名称
// String methodName = method.getName(); // String methodName = method.getName();
@ -53,22 +54,25 @@
// final Object[] array = filteredArgs.stream().toArray(); // final Object[] array = filteredArgs.stream().toArray();
// //
// for (int i = 0; i < array.length; i++) { // for (int i = 0; i < array.length; i++) {
// String jsonStr = JSONUtil.toJsonStr(array[i]); // Class<?> clazz = array[i].getClass();
//// Class<?> myClass = array[i].getClass(); // 获取类的 Class 对象 // // 获取所有字段(包括私有字段)
// JSONObject entries = JSONUtil.parseObj(jsonStr); // Field[] fields = clazz.getDeclaredFields();
// System.out.println(entries); // for (Field field : fields) {
// // 遍历JSONObject的属性 // // 设置字段为可访问(如果需要访问私有字段)
// entries.forEach((key, value) -> { // field.setAccessible(true);
// if(value == null || "".equals(value)){ //
// //可以设置为空的字段 // // 获取字段的值
// if(key.equals( "sortField")||key.equals( "sortOrder")){ // Object value = field.get(array[i]);
// }else{ //
// throw new BusinessException(ErrorCode.PARAMS_NULL); // // 检查值是否为空
// if (value == null) {
// // 这里可以抛出异常或记录日志,具体取决于你的需求
// String fieldName = field.getName();
// throw new IllegalArgumentException(fieldName + " @@@@@is null");
// } // }
//
// } // }
//// System.out.println(key + ": " + value); //
// }); //
// } // }
// } // }
// } // }

@ -0,0 +1,38 @@
package com.teaching.backend.utils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
/**
* @Author:youhang
* @Date:2024-06-23-12:45
* @Description:
*/
public class getNullPropertyNamesUtil {
public static String[] getNullPropertyNames (Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<String>();
for(java.beans.PropertyDescriptor pd : pds) {
Class<?> propertyType = src.getPropertyType(pd.getName());
Object srcValue = src.getPropertyValue(pd.getName());
// if ("Integer".equals(propertyType.getName()) || "Long".equals(propertyType.getName())){
// Integer value = (Integer) srcValue;
// if (value == 0) emptyNames.add(pd.getName());
// }
if ("BigDecimal".equals(propertyType.getName())){
BigDecimal value =(BigDecimal)srcValue;
if (value == null || (BigDecimal.ZERO).equals(0)) emptyNames.add(pd.getName());
}
if (srcValue == null || srcValue == "") emptyNames.add(pd.getName());
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
}

@ -7,6 +7,11 @@ spring:
multipart: multipart:
max-file-size: 10MB max-file-size: 10MB
max-request-size: 10MB max-request-size: 10MB
neo4j:
uri: bolt://39.106.16.162:7687
authentication:
username: neo4j # 连接Neo4j数据P库的用户名
password: 123456 # 连接Neo4j数据库的密码
mvc: mvc:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher

Loading…
Cancel
Save