From d701ee6d40586df023e0ac012c15e5c115e39deb Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Wed, 12 Aug 2020 17:02:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CustomerController.java | 25 +++++++++++++++++++ .../liuwanr/controller/UserController.java | 6 ++--- .../java/com/yipin/liuwanr/entity/School.java | 21 ++++++++++++++++ .../yipin/liuwanr/mapper/CustomerMapper.java | 15 +++++------ .../liuwanr/service/CustomerService.java | 17 ++++++++++++- 5 files changed, 73 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/CustomerController.java b/src/main/java/com/yipin/liuwanr/controller/CustomerController.java index 7509eeb..a74cfd9 100644 --- a/src/main/java/com/yipin/liuwanr/controller/CustomerController.java +++ b/src/main/java/com/yipin/liuwanr/controller/CustomerController.java @@ -2,6 +2,7 @@ package com.yipin.liuwanr.controller; import java.util.HashMap; +import com.yipin.liuwanr.entity.School; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; @@ -240,4 +241,28 @@ public class CustomerController { } return resp; } + + /** + * 查询学校 + */ + @GetMapping("/querySchool") + Response querySchool(@RequestParam String schoolName) { + Response resp = new Response(); + School school = new School(); + if (schoolName!=null||schoolName!=""){ + school.setSchoolName(schoolName); + } + HashMap ret = customerService.querySchool(school); + resp.setStatus(200); + resp.setErrmessage("Parameter effective"); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/controller/UserController.java b/src/main/java/com/yipin/liuwanr/controller/UserController.java index d9a01b4..59d816d 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserController.java @@ -182,7 +182,7 @@ public class UserController { throw new RuntimeException(); } } - if(accountRole == 3){ + if(accountRole == 3||accountRole==2){ HashMap sta = staffService.addStaff(staff); int staStatus = (int) sta.get("retcode"); if (staStatus == 200){ @@ -286,7 +286,7 @@ public class UserController { if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); - if (roleId==3){ + if (roleId==3||roleId==2){ HashMap sta = userService.deleteStaff(user); int staStatus = (int) ret.get("retcode"); if (200 == staStatus) { @@ -345,7 +345,7 @@ public class UserController { if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); - if (roleId ==3){ + if (roleId ==3||roleId==2){ HashMap sta = userService.updateStaff(staff); int staStatus = (int) sta.get("retcode"); if (200 == status) { diff --git a/src/main/java/com/yipin/liuwanr/entity/School.java b/src/main/java/com/yipin/liuwanr/entity/School.java index 8a69552..7159863 100644 --- a/src/main/java/com/yipin/liuwanr/entity/School.java +++ b/src/main/java/com/yipin/liuwanr/entity/School.java @@ -8,10 +8,31 @@ public class School { private String schoolName; //省份 private Integer provinceId; + //省份名称 + private String provinceName; //城市 private Integer cityId; + //城市名称 + private String cityName; //层次 private Integer level; + + public String getProvinceName() { + return provinceName; + } + + public void setProvinceName(String provinceName) { + this.provinceName = provinceName; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + public Integer getSchoolId() { return schoolId; } diff --git a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java index cea7246..c4e8114 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java @@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper; import java.util.List; +import com.yipin.liuwanr.entity.*; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Many; import org.apache.ibatis.annotations.One; @@ -10,12 +11,6 @@ import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; -import com.yipin.liuwanr.entity.ContractInformation; -import com.yipin.liuwanr.entity.CoursePermissions; -import com.yipin.liuwanr.entity.Customer; -import com.yipin.liuwanr.entity.Industry; -import com.yipin.liuwanr.entity.IndustryClass; -import com.yipin.liuwanr.entity.UserM; import com.yipin.liuwanr.vo.CustomerVO; public interface CustomerMapper { @@ -90,5 +85,11 @@ public interface CustomerMapper { "SELECT industryId,industryClassId,industryName from hr_industry where industryClassId = #{industryClassId}", " "}) List queryCustomerIndustry(Integer industryClassId); - + + //查询行业 + @Select({" "}) + List querySchool(School school); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/service/CustomerService.java b/src/main/java/com/yipin/liuwanr/service/CustomerService.java index fc490a5..1ab5b19 100644 --- a/src/main/java/com/yipin/liuwanr/service/CustomerService.java +++ b/src/main/java/com/yipin/liuwanr/service/CustomerService.java @@ -3,6 +3,7 @@ package com.yipin.liuwanr.service; import java.util.HashMap; import java.util.List; +import com.yipin.liuwanr.entity.School; import org.jboss.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -165,5 +166,19 @@ public class CustomerService { } return resp; } - + + //查询学校 + public HashMap querySchool(School school){ + HashMap resp = new HashMap(); + try { + resp.put("retvalue", customerMapper.querySchool(school)); + resp.put("retcode", 200); + } catch (RuntimeException e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "查询学校失败!"); + return resp; + } + return resp; + } }