diff --git a/2109251913501339-0-lp.jpg b/2109251913501339-0-lp.jpg deleted file mode 100644 index a300051..0000000 Binary files a/2109251913501339-0-lp.jpg and /dev/null differ diff --git a/src/main/java/com/zhiyun/zhiyun03/application/entity/Directory.java b/src/main/java/com/zhiyun/zhiyun03/application/entity/Directory.java index 0ec2f99..f361acc 100644 --- a/src/main/java/com/zhiyun/zhiyun03/application/entity/Directory.java +++ b/src/main/java/com/zhiyun/zhiyun03/application/entity/Directory.java @@ -40,14 +40,6 @@ public class Directory { private String dirImg; - /** - * 目录归属 - */ - @TableField(value = "dir_iden") - private String dirIden; - - - /** * 添加时间 */ diff --git a/src/main/java/com/zhiyun/zhiyun03/course/mapper/CourseMapper.java b/src/main/java/com/zhiyun/zhiyun03/course/mapper/CourseMapper.java index a55f6f1..44f5899 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/mapper/CourseMapper.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/mapper/CourseMapper.java @@ -7,7 +7,9 @@ import com.zhiyun.zhiyun03.course.vo.PageVO; import org.apache.ibatis.annotations.Mapper; import java.util.List; - +/** + * 查询持久层 + */ @Mapper public interface CourseMapper extends BaseMapper { diff --git a/src/main/java/com/zhiyun/zhiyun03/course/param/PageParam.java b/src/main/java/com/zhiyun/zhiyun03/course/param/PageParam.java index c40fdc3..fa7d040 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/param/PageParam.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/param/PageParam.java @@ -1,7 +1,9 @@ package com.zhiyun.zhiyun03.course.param; import lombok.Data; - +/** + * 分页参数 + */ @Data public class PageParam { /** diff --git a/src/main/java/com/zhiyun/zhiyun03/course/service/CourseService.java b/src/main/java/com/zhiyun/zhiyun03/course/service/CourseService.java index 63da2f9..49de138 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/service/CourseService.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/service/CourseService.java @@ -10,7 +10,9 @@ import io.swagger.annotations.ApiParam; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; - +/** + * 课程服务层 + */ public interface CourseService extends IService { /** @@ -37,8 +39,13 @@ public interface CourseService extends IService { * 根据ID查询课程 */ CourseVo queryCourseById(Integer id); - + /** + * 添加课程目录 + */ void addCourseDirectory(Directory directory); + /** + * 查询课程目录 + */ List queryCourseDirectory(); } diff --git a/src/main/java/com/zhiyun/zhiyun03/course/service/impl/CourseServiceImpl.java b/src/main/java/com/zhiyun/zhiyun03/course/service/impl/CourseServiceImpl.java index 182e62b..27367e7 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/service/impl/CourseServiceImpl.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/service/impl/CourseServiceImpl.java @@ -83,7 +83,7 @@ public class CourseServiceImpl extends ServiceImpl implemen throw new ServiceException("403","该课程已经存在"); } Course course = new Course(); - + /*将vo参数赋值给course*/ BeanUtils.copyProperties(courseVo,course); //获取目录名称 @@ -179,13 +179,17 @@ public class CourseServiceImpl extends ServiceImpl implemen } return courseVo; } - + /** + * 添加课程目录 + */ @Override public void addCourseDirectory(Directory directory) { + /*判断目录名是否为空*/ if (directory.getDirName().isEmpty()) { throw new ServiceException("400","目录名称不能为空"); } + /*判断目录图标是否为空*/ if (directory.getDirImg().isEmpty()) { throw new ServiceException("400","请选择一个icon"); @@ -196,7 +200,7 @@ public class CourseServiceImpl extends ServiceImpl implemen { throw new ServiceException("400","目录已存在"); } - + /*目录生成随机id*/ int uuid= UUID.randomUUID().hashCode(); if(uuid<0){ uuid=-uuid; @@ -205,7 +209,9 @@ public class CourseServiceImpl extends ServiceImpl implemen directory.setId(uuid); directoryMapper.addCourseDirectory(directory); } - + /** + * 查询课程目录 + */ @Override public List queryCourseDirectory() { diff --git a/src/main/java/com/zhiyun/zhiyun03/download/service/impl/DownloadServiceImpl.java b/src/main/java/com/zhiyun/zhiyun03/download/service/impl/DownloadServiceImpl.java index d5450ae..febcd85 100644 --- a/src/main/java/com/zhiyun/zhiyun03/download/service/impl/DownloadServiceImpl.java +++ b/src/main/java/com/zhiyun/zhiyun03/download/service/impl/DownloadServiceImpl.java @@ -29,14 +29,14 @@ public class DownloadServiceImpl extends ServiceImpl i @Resource private DirectoryMapper directoryMapper; - /* - * 查询下载中心 - * */ + /* + * 分页查询下载中心 + * */ @Override public PageVO queryDownload(Integer page, Integer limit) { //开启分页 - PageHelper.startPage(page,limit); + PageHelper.startPage(page, limit); //查询所有下载数据 List downloadVoList = downloadMapper.queryDownload(); @@ -52,35 +52,36 @@ public class DownloadServiceImpl extends ServiceImpl i return downloadVoPageVO; } + /* * 添加下载 * */ @Override public int addDownload(DownloadVo vo) { //查询下载名称是否已经存在 - int count = downloadMapper.selectByName(vo.getDownloadName()); - if (count>0) - { - throw new ServiceException("403","下载已存在"); - } + int count = downloadMapper.selectByName(vo.getDownloadName()); + if (count > 0) { + throw new ServiceException("403", "下载已存在"); + } + //将vo值传给download Download download = new Download(); - BeanUtils.copyProperties(vo,download); + BeanUtils.copyProperties(vo, download); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(),"5"); - if (dirId==null){ - throw new ServiceException("400","目录不存在"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(), "5"); + if (dirId == null) { + throw new ServiceException("400", "目录不存在"); } + /*设置目录id*/ download.setDirId(dirId); + /*设置更新时间*/ download.setDownloadUpdatetime(new Date()); //添加download int insert = downloadMapper.insert(download); - if (insert>0) - { + if (insert > 0) { return insert; - }else - { - throw new ServiceException("400","添加下载失败"); + } else { + throw new ServiceException("400", "添加下载失败"); } } @@ -89,21 +90,19 @@ public class DownloadServiceImpl extends ServiceImpl i * */ @Override public int delDownload(Integer id) { - if (id == null) - { - throw new ServiceException("400","查询id值为空"); + if (id == null) { + throw new ServiceException("400", "查询id值为空"); } //根据id删除 int count = downloadMapper.deleteById(id); - if (count>0) - { + if (count > 0) { return count; - }else - { - throw new ServiceException("400","删除失败"); + } else { + throw new ServiceException("400", "删除失败"); } } + /* * 根据id查询数据 * */ @@ -115,65 +114,64 @@ public class DownloadServiceImpl extends ServiceImpl i Directory directory = directoryMapper.selectById(download.getDirId()); DownloadVo downloadAddVo = new DownloadVo(); //复制给vo - BeanUtils.copyProperties(download,downloadAddVo); + BeanUtils.copyProperties(download, downloadAddVo); + /*设置目录名*/ downloadAddVo.setDirName(directory.getDirName()); return downloadAddVo; } + /* * 更新下载 * */ @Override public int updateDownload(DownloadVo vo) { /*条件判断*/ - if (vo.getDownloadName().isEmpty()) - { - throw new ServiceException("400","下载名不能为空失败"); + if (vo.getDownloadName().isEmpty()) { + throw new ServiceException("400", "下载名不能为空失败"); } //将vo值传给download Download download = new Download(); - BeanUtils.copyProperties(vo,download); + BeanUtils.copyProperties(vo, download); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(),"5"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(), "5"); download.setDirId(dirId); download.setDownloadUpdatetime(new Date()); //添加download int insert = downloadMapper.updateDownloadById(download); - if (insert>0) - { + if (insert > 0) { return insert; - }else - { - throw new ServiceException("400","更新失败"); + } else { + throw new ServiceException("400", "更新失败"); } } + /*添加下载目录*/ @Override public void addDownloadDirectory(Directory directory) { - if (directory.getDirName().isEmpty()) - { - throw new ServiceException("400","目录名称不能为空"); + if (directory.getDirName().isEmpty()) { + throw new ServiceException("400", "目录名称不能为空"); } - if (directory.getDirImg().isEmpty()) - { - throw new ServiceException("400","请选择一个icon"); + if (directory.getDirImg().isEmpty()) { + throw new ServiceException("400", "请选择一个icon"); } - - Integer count = directoryMapper.selectByName(directory.getDirName(),"5"); - if (count!=null) - { - throw new ServiceException("400","目录已存在"); + /*查询目录名是否存在*/ + Integer count = directoryMapper.selectByName(directory.getDirName(), "5"); + if (count != null) { + throw new ServiceException("400", "目录已存在"); } - - int uuid= UUID.randomUUID().hashCode(); - if(uuid<0){ - uuid=-uuid; + /*目录生成随机id*/ + int uuid = UUID.randomUUID().hashCode(); + if (uuid < 0) { + uuid = -uuid; } directory.setDirAddtime(new Date()); directory.setId(uuid); + /*添加下载*/ directoryMapper.addDownloadDirectory(directory); } + /*查询下载目录*/ @Override public List queryDownloadDirectory() { List directoryList = directoryMapper.queryDownloadDirectory(); diff --git a/src/main/java/com/zhiyun/zhiyun03/utils/oss/AliyunOssUtil.java b/src/main/java/com/zhiyun/zhiyun03/utils/oss/AliyunOssUtil.java index 2e7ac00..31b8ed9 100644 --- a/src/main/java/com/zhiyun/zhiyun03/utils/oss/AliyunOssUtil.java +++ b/src/main/java/com/zhiyun/zhiyun03/utils/oss/AliyunOssUtil.java @@ -69,7 +69,6 @@ public class AliyunOssUtil { client.shutdown(); } } - return null; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6cee5ca..2c0ceed 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,7 +20,10 @@ spring: url: jdbc:mysql://localhost:3306/zhiyun?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai username: root password: root - + servlet: + multipart: + max-file-size: 50MB + max-request-size: 50MB # mybatis plus的配置和mybatis类似,之前在mybatis的配置,使用mybtis-plus替换 @@ -39,4 +42,4 @@ pagehelper: swagger: - enabled: true + enabled: false diff --git a/src/main/resources/templates/layui-v2.6.8/index.html b/src/main/resources/templates/layui-v2.6.8/index.html index 96e0245..4001fa1 100644 --- a/src/main/resources/templates/layui-v2.6.8/index.html +++ b/src/main/resources/templates/layui-v2.6.8/index.html @@ -10,25 +10,6 @@
- - - - - - - - - - - - - - - - - - -