From 96712cfb23b9daf7bc71d9752d49c197dce86b1f Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Thu, 20 May 2021 17:52:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StaffGradeController.java | 11 ++++++++- .../liuwanr/mapper/StaffGradeMapper.java | 12 +++++++++- .../liuwanr/service/StaffGradeService.java | 24 ++++++++++++++++--- .../liuwanr/service/StaffGradServiceTest.java | 18 +++++++------- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/StaffGradeController.java b/src/main/java/com/yipin/liuwanr/controller/StaffGradeController.java index 0e170fd..744ac20 100644 --- a/src/main/java/com/yipin/liuwanr/controller/StaffGradeController.java +++ b/src/main/java/com/yipin/liuwanr/controller/StaffGradeController.java @@ -1,6 +1,7 @@ package com.yipin.liuwanr.controller; import java.util.HashMap; +import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; @@ -103,11 +104,19 @@ public class StaffGradeController { Response deleteStaffGrade(@RequestBody StaffGrade staffGrade) { Response resp = new Response(); Integer staffGradeId = staffGrade.getStaffGradeId(); + HashMap ret = new HashMap<>(); if (staffGradeId==null) { resp.setStatus(300); resp.setErrmessage("Parameter Invalid"); } else { - HashMap ret = staffGradeService.deleteStaffGrade(staffGradeId); + List userIds = staffGradeService.queryUserIdsByGradeId(staffGradeId); + if(userIds.size()>0){ + ret = staffGradeService.deleteStaffGrade(userIds); + ret = staffGradeService.deleteStaffGradePs(staffGradeId); + }else{//如果组织架构下面没有员工,则只删除组织架构 + ret = staffGradeService.deleteStaffGradePs(staffGradeId); + } + int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/mapper/StaffGradeMapper.java b/src/main/java/com/yipin/liuwanr/mapper/StaffGradeMapper.java index aaeef71..df85618 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/StaffGradeMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/StaffGradeMapper.java @@ -21,8 +21,15 @@ public interface StaffGradeMapper { " "}) List queryStaffGrade(Integer staffProfessionalArchitectureId); +// @Update("UPDATE staff_grade SET isdel = 1 where staffGradeId = #{staffGradeId}") + @Update("UPDATE staff s,hr_user_info u SET s.isdel = 1,u.isdel = 1 WHERE s.userId = u.userId AND s.userId IN" + + "(" + + "#{userId}" + + ")") + void deleteStaffGrade(List userIds); + @Update("UPDATE staff_grade SET isdel = 1 where staffGradeId = #{staffGradeId}") - void deleteStaffGrade(Integer staffGradeId); + void deleteStaffGradePs(Integer staffGradeId); @Select({"