From f07e59c4ab4763f522a4aa2788f61153f6dedf4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B5=A9?= <1489339700@qq.com> Date: Wed, 24 Aug 2022 20:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=A8=E6=B5=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EncyclopediaController.java | 42 ++++++++----------- .../irs/controller/RoleController.java | 3 +- .../controller/StationResumeController.java | 7 +--- .../com/sixteam/irs/entity/Encyclopedia.java | 38 ++++++++++------- .../irs/mapper/EncyclopediaMapper.java | 4 +- .../irs/service/EncyclopediaService.java | 6 +-- .../service/Impl/EncyclopediaServiceImpl.java | 7 ++-- .../Impl/StationResumeServiceImpl.java | 9 ++-- 8 files changed, 57 insertions(+), 59 deletions(-) diff --git a/src/main/java/com/sixteam/irs/controller/EncyclopediaController.java b/src/main/java/com/sixteam/irs/controller/EncyclopediaController.java index d0db837..8563294 100644 --- a/src/main/java/com/sixteam/irs/controller/EncyclopediaController.java +++ b/src/main/java/com/sixteam/irs/controller/EncyclopediaController.java @@ -8,36 +8,30 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.List; - -@Controller +@CrossOrigin +@RestController @RequestMapping( "/ee") public class EncyclopediaController { @Autowired private EncyclopediaService encyclopediaService; - - - @RequestMapping( "/list") - public String list(Model model,@RequestParam(defaultValue = "1", required = true, value = "pageNo") Integer pageNo) { - - Integer pageSize = 4;//每页显示记录数 - //分页查询 - PageHelper.startPage(pageNo, pageSize); + public List list() { + //这里显示所有的百科列表 List encyclopediaList = encyclopediaService.findAllEncyclopedias();//获取所有用户信息 - PageInfo pageInfo = new PageInfo(encyclopediaList); - model.addAttribute("pageInfo", pageInfo); - return "/test/encyclopedia/职场百科页面.html"; + return encyclopediaList; } @RequestMapping( "/toAdd") - public String toAdd(Integer encId, HttpServletRequest request) { + public String toAdd(String encId, HttpServletRequest request) { System.out.println(encId); return "/test/encyclopedia/添加公告页面.html"; @@ -62,21 +56,19 @@ public class EncyclopediaController { } @RequestMapping( "/del") - public String del(Integer encId, HttpServletRequest request) { - - int res = encyclopediaService.delEncyclopedia(encId); - if (res > 0) { - - request.setAttribute("msg", "删除公告成功"); - return "redirect:/ee/list"; - } else { - request.setAttribute("msg", "删除公告失败"); - return "/test/错误页面.html"; + public String del(String encId) { + try { + encyclopediaService.delEncyclopedia(encId); + return "success"; + } catch (Exception e) { + e.printStackTrace(); + return "fail"; } + } @RequestMapping( "/toUpdate") - public String toUpdate(Integer encId, HttpServletRequest request) { + public String toUpdate(String encId, HttpServletRequest request) { Encyclopedia encyclopedia = encyclopediaService.findById(encId); diff --git a/src/main/java/com/sixteam/irs/controller/RoleController.java b/src/main/java/com/sixteam/irs/controller/RoleController.java index 78a86e8..17ae551 100644 --- a/src/main/java/com/sixteam/irs/controller/RoleController.java +++ b/src/main/java/com/sixteam/irs/controller/RoleController.java @@ -18,8 +18,7 @@ import java.util.List; @RequestMapping("/role") @RestController @CrossOrigin -@RequestMapping("/") -@RestController + public class RoleController { @Autowired private RoleService roleService; diff --git a/src/main/java/com/sixteam/irs/controller/StationResumeController.java b/src/main/java/com/sixteam/irs/controller/StationResumeController.java index e9906f3..6118384 100644 --- a/src/main/java/com/sixteam/irs/controller/StationResumeController.java +++ b/src/main/java/com/sixteam/irs/controller/StationResumeController.java @@ -44,13 +44,10 @@ public class StationResumeController { } //记录 @RequestMapping("/changeTime") - public String changeTime(StationResume stationResume){ + public String changeTime(StationResume stationResume) { Date ctime = new Date(); - String changeTime = stationResumeService.changeTime(ctime,stationResume); + String changeTime = stationResumeService.changeTime(ctime, stationResume); return changeTime; - @RequestMapping("/addDeliverresume") - public void addDeliverresume(String sId, String reId){ - int i = stationResumeService.addResume(sId, reId); } } diff --git a/src/main/java/com/sixteam/irs/entity/Encyclopedia.java b/src/main/java/com/sixteam/irs/entity/Encyclopedia.java index fa3aa1e..03d7f65 100644 --- a/src/main/java/com/sixteam/irs/entity/Encyclopedia.java +++ b/src/main/java/com/sixteam/irs/entity/Encyclopedia.java @@ -3,27 +3,16 @@ package com.sixteam.irs.entity; public class Encyclopedia { - private Integer encId; + private String encId; private String encTitle; private String encContext; private String encTime; - - @Override - public String toString() { - return "Encyclopedia{" + - "encId=" + encId + - ", encTitle='" + encTitle + '\'' + - ", encContext='" + encContext + '\'' + - ", encTime='" + encTime + '\'' + - '}'; - } - - public Integer getEncId() { + public String getEncId() { return encId; } - public void setEncId(Integer encId) { + public void setEncId(String encId) { this.encId = encId; } @@ -50,4 +39,25 @@ public class Encyclopedia { public void setEncTime(String encTime) { this.encTime = encTime; } + + public Encyclopedia(String encId, String encTitle, String encContext, String encTime) { + this.encId = encId; + this.encTitle = encTitle; + this.encContext = encContext; + this.encTime = encTime; + } + + public Encyclopedia() { + super(); + } + + @Override + public String toString() { + return "Encyclopedia{" + + "encId='" + encId + '\'' + + ", encTitle='" + encTitle + '\'' + + ", encContext='" + encContext + '\'' + + ", encTime='" + encTime + '\'' + + '}'; + } } diff --git a/src/main/java/com/sixteam/irs/mapper/EncyclopediaMapper.java b/src/main/java/com/sixteam/irs/mapper/EncyclopediaMapper.java index 54cc63b..8bf731d 100644 --- a/src/main/java/com/sixteam/irs/mapper/EncyclopediaMapper.java +++ b/src/main/java/com/sixteam/irs/mapper/EncyclopediaMapper.java @@ -13,11 +13,11 @@ public interface EncyclopediaMapper { int add(Encyclopedia encyclopedia); - int del(Integer encId); + int del(String encId); int update(Encyclopedia encyclopedia); - Encyclopedia getById(Integer encId); + Encyclopedia getById(String encId); List getAllEncyclopedias(); diff --git a/src/main/java/com/sixteam/irs/service/EncyclopediaService.java b/src/main/java/com/sixteam/irs/service/EncyclopediaService.java index 7c8262b..a4c0798 100644 --- a/src/main/java/com/sixteam/irs/service/EncyclopediaService.java +++ b/src/main/java/com/sixteam/irs/service/EncyclopediaService.java @@ -9,13 +9,11 @@ public interface EncyclopediaService { int addEncyclopedia(Encyclopedia encyclopedia); - int delEncyclopedia(Integer encId); + int delEncyclopedia(String encId); int updateEncyclopedia(Encyclopedia encyclopedia); - - - Encyclopedia findById(Integer encId); + Encyclopedia findById(String encId); List findAllEncyclopedias(); diff --git a/src/main/java/com/sixteam/irs/service/Impl/EncyclopediaServiceImpl.java b/src/main/java/com/sixteam/irs/service/Impl/EncyclopediaServiceImpl.java index 6c0cfff..d8731f2 100644 --- a/src/main/java/com/sixteam/irs/service/Impl/EncyclopediaServiceImpl.java +++ b/src/main/java/com/sixteam/irs/service/Impl/EncyclopediaServiceImpl.java @@ -1,6 +1,6 @@ package com.sixteam.irs.service.Impl; - +import com.sixteam.irs.utils.UuidUtils; import com.sixteam.irs.entity.Encyclopedia; import com.sixteam.irs.mapper.EncyclopediaMapper; import com.sixteam.irs.service.EncyclopediaService; @@ -18,11 +18,12 @@ public class EncyclopediaServiceImpl implements EncyclopediaService { @Override public int addEncyclopedia(Encyclopedia encyclopedia) { + encyclopedia.setEncId(UuidUtils.uuid()); return encyclopediamapper.add(encyclopedia); } @Override - public int delEncyclopedia(Integer encId) { + public int delEncyclopedia(String encId) { return encyclopediamapper.del(encId); } @@ -32,7 +33,7 @@ public class EncyclopediaServiceImpl implements EncyclopediaService { } @Override - public Encyclopedia findById(Integer encId) { + public Encyclopedia findById(String encId) { return encyclopediamapper.getById(encId); } diff --git a/src/main/java/com/sixteam/irs/service/Impl/StationResumeServiceImpl.java b/src/main/java/com/sixteam/irs/service/Impl/StationResumeServiceImpl.java index 8688a92..ffa67d4 100644 --- a/src/main/java/com/sixteam/irs/service/Impl/StationResumeServiceImpl.java +++ b/src/main/java/com/sixteam/irs/service/Impl/StationResumeServiceImpl.java @@ -35,10 +35,11 @@ public class StationResumeServiceImpl implements StationResumeService { @Override public String changeTime(Date ctime,StationResume stationResume) { - return stationResumeMapper.changeTime(ctime,stationResume); - public int addResume(String sId, String reId) { - String srId1 = UuidUtils.uuid(); + return stationResumeMapper.changeTime(ctime, stationResume); + } - return stationResumeMapper.addResume(srId1,sId,reId); + @Override + public int addResume(String sId, String reId) { + return 0; } } -- Gitee