From f6dfd2c3d9d7c5d3e26007414be2b57ed7663a51 Mon Sep 17 00:00:00 2001 From: whb <17803890193@163.com> Date: Tue, 15 Aug 2023 18:19:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=B7=BB=E5=8A=A0=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=92=8C=E8=AF=BE=E7=A8=8B=EF=BC=8C=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../course/controller/CourseController.java | 1 + .../controller/DownloadController.java | 29 +- .../invite/controller/InviteController.java | 7 +- .../invite/service/impl/InviteServieImpl.java | 31 +- .../zhiyun/zhiyun03/invite/vo/InviteVo.java | 8 +- .../serve/controller/ServeController.java | 15 +- .../serve/service/impl/ServeServiceImpl.java | 21 +- .../templates/layui-v2.6.8/downloadList.html | 85 ++-- .../templates/layui-v2.6.8/inviteList.html | 370 +++++++++++++++-- .../templates/layui-v2.6.8/serveList.html | 390 ++++++++++++++++-- 10 files changed, 792 insertions(+), 165 deletions(-) diff --git a/src/main/java/com/zhiyun/zhiyun03/course/controller/CourseController.java b/src/main/java/com/zhiyun/zhiyun03/course/controller/CourseController.java index 54e3e0a..471f185 100644 --- a/src/main/java/com/zhiyun/zhiyun03/course/controller/CourseController.java +++ b/src/main/java/com/zhiyun/zhiyun03/course/controller/CourseController.java @@ -92,6 +92,7 @@ public class CourseController { @ApiOperation("更新课程") @RequestMapping("/updateById") public JsonResult updateById(CourseVo courseVo){ + int count = courseService.updateById(courseVo); return JsonResult.success(); } 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 5341fc6..f88c56b 100644 --- a/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java +++ b/src/main/java/com/zhiyun/zhiyun03/download/controller/DownloadController.java @@ -46,33 +46,6 @@ public class DownloadController { return JsonResult.success(); } -// -// @ApiOperation("图片上传") -// @PostMapping("/uploadFile") -// public JsonResult upload(@RequestParam("upload") @RequestPart MultipartFile file){ -// String upload = null; -// try { -// if (file != null) { -// String fileName = file.getOriginalFilename(); -// if (!"".equals(fileName.trim())) { -// File newFile = new File(fileName); -// -// FileOutputStream os = new FileOutputStream(newFile); -// os.write(file.getBytes()); -// os.close(); -// -// //把file里的内容复制到newFile中 -// file.transferTo(newFile); -// upload = ossUtil.upload(newFile); -// -// } -// } -// } catch (Exception e) { -// e.printStackTrace(); -// } -// path = "https://zhiyun03.oss-cn-beijing.aliyuncs.com/"+ upload; -// return JsonResult.success(path); -// } @ApiOperation("删除下载") @@ -94,7 +67,7 @@ public class DownloadController { @ApiOperation("更新下载") @PostMapping("/updateDownload") public JsonResult updateDownload(DownloadVo vo){ - vo.setDownloadImg(path); + vo.setDownloadImg(this.path); int count =downloadService.updateDownload(vo); return JsonResult.success(); } diff --git a/src/main/java/com/zhiyun/zhiyun03/invite/controller/InviteController.java b/src/main/java/com/zhiyun/zhiyun03/invite/controller/InviteController.java index 74b043c..add558f 100644 --- a/src/main/java/com/zhiyun/zhiyun03/invite/controller/InviteController.java +++ b/src/main/java/com/zhiyun/zhiyun03/invite/controller/InviteController.java @@ -5,6 +5,7 @@ import com.zhiyun.zhiyun03.course.vo.CourseVo; import com.zhiyun.zhiyun03.course.vo.PageVO; import com.zhiyun.zhiyun03.invite.service.InviteService; import com.zhiyun.zhiyun03.invite.vo.InviteVo; +import com.zhiyun.zhiyun03.serve.vo.ServeVo; import com.zhiyun.zhiyun03.utils.common.JsonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -22,12 +23,12 @@ public class InviteController { @ApiOperation("查询就业") @GetMapping("/queryInvite") - public JsonResult> queryCourse(@ApiParam @RequestParam(value = "page",required = false,defaultValue = "1")Integer page, - @ApiParam @RequestParam(value = "limit",required = false,defaultValue = "1")Integer limit ){ + public JsonResult> queryServe(@ApiParam @RequestParam(value = "page",required = false,defaultValue = "1")Integer page, + @ApiParam @RequestParam(value = "limit",required = false,defaultValue = "5")Integer limit ){ PageVO lists = inviteService.queryInvite(page,limit); - return JsonResult.success(lists); + return JsonResult.success(lists).setCount(lists.getTotal()); } @ApiOperation("根据ID查询就业") 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 05446f2..2432de9 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 @@ -13,6 +13,7 @@ import com.zhiyun.zhiyun03.invite.mapper.InviteMapper; import com.zhiyun.zhiyun03.invite.service.InviteService; import com.zhiyun.zhiyun03.invite.vo.InviteVo; import com.zhiyun.zhiyun03.serve.mapper.ServeMapper; +import com.zhiyun.zhiyun03.serve.vo.ServeVo; import com.zhiyun.zhiyun03.utils.exception.ServiceException; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -36,19 +37,21 @@ public class InviteServieImpl extends ServiceImpl implemen @Override public PageVO queryInvite(Integer page, Integer limit) { - //开启分页 PageHelper.startPage(page,limit); - //查询所有下载数据 - List downloadVoList = inviteMapper.queryInvite(); - - PageInfo downloadVoPageInfo = new PageInfo<>(downloadVoList); + //查询所有课程 + List inviteVoList = inviteMapper.queryInvite(); + if (inviteVoList.isEmpty()) + { + throw new ServiceException("400","课程数据为空"); + } + PageInfo pageInfo = new PageInfo(inviteVoList); PageVO inviteVoPageVO = new PageVO<>(); - //获取当前页 - inviteVoPageVO.setCurrentPage(downloadVoPageInfo.getPageNum()); + //当前页 + inviteVoPageVO.setCurrentPage(pageInfo.getPageNum()); //总条数 - inviteVoPageVO.setTotal(downloadVoPageInfo.getTotal()); + inviteVoPageVO.setTotal(pageInfo.getTotal()); //分页数据 - inviteVoPageVO.setList(downloadVoPageInfo.getList()); + inviteVoPageVO.setList(pageInfo.getList()); return inviteVoPageVO; @@ -126,11 +129,11 @@ public class InviteServieImpl extends ServiceImpl implemen @Override public int updateById(InviteVo vo) { //查询更新的下载名是否存在 - int sum = inviteMapper.selectByName(vo.getInviteName()); - if (sum>0) - { - throw new ServiceException("403","下载已存在"); - } +// int sum = inviteMapper.selectByName(vo.getInviteName()); +// if (sum>0) +// { +// throw new ServiceException("403","下载已存在"); +// } //将vo值传给download Invite invite = new Invite(); diff --git a/src/main/java/com/zhiyun/zhiyun03/invite/vo/InviteVo.java b/src/main/java/com/zhiyun/zhiyun03/invite/vo/InviteVo.java index 49d1371..631b44e 100644 --- a/src/main/java/com/zhiyun/zhiyun03/invite/vo/InviteVo.java +++ b/src/main/java/com/zhiyun/zhiyun03/invite/vo/InviteVo.java @@ -24,9 +24,9 @@ public class InviteVo { * 归属目录 */ private String dirName; - /** - * 招聘图片 - */ - private String inviteImg; +// /** +// * 招聘图片 +// */ +// private String inviteImg; } 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 f30545e..62fe7e2 100644 --- a/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java +++ b/src/main/java/com/zhiyun/zhiyun03/serve/controller/ServeController.java @@ -1,5 +1,6 @@ package com.zhiyun.zhiyun03.serve.controller; +import com.zhiyun.zhiyun03.course.vo.CourseVo; import com.zhiyun.zhiyun03.course.vo.PageVO; import com.zhiyun.zhiyun03.download.service.DownloadService; import com.zhiyun.zhiyun03.download.vo.DownloadVo; @@ -29,21 +30,24 @@ public class ServeController { @Resource private ServeService serveService; + private String path = ""; + @ApiOperation("查询服务中心") @GetMapping("/queryServe") - public JsonResult> queryServe(@ApiParam @RequestParam(value = "page", required = false, defaultValue = "1") Integer page, - @ApiParam @RequestParam(value = "limit", required = false, defaultValue = "5") Integer limit) { + public JsonResult> queryServe(@ApiParam @RequestParam(value = "page",required = false,defaultValue = "1")Integer page, + @ApiParam @RequestParam(value = "limit",required = false,defaultValue = "5")Integer limit ){ - PageVO lists = serveService.queryServe(page, limit); + PageVO lists = serveService.queryServe(page,limit); - return JsonResult.success(lists); + return JsonResult.success(lists).setCount(lists.getTotal()); } @ApiOperation("添加服务") @PostMapping("/addServe") public JsonResult addServe(ServeVo vo){ + vo.setServeImg(this.path); int count = serveService.addServe(vo); return JsonResult.success(); @@ -72,7 +76,7 @@ public class ServeController { } catch (Exception e) { e.printStackTrace(); } - String path = "https://zhiyun03.oss-cn-beijing.aliyuncs.com/"+ upload; + path = "https://zhiyun03.oss-cn-beijing.aliyuncs.com/"+ upload; return JsonResult.success(path); } @@ -96,6 +100,7 @@ public class ServeController { @ApiOperation("更新服务") @PostMapping("/updateServe") public JsonResult updateServe(ServeVo vo){ + vo.setServeImg(this.path); int count =serveService.updateServe(vo); return JsonResult.success(); } 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 abf8668..f4c1496 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 @@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.zhiyun.zhiyun03.application.entity.Directory; import com.zhiyun.zhiyun03.application.mapper.DirectoryMapper; +import com.zhiyun.zhiyun03.course.vo.CourseVo; import com.zhiyun.zhiyun03.course.vo.PageVO; import com.zhiyun.zhiyun03.invite.entity.Invite; import com.zhiyun.zhiyun03.invite.vo.InviteVo; @@ -37,19 +38,21 @@ public class ServeServiceImpl extends ServiceImpl implements * */ @Override public PageVO queryServe(Integer page, Integer limit) { - //开启分页 PageHelper.startPage(page,limit); - //查询所有下载数据 - List serveVoList = serveMapper.queryService(); - - PageInfo serveVoPageInfo = new PageInfo<>(serveVoList); + //查询所有课程 + List serveVoList = serveMapper.queryService(); + if (serveVoList.isEmpty()) + { + throw new ServiceException("400","课程数据为空"); + } + PageInfo pageInfo = new PageInfo(serveVoList); PageVO serveVoPageVO = new PageVO<>(); - //获取当前页 - serveVoPageVO.setCurrentPage(serveVoPageInfo.getPageNum()); + //当前页 + serveVoPageVO.setCurrentPage(pageInfo.getPageNum()); //总条数 - serveVoPageVO.setTotal(serveVoPageInfo.getTotal()); + serveVoPageVO.setTotal(pageInfo.getTotal()); //分页数据 - serveVoPageVO.setList(serveVoPageInfo.getList()); + serveVoPageVO.setList(pageInfo.getList()); return serveVoPageVO; } diff --git a/src/main/resources/templates/layui-v2.6.8/downloadList.html b/src/main/resources/templates/layui-v2.6.8/downloadList.html index 4b68771..5702368 100644 --- a/src/main/resources/templates/layui-v2.6.8/downloadList.html +++ b/src/main/resources/templates/layui-v2.6.8/downloadList.html @@ -183,7 +183,8 @@ //拖拽上传 upload.render({ elem: '#test10' - ,url: 'http://localhost:8080/download/uploadFile?param=upload' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 + ,url: 'http://localhost:8080/download/upload?file=upload' //此处用的是第三方的 http 请求演示,实际使用时改成您自己的上传接口即可。 + , accept: 'file' ,done: function(res){ layer.msg('上传成功'); layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.data); @@ -238,7 +239,7 @@

点击上传,或将文件拖拽到此处

-
+

上传成功后渲染
@@ -250,6 +251,35 @@ + - - - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/layui-v2.6.8/serveList.html b/src/main/resources/templates/layui-v2.6.8/serveList.html index 8da8993..6686f7b 100644 --- a/src/main/resources/templates/layui-v2.6.8/serveList.html +++ b/src/main/resources/templates/layui-v2.6.8/serveList.html @@ -15,8 +15,8 @@ + + + + + + + + + \ No newline at end of file