diff --git a/src/main/java/com/sixteam/irs/controller/EnterpriseController.java b/src/main/java/com/sixteam/irs/controller/EnterpriseController.java index 18f3b9105ce4d4dace335b0b8f60b5fe483abc0d..37617c173d7924f7a2fa022afff9cde765011ddd 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 0d222069090e0236f3f479786e94cb1a8fda0602..7436df9a67d5c7b1a2220bd851ccdd5d1be5d61b 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 3e7870a41c237e752c643ce01a57105dc5dc61fd..d6a6fba1cd86396cf25909a0c9de8538a28ef024 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 6fdff042486a1b493eec15c24ec8c7d9ed695b1b..6c060746a60fb4366b4d1df4f69d4e8065d5034b 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 1d20a00dffb3e1db19c03c8ae1f00e6a37d7c6df..1e3bfb71706b455be6a50fae391f6a009c0d9abc 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 d33b9b96022e2ca7efa12c350aa9fef5baff00ca..986aa49e6e1bf98891c6cb533d08b56337d67917 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 b57090f12a4c96cd5b725a2dd8fe48a26460dfb4..bd67e113556b9093efe92f7fa9734582ad2e7b91 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 4c1350adf02c9ec636d4f493ca5f4f0ab23d9267..46d0408fbf901a3bd93f5f01e0b3b74eaa4c3fbd 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 0000000000000000000000000000000000000000..29bb3d27467b62a46aa8e525a3f41f5bdfa36cd3 --- /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 ca6f9a194a1e0eb0c8727c49026b6a3f81188d77..3da8aba09a3076805c8b07ad63a1e08bf1a9532b 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,11 @@

用户首页

岗位列表 + + + 作为企业查看自己的岗位列表 + 作为企业查看自己的岗位列表 + 作为企业查看自己的岗位列表作为企业查看自己的岗位列表 + \ No newline at end of file