From cf885fd8de8a68dc5481577bf852e55b99258bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E6=98=A5=E4=B8=81?= <‘786927092@qq.com’> Date: Wed, 17 Aug 2022 19:09:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=83=9D=E6=98=A5=E4=B8=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../irs/controller/EnterpriseController.java | 2 +- .../irs/controller/StationController.java | 40 ++++++++--- .../com/sixteam/irs/mapper/StationMapper.java | 6 +- .../irs/service/Impl/StationServiceImpl.java | 5 ++ .../sixteam/irs/service/StationService.java | 4 +- src/main/resources/application.yml | 2 +- .../com/sixteam/irs/mapper/StationMapper.xml | 13 +++- ...\344\275\215\345\210\227\350\241\250.html" | 54 ++++++++++++++- ...\345\212\240\345\262\227\344\275\215.html" | 67 +++++++++++++++++++ ...\346\210\267\351\246\226\351\241\265.html" | 3 + 10 files changed, 176 insertions(+), 20 deletions(-) create mode 100644 "src/main/resources/templates/test/station/\346\267\273\345\212\240\345\262\227\344\275\215.html" diff --git a/src/main/java/com/sixteam/irs/controller/EnterpriseController.java b/src/main/java/com/sixteam/irs/controller/EnterpriseController.java index 18f3b91..37617c1 100644 --- a/src/main/java/com/sixteam/irs/controller/EnterpriseController.java +++ b/src/main/java/com/sixteam/irs/controller/EnterpriseController.java @@ -35,7 +35,7 @@ public class EnterpriseController { } @RequestMapping("/addEnterprise") - public void addEnterprise(Enterprise enterprise,HttpServletRequest request){ + public String addEnterprise(Enterprise enterprise,HttpServletRequest request){ int res=enterpriseService.addEnterprise(enterprise); if (res>0) { System.out.println("添加企业成功"); diff --git a/src/main/java/com/sixteam/irs/controller/StationController.java b/src/main/java/com/sixteam/irs/controller/StationController.java index 0d22206..7436df9 100644 --- a/src/main/java/com/sixteam/irs/controller/StationController.java +++ b/src/main/java/com/sixteam/irs/controller/StationController.java @@ -3,14 +3,13 @@ package com.sixteam.irs.controller; import com.sixteam.irs.entity.Station; import com.sixteam.irs.service.StationService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.util.List; -@RestController +@Controller @RequestMapping("/station") public class StationController { @Autowired @@ -33,14 +32,21 @@ public class StationController { System.out.println(getAllSAE); return getAllSAE; } + @RequestMapping("/toAddStation") + public String toAddStation(){ + return "/test/station/添加岗位.html"; + } @RequestMapping("/addStation") - public void addStation(Station station,HttpServletRequest request){ + public String addStation(Station station,HttpServletRequest request){ int res=stationService.addStation(station); if (res>0) { System.out.println("添加企业成功"); + return "/test/station/getAllStation"; }else { System.out.println("添加企业失败"); + request.setAttribute("errorMessage", "添加错误"); + return "/test/错误页面"; } } //修改 @@ -48,22 +54,38 @@ public class StationController { public void updateStation(Station station,HttpServletRequest request) { int i = stationService.updateStation(station); if(i>0){ - System.out.println("修改企业成功"); + System.out.println("修改岗位成功"); }else { - System.out.println("修改企业失败"); + System.out.println("修改岗位失败"); } } //按名称查询 @RequestMapping("/stationName") public String findStationByName(String stationName,HttpServletRequest request) { List findStationByName = stationService.findStationByName(stationName); - if (findStationByName!=null){ + if (findStationByName!=null && findStationByName.size()>0){ request.setAttribute("findStationByName",findStationByName); System.out.println("模糊查询成功"+findStationByName); - return "findStationByName"; + return "/test/station/findStationByName"; + }else{ + request.setAttribute("errorMessage", "查询不到该关键字"); + return "/test/错误页面"; + } + } + //通过企业id查询企业的岗位 + @RequestMapping("/findStationById") + public String findStationById(String stationId,HttpServletRequest request) { + + String eid = "1"; + List findStationByEIdlist = stationService.findStationByEId(eid); + if (findStationByEIdlist != null && findStationByEIdlist.size()>0){ + request.setAttribute("findStationByEIdlist",findStationByEIdlist); + System.out.println("模糊查询成功"+findStationByEIdlist); + return "/test/station/企业的岗位列表"; }else{ System.out.println("模糊查询失败"); - return null; + request.setAttribute("errorMessage", "查询不到该企业ID"); + return "/test/错误页面"; } } } diff --git a/src/main/java/com/sixteam/irs/mapper/StationMapper.java b/src/main/java/com/sixteam/irs/mapper/StationMapper.java index 3e7870a..d6a6fba 100644 --- a/src/main/java/com/sixteam/irs/mapper/StationMapper.java +++ b/src/main/java/com/sixteam/irs/mapper/StationMapper.java @@ -12,9 +12,9 @@ public interface StationMapper { //查询岗位 @Select("select * from irs_station") List getAllStation(); - //查询岗位且企业 + //添加 @Insert("INSERT INTO irs_station(s_id,s_name,s_wages,s_work,s_department,s_number,s_education,s_workdays,s_subsidy,s_gold)" + - " VALUES ('2','软件测试','6000-10000元/月','测试代码运维','测试部门','5','硕士','5天/周','有生活补助','有五险一金')") + " VALUES (#{sId},#{sName},#{sWages},#{sWork},#{sDepartment},#{sNumber},#{sEducation},#{sWorkdays},#{sSubsidy},#{sGold})") int addStation(Station station); @Update("update irs_station set s_name=#{sName},s_wages=#{sWages},s_work=#{sWork},s_department=#{sDepartment},s_number=#{sNumber},s_education=#{sEducation},s_workdays=#{sWorkdays},s_subsidy=#{sSubsidy},s_gold=#{sGold} where s_id = 1") @@ -23,4 +23,6 @@ public interface StationMapper { List getAllSAE(); //模糊查岗位名 List findStationByName(String stationName); + //通过企业id查询企业的岗位 + List findStationByEId(String eid); } diff --git a/src/main/java/com/sixteam/irs/service/Impl/StationServiceImpl.java b/src/main/java/com/sixteam/irs/service/Impl/StationServiceImpl.java index 6fdff04..6c06074 100644 --- a/src/main/java/com/sixteam/irs/service/Impl/StationServiceImpl.java +++ b/src/main/java/com/sixteam/irs/service/Impl/StationServiceImpl.java @@ -38,4 +38,9 @@ public class StationServiceImpl implements StationService { public List findStationByName(String stationName) { return stationMapper.findStationByName(stationName); } + //通过企业id查询企业的岗位 + @Override + public List findStationByEId(String eid) { + return stationMapper.findStationByEId(eid); + } } diff --git a/src/main/java/com/sixteam/irs/service/StationService.java b/src/main/java/com/sixteam/irs/service/StationService.java index 1d20a00..1e3bfb7 100644 --- a/src/main/java/com/sixteam/irs/service/StationService.java +++ b/src/main/java/com/sixteam/irs/service/StationService.java @@ -14,6 +14,6 @@ public interface StationService { List getAllSAE(); //模糊查岗位 List findStationByName(String stationName); - - + //通过企业id查询企业的岗位 + List findStationByEId(String eid); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d33b9b9..986aa49 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -4,7 +4,7 @@ spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://49.232.158.16:3306/irs?serverTimezone=UTC - username: irsYH + username: irsHCD password: 666 thymeleaf: diff --git a/src/main/resources/com/sixteam/irs/mapper/StationMapper.xml b/src/main/resources/com/sixteam/irs/mapper/StationMapper.xml index b57090f..bd67e11 100644 --- a/src/main/resources/com/sixteam/irs/mapper/StationMapper.xml +++ b/src/main/resources/com/sixteam/irs/mapper/StationMapper.xml @@ -32,9 +32,18 @@ + + + diff --git "a/src/main/resources/templates/test/station/\344\274\201\344\270\232\347\232\204\345\262\227\344\275\215\345\210\227\350\241\250.html" "b/src/main/resources/templates/test/station/\344\274\201\344\270\232\347\232\204\345\262\227\344\275\215\345\210\227\350\241\250.html" index 4c1350a..46d0408 100644 --- "a/src/main/resources/templates/test/station/\344\274\201\344\270\232\347\232\204\345\262\227\344\275\215\345\210\227\350\241\250.html" +++ "b/src/main/resources/templates/test/station/\344\274\201\344\270\232\347\232\204\345\262\227\344\275\215\345\210\227\350\241\250.html" @@ -1,13 +1,61 @@ - + 企业的岗位列表

根据企业显示岗位的所有数据

- 添加 -

序号

岗位数据

公司名称

操作:删除修改

+

传递ID

+

操作: 删除 + 修改

+
+ 添加岗位 + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+ + 序号岗位名岗位工资岗位工作部门名岗位所需人数学历要求工作天数生活补助五险一金所属企业操作
+ + + 删除用户 + 修改用户 +
\ No newline at end of file diff --git "a/src/main/resources/templates/test/station/\346\267\273\345\212\240\345\262\227\344\275\215.html" "b/src/main/resources/templates/test/station/\346\267\273\345\212\240\345\262\227\344\275\215.html" new file mode 100644 index 0000000..29bb3d2 --- /dev/null +++ "b/src/main/resources/templates/test/station/\346\267\273\345\212\240\345\262\227\344\275\215.html" @@ -0,0 +1,67 @@ + + + + + 添加企业岗位 + + +

添加岗位的页面

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ + + + + \ No newline at end of file diff --git "a/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" "b/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" index ca6f9a1..4863eda 100644 --- "a/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" +++ "b/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" @@ -7,5 +7,8 @@

用户首页

岗位列表 + + + 作为企业查看自己的岗位列表 \ No newline at end of file -- Gitee From 7e5254598b9e44946e81495ffb782c4c1c6c134f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E6=98=A5=E4=B8=81?= <‘786927092@qq.com’> Date: Wed, 17 Aug 2022 19:25:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=83=9D=E6=98=A5=E4=B8=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\224\250\346\210\267\351\246\226\351\241\265.html" | 3 +++ 1 file changed, 3 insertions(+) diff --git "a/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" "b/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" index 4863eda..3da8aba 100644 --- "a/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" +++ "b/src/main/resources/templates/test/user/\347\224\250\346\210\267\351\246\226\351\241\265.html" @@ -10,5 +10,8 @@ 作为企业查看自己的岗位列表 + 作为企业查看自己的岗位列表 + 作为企业查看自己的岗位列表作为企业查看自己的岗位列表 + \ No newline at end of file -- Gitee