|
|
@ -1,7 +1,10 @@
|
|
|
|
package com.zhiyun.zhiyun03.course.service.impl;
|
|
|
|
package com.zhiyun.zhiyun03.course.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.util.BeanUtil;
|
|
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
import com.zhiyun.zhiyun03.application.entity.Directory;
|
|
|
|
import com.zhiyun.zhiyun03.application.entity.Directory;
|
|
|
|
import com.zhiyun.zhiyun03.application.mapper.DirectoryMapper;
|
|
|
|
import com.zhiyun.zhiyun03.application.mapper.DirectoryMapper;
|
|
|
|
import com.zhiyun.zhiyun03.application.util.ConvertUtil;
|
|
|
|
import com.zhiyun.zhiyun03.application.util.ConvertUtil;
|
|
|
@ -9,6 +12,8 @@ import com.zhiyun.zhiyun03.course.entity.Course;
|
|
|
|
import com.zhiyun.zhiyun03.course.service.CourseService;
|
|
|
|
import com.zhiyun.zhiyun03.course.service.CourseService;
|
|
|
|
import com.zhiyun.zhiyun03.course.vo.CourseVo;
|
|
|
|
import com.zhiyun.zhiyun03.course.vo.CourseVo;
|
|
|
|
import com.zhiyun.zhiyun03.course.mapper.CourseMapper;
|
|
|
|
import com.zhiyun.zhiyun03.course.mapper.CourseMapper;
|
|
|
|
|
|
|
|
import com.zhiyun.zhiyun03.course.vo.PageVO;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -21,7 +26,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper,Course> implemen
|
|
|
|
private CourseMapper courseMapper;
|
|
|
|
private CourseMapper courseMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
DirectoryMapper directoryMapper;
|
|
|
|
private DirectoryMapper directoryMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +35,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper,Course> implemen
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<CourseVo> queryCourse() {
|
|
|
|
public List<CourseVo> queryCourse() {
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<Course> qwa=new QueryWrapper<>();
|
|
|
|
QueryWrapper<Course> qwa=new QueryWrapper<>();
|
|
|
|
List<Course> courses = courseMapper.selectList(qwa);
|
|
|
|
List<Course> courses = courseMapper.selectList(qwa);
|
|
|
|
QueryWrapper<Directory> qwd=new QueryWrapper<>();
|
|
|
|
QueryWrapper<Directory> qwd=new QueryWrapper<>();
|
|
|
@ -39,21 +45,53 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper,Course> implemen
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < courses.size(); i++) {
|
|
|
|
for (int i = 0; i < courses.size(); i++) {
|
|
|
|
for (int j = 0; j <directories.size() ; j++) {
|
|
|
|
for (int j = 0; j <directories.size() ; j++) {
|
|
|
|
if(courses.get(i).getDirId()==directories.get(i).getId()){
|
|
|
|
//判断目录id是否相等
|
|
|
|
applicationVos.get(i).setDirName(directories.get(i).getDirName());
|
|
|
|
if(courses.get(i).getDirId()==directories.get(j).getId()){
|
|
|
|
|
|
|
|
//将目录名称添加到vo类中
|
|
|
|
|
|
|
|
applicationVos.get(i).setDirName(directories.get(j).getDirName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return applicationVos;
|
|
|
|
return applicationVos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
@Override
|
|
|
|
// public void addCourse(Course course) {
|
|
|
|
public void addCourse(Course course) {
|
|
|
|
// courseDAO.insert(course);
|
|
|
|
|
|
|
|
// }
|
|
|
|
courseMapper.insert(course);
|
|
|
|
//
|
|
|
|
UpdateWrapper<Directory> updateWrapper = new UpdateWrapper<>();
|
|
|
|
|
|
|
|
updateWrapper.set("id",course.getDirId());
|
|
|
|
|
|
|
|
directoryMapper.update(null,updateWrapper);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void delCourseById(Integer id) {
|
|
|
|
|
|
|
|
courseMapper.deleteById(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void update(Course course) {
|
|
|
|
|
|
|
|
//变更数据进行更新
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateWrapper<Course> updateWrapper = new UpdateWrapper<>();
|
|
|
|
|
|
|
|
updateWrapper.set("course_name",course.getCourseName());
|
|
|
|
|
|
|
|
updateWrapper.set("course_brief",course.getCourseBrief());
|
|
|
|
|
|
|
|
updateWrapper.set("course_url",course.getCourseUrl());
|
|
|
|
|
|
|
|
updateWrapper.set("dir_id",course.getDirId());
|
|
|
|
|
|
|
|
updateWrapper.set("course_icon",course.getCourseIcon());
|
|
|
|
|
|
|
|
updateWrapper.eq("id",course.getId());
|
|
|
|
|
|
|
|
courseMapper.update(null,updateWrapper);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
// @Override
|
|
|
|
// public void delCourseById(Integer id) {
|
|
|
|
// public void delCourseById(Integer id) {
|
|
|
|
// courseDAO.deleteByPrimaryKey(id);
|
|
|
|
// courseDAO.deleteByPrimaryKey(id);
|
|
|
|