From b9d2410050aa736f83a3ffca6ea95acfc70d24c3 Mon Sep 17 00:00:00 2001 From: whb <17803890193@163.com> Date: Fri, 18 Aug 2023 14:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=BD=92=E5=B1=9E=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CourseServiceImpl.java | 11 ++++--- .../controller/DownloadController.java | 4 +-- .../service/impl/DownloadServiceImpl.java | 10 ++++-- .../zhiyun/zhiyun03/filter/LoginFilter.java | 2 +- .../invite/service/InviteService.java | 15 ++++----- .../invite/service/impl/InviteServieImpl.java | 14 ++++----- .../serve/controller/ServeController.java | 3 +- .../zhiyun03/serve/service/ServeService.java | 17 +++++----- .../serve/service/impl/ServeServiceImpl.java | 31 ++++++++++++++----- src/main/resources/application.yml | 2 +- src/main/resources/mapper/CourseMapper.xml | 2 +- src/main/resources/mapper/DirectoryMapper.xml | 12 +++---- src/main/resources/mapper/DownloadMapper.xml | 2 +- src/main/resources/mapper/InviteMapper.xml | 2 +- .../templates/layui-v2.6.8/academicList.html | 2 +- .../templates/layui-v2.6.8/inviteList.html | 8 ++--- 16 files changed, 80 insertions(+), 57 deletions(-) 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 27367e7..df5d65e 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 @@ -76,6 +76,10 @@ public class CourseServiceImpl extends ServiceImpl implemen { throw new ServiceException("400","课程名称不能为空"); } + if (courseVo.getCourseIcon().isEmpty()) + { + throw new ServiceException("400","请选择一个默认图标"); + } //查询名称查询课程 int sum = courseMapper.selectByName(courseVo.getCourseName()); if (sum>0) @@ -93,7 +97,7 @@ public class CourseServiceImpl extends ServiceImpl implemen throw new ServiceException("403","归属目录不能为空"); } //查询目录id,并赋值给course - Integer id = directoryMapper.selectByName(dirName,"3"); + Integer id = directoryMapper.selectByName(dirName,"1"); if (id==null) { throw new ServiceException("403","归属目录不存在"); @@ -144,7 +148,7 @@ public class CourseServiceImpl extends ServiceImpl implemen throw new ServiceException("403","归属目录不能为空"); } //查询目录id,并赋值给course - Integer id = directoryMapper.selectByName(dirName,"3"); + Integer id = directoryMapper.selectByName(dirName,"1"); if (id==null) { throw new ServiceException("403","归属目录不存在"); @@ -194,8 +198,7 @@ public class CourseServiceImpl extends ServiceImpl implemen { throw new ServiceException("400","请选择一个icon"); } - directory.setDirIden("3"); - Integer integer = directoryMapper.selectByName(directory.getDirName(),"3"); + Integer integer = directoryMapper.selectByName(directory.getDirName(),"1"); if (integer!=null) { throw new ServiceException("400","目录已存在"); diff --git a/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java b/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java index 89fe6b7..68ab01b 100644 --- a/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java +++ b/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java @@ -16,7 +16,7 @@ import javax.annotation.Resource; import java.io.File; import java.io.FileOutputStream; import java.util.List; - +/*下载控制层*/ @RestController @RequestMapping("/download") public class DownloadController { @@ -45,7 +45,6 @@ public class DownloadController { vo.setDownloadImg(this.path); int count = downloadService.addDownload(vo); return JsonResult.success(); - } @@ -62,7 +61,6 @@ public class DownloadController { public JsonResult queryById(Integer id){ DownloadVo downloadAddVo =downloadService.queryById(id); return JsonResult.success(downloadAddVo); - } @ApiOperation("更新下载") 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 febcd85..ac64322 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 @@ -68,7 +68,7 @@ public class DownloadServiceImpl extends ServiceImpl i Download download = new Download(); BeanUtils.copyProperties(vo, download); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(), "5"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(), "3"); if (dirId == null) { throw new ServiceException("400", "目录不存在"); } @@ -134,7 +134,11 @@ public class DownloadServiceImpl extends ServiceImpl i Download download = new Download(); BeanUtils.copyProperties(vo, download); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(), "5"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(), "3"); + if (dirId==null) + { + throw new ServiceException("400", "归属目录不能为空"); + } download.setDirId(dirId); download.setDownloadUpdatetime(new Date()); //添加download @@ -156,7 +160,7 @@ public class DownloadServiceImpl extends ServiceImpl i throw new ServiceException("400", "请选择一个icon"); } /*查询目录名是否存在*/ - Integer count = directoryMapper.selectByName(directory.getDirName(), "5"); + Integer count = directoryMapper.selectByName(directory.getDirName(), "3"); if (count != null) { throw new ServiceException("400", "目录已存在"); } diff --git a/src/main/java/com/zhiyun/zhiyun03/filter/LoginFilter.java b/src/main/java/com/zhiyun/zhiyun03/filter/LoginFilter.java index 57b7a9f..24f4a98 100644 --- a/src/main/java/com/zhiyun/zhiyun03/filter/LoginFilter.java +++ b/src/main/java/com/zhiyun/zhiyun03/filter/LoginFilter.java @@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -@WebFilter(urlPatterns = "*")//表示所有请求都走这个过滤器(可以用来设置编码) +//@WebFilter(urlPatterns = "*")//表示所有请求都走这个过滤器(可以用来设置编码) public class LoginFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { diff --git a/src/main/java/com/zhiyun/zhiyun03/invite/service/InviteService.java b/src/main/java/com/zhiyun/zhiyun03/invite/service/InviteService.java index 72a153e..a9a0500 100644 --- a/src/main/java/com/zhiyun/zhiyun03/invite/service/InviteService.java +++ b/src/main/java/com/zhiyun/zhiyun03/invite/service/InviteService.java @@ -8,19 +8,20 @@ import com.zhiyun.zhiyun03.invite.entity.Invite; import com.zhiyun.zhiyun03.invite.vo.InviteVo; import java.util.List; - +/*服务层*/ public interface InviteService extends IService { + /*查询服务*/ PageVO queryInvite(Integer page, Integer limit); - + /*根据id查询*/ InviteVo queryInviteById(Integer id); - + /*添加服务*/ int addInvite(InviteVo vo); - + /*删除服务*/ int delInviteById(Integer id); - + /*更新服务*/ int updateById(InviteVo vo); - + /*添加目录*/ void addInviteDirectory(Directory directory); - + /*查询目录*/ List queryInviteDirectory(); } diff --git a/src/main/java/com/zhiyun/zhiyun03/invite/service/impl/InviteServieImpl.java b/src/main/java/com/zhiyun/zhiyun03/invite/service/impl/InviteServieImpl.java index 764ac9b..16d6a19 100644 --- a/src/main/java/com/zhiyun/zhiyun03/invite/service/impl/InviteServieImpl.java +++ b/src/main/java/com/zhiyun/zhiyun03/invite/service/impl/InviteServieImpl.java @@ -85,17 +85,17 @@ public class InviteServieImpl extends ServiceImpl implemen { throw new ServiceException("403","就业名已存在"); } - //将vo值传给download + //将vo值传给就业 Invite invite = new Invite(); BeanUtils.copyProperties(vo,invite); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(),"7"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(),"8"); if (dirId==null){ throw new ServiceException("400","目录不存在"); } invite.setDirId(dirId); invite.setInviteUpdatetime(new Date()); - //添加download + //添加就业 int insert = inviteMapper.insert(invite); if (insert>0) { @@ -144,7 +144,7 @@ public class InviteServieImpl extends ServiceImpl implemen Invite invite = new Invite(); BeanUtils.copyProperties(vo,invite); //查询归属目录id - Integer dirId = directoryMapper.selectByName(vo.getDirName(),"7"); + Integer dirId = directoryMapper.selectByName(vo.getDirName(),"8"); invite.setDirId(dirId); invite.setInviteUpdatetime(new Date()); //添加download @@ -157,7 +157,7 @@ public class InviteServieImpl extends ServiceImpl implemen throw new ServiceException("400","更新失败"); } } - +/*添加目录*/ @Override public void addInviteDirectory(Directory directory) { if (directory.getDirName().isEmpty()) @@ -169,7 +169,7 @@ public class InviteServieImpl extends ServiceImpl implemen throw new ServiceException("400","请选择一个icon"); } - Integer count = directoryMapper.selectByName(directory.getDirName(),"7"); + Integer count = directoryMapper.selectByName(directory.getDirName(),"8"); if (count!=null) { throw new ServiceException("400","目录已存在"); @@ -183,7 +183,7 @@ public class InviteServieImpl extends ServiceImpl implemen directory.setId(uuid); directoryMapper.addInviteDirectory(directory); } - +/*查询目录*/ @Override public List queryInviteDirectory() { diff --git a/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java b/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java index 1e2ecc1..7968ff3 100644 --- a/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java +++ b/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java @@ -20,7 +20,7 @@ import javax.annotation.Resource; import java.io.File; import java.io.FileOutputStream; import java.util.List; - +/*服务控制层*/ @Api("服务相关") @RestController @RequestMapping("/api/serve") @@ -29,7 +29,6 @@ public class ServeController { @Resource private AliyunOssUtil ossUtil; - @Resource private ServeService serveService; diff --git a/src/main/java/com/zhiyun/zhiyun03/serve/service/ServeService.java b/src/main/java/com/zhiyun/zhiyun03/serve/service/ServeService.java index 60a97e2..46ac138 100644 --- a/src/main/java/com/zhiyun/zhiyun03/serve/service/ServeService.java +++ b/src/main/java/com/zhiyun/zhiyun03/serve/service/ServeService.java @@ -8,19 +8,22 @@ import com.zhiyun.zhiyun03.serve.entity.Serve; import com.zhiyun.zhiyun03.serve.vo.ServeVo; import java.util.List; - +/* +服务层 +*/ public interface ServeService extends IService { + //查询服务 PageVO queryServe(Integer page, Integer limit); - + /*添加服务*/ int addServe(ServeVo vo); - + /*删除服务*/ int delServe(Integer id); - + /*根据id查询*/ ServeVo queryById(Integer id); - + /*更新服务*/ int updateServe(ServeVo vo); - + /*添加目录*/ void addServiceDirectory(Directory directory); - + /*查询目录*/ List queryServiceDirectory(); } diff --git a/src/main/java/com/zhiyun/zhiyun03/serve/service/impl/ServeServiceImpl.java b/src/main/java/com/zhiyun/zhiyun03/serve/service/impl/ServeServiceImpl.java index 5f3b819..a46ced8 100644 --- a/src/main/java/com/zhiyun/zhiyun03/serve/service/impl/ServeServiceImpl.java +++ b/src/main/java/com/zhiyun/zhiyun03/serve/service/impl/ServeServiceImpl.java @@ -61,7 +61,7 @@ public class ServeServiceImpl extends ServiceImpl implements /* - * 添加数据 + * 添加服务 * */ @Override public int addServe(ServeVo vo) { @@ -92,7 +92,9 @@ public class ServeServiceImpl extends ServiceImpl implements throw new ServiceException("400","添加下载失败"); } } - + /* + * 删除服务 + * */ @Override public int delServe(Integer id) { if (id == null) @@ -111,8 +113,15 @@ public class ServeServiceImpl extends ServiceImpl implements } } + /* + * 根据id查询 + * */ @Override public ServeVo queryById(Integer id) { + if (id==null) + { + throw new ServiceException("401","id为空"); + } //根据id查询数据 Serve serve = serveMapper.selectById(id); //查询目录id @@ -123,7 +132,9 @@ public class ServeServiceImpl extends ServiceImpl implements serveVo.setDirName(directory.getDirName()); return serveVo; } - + /* + * 更新服务 + * */ @Override public int updateServe(ServeVo vo) { //查询更新的下载名是否存在 @@ -149,7 +160,9 @@ public class ServeServiceImpl extends ServiceImpl implements throw new ServiceException("400","更新失败"); } } - + /* + * 添加服务目录 + * */ @Override public void addServiceDirectory(Directory directory) { if (directory.getDirName().isEmpty()) @@ -160,13 +173,13 @@ public class ServeServiceImpl extends ServiceImpl implements { throw new ServiceException("400","请选择一个icon"); } - + /*查询目录是否存在*/ Integer count = directoryMapper.selectByName(directory.getDirName(),"9"); if (count!=null) { throw new ServiceException("400","目录已存在"); - } - + }/* + 生成随机id*/ int uuid= UUID.randomUUID().hashCode(); if(uuid<0){ uuid=-uuid; @@ -175,7 +188,9 @@ public class ServeServiceImpl extends ServiceImpl implements directory.setId(uuid); directoryMapper.addServiceDirectory(directory); } - + /* + * 查询服务目录 + * */ @Override public List queryServiceDirectory() { List directoryList = directoryMapper.queryServiceDirectory(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0befe0c..8f27ab5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -19,7 +19,7 @@ spring: druid: url: jdbc:mysql://localhost:3306/zhiyun?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai username: root - password: 123456 + password: root thymeleaf: cache: false prefix: classpath:/templates diff --git a/src/main/resources/mapper/CourseMapper.xml b/src/main/resources/mapper/CourseMapper.xml index 4f2299f..03ea318 100644 --- a/src/main/resources/mapper/CourseMapper.xml +++ b/src/main/resources/mapper/CourseMapper.xml @@ -43,7 +43,7 @@ inner join (select id,dir_name,dir_img,dir_addtime,dir_iden from directory) as d on c.dir_id = d.id - WHERE d.dir_iden = 3 + WHERE d.dir_iden = 1