master
you hang 5 months ago committed by youhang
parent f9028811d4
commit 5f9726bd84
  1. 11
      pom.xml
  2. 55
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  3. 2
      src/main/java/com/teaching/backend/service/impl/records/LearningRecordsServiceImpl.java
  4. 2
      src/main/resources/application.yml

@ -163,6 +163,17 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--这里写上main方法所在类的路径-->
<configuration>
<mainClass>com.teaching.TeachingBackendApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -172,15 +173,59 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
}
@Override
public int countHours(String id) {
return 0;
public List<CoursesVO> getPagePageSize(int page, int pageSize) {
int startIndex = (page-1) * pageSize;
List<Courses> list = coursesMapper.getItemsByPage(startIndex, pageSize);
// List<Courses> list = coursesMapper.selectList(null);
List<CoursesVO> coursesVo = BeanUtil.copyToList(list, CoursesVO.class);
coursesVo = coursesVo.stream().map((item) -> {
item.setTotalHours(countHours(item.getId()));
item.setTotalchapter(100);
item.setTotalKnow(100);
// if (StringUtils.isBlank(item.getName()) ||
// StringUtils.isBlank(item.getDescription()) ){
// throw new BusinessException(ErrorCode.OPERATION_ERROR,"数据格式有问题,请修改");
// }
return item;
}).collect(Collectors.toList());
return coursesVo;
}
@Override
public List<CoursesVO> getPagePageSize(int page, int pageSize) {
return null;
}
public int countHours(String id) {
Courses courses = coursesMapper.selectById(id);
Integer classhours = 0;
Integer theoryhours = 0;
Integer practicehours = 0;
Integer experimenthours = 0;
Integer otherhours = 0;
if (courses.getClasshours() != null) {
classhours = courses.getClasshours();
}
if (courses.getTheoryhours() != null) {
theoryhours = courses.getTheoryhours();
}
if (courses.getPracticehours() != null) {
practicehours = courses.getPracticehours();
}
if (courses.getExperimenthours() != null) {
experimenthours = courses.getExperimenthours();
}
if (courses.getOtherhours() != null) {
otherhours = courses.getOtherhours();
}
int total = classhours + theoryhours + practicehours + experimenthours + otherhours;
return total;
}
/**
* 修改课程信息
* @param coursesDTO

@ -103,8 +103,8 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe
break;
case "1": //如果是课程学习记录
System.out.println();
learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName());
System.out.println(coursesService.getById(learningRecords.getCoursesId()).getName());
break;
}
//添加观看人数

@ -8,7 +8,7 @@ spring:
matching-strategy: ant_path_matcher
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.106.16.162:3306/teaching_db
url: jdbc:mysql://127.0.0.1:3306/teaching_db
username: root
password: root
mybatis:

Loading…
Cancel
Save