From ba08009eac6103242cb0c527502148cff78596ea Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Wed, 20 Jan 2021 10:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DgProcessUserController.java | 27 +++---------------- .../impl/DgProcessUserServiceImpl.java | 6 +++++ .../hrms/controller/RoleController.java | 21 +++++---------- .../daqing/financial/hrms/dao/RoleDao.java | 2 +- .../financial/hrms/service/RoleService.java | 2 -- .../hrms/service/impl/RoleServiceImpl.java | 7 ++--- .../main/resources/mapper/hrms/RoleDao.xml | 2 +- 7 files changed, 20 insertions(+), 47 deletions(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java index 5e292c4c..a006a47a 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java @@ -41,8 +41,6 @@ public class DgProcessUserController { @Autowired private HrmsFeignService hrmsFeignService; - @Autowired - private IDgProcessManageService processManageService; @ApiOperation("根据进程id查询抄送用户") @GetMapping("/queryCopySendUser") @@ -72,30 +70,11 @@ public class DgProcessUserController { return R.ok().data("userList",list); } - @ApiOperation("添加流程的抄送用户") - @PostMapping("/addCopySendUser") - public R addCopySendUser(@RequestBody CopySendUserRequest copySendUserRequest){ + @ApiOperation("更新流程的抄送用户") + @PostMapping("/updateCopySendUser") + public R updateCopySendUser(@RequestBody CopySendUserRequest copySendUserRequest){ boolean save = processUserService.saveCopySendUser(copySendUserRequest); return save ? R.ok() : R.error(); } - @ApiOperation(value = "删除流程的抄送用户") - @PostMapping("removeCopySendUser") - public R removeCopySendUser( - @ApiParam(name = "processId", value = "进程id", required = true) - @RequestParam("processId") String processId, - @ApiParam(name = "userId", value = "用户id", required = true) - @RequestParam("userId") String userId){ - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("process_id",processId).eq("user_id",userId); - boolean remove = processUserService.remove(wrapper); - //更新流程管理的更新时间 - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id",processId); - DgProcessManage processManage = new DgProcessManage(); - processManage.setUpdateTime(new Date()); - processManageService.update(processManage,updateWrapper); - return remove ? R.ok() : R.error(); - } - } diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java index 0a7cfb61..92408507 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java @@ -1,5 +1,6 @@ package com.daqing.financial.guarantee.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.daqing.financial.guarantee.mapper.DgProcessManageMapper; import com.daqing.financial.guarantee.mapper.DgProcessUserMapper; @@ -31,6 +32,11 @@ public class DgProcessUserServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq("process_id",processId); + baseMapper.delete(wrapper); + List userIds = copySendUserRequest.getUserIds(); userIds.forEach(userId -> { DgProcessUser processUser = new DgProcessUser(); diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java index 8fe223e8..6015a503 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java @@ -102,22 +102,15 @@ public class RoleController { return ResponseResult.SUCCESS(employees); } - @ApiOperation(value = "保存用户角色") - @PostMapping("saveUserRole") - public ResponseResult saveUserRole(@RequestBody UserRoleVO userRoleVO){ + @ApiOperation(value = "更新用户角色") + @PostMapping("updateUserRole") + public ResponseResult updateUserRole(@RequestBody UserRoleVO userRoleVO){ + List userIds = userRoleVO.getUserIds(); + if (userIds.size()==0){ + return ResponseResult.FAIL(20000,"不能不选择用户"); + } boolean save = roleService.saveUserRole(userRoleVO); return ResponseResult.SUCCESS(save); } - @ApiOperation(value = "删除用户角色") - @PostMapping("removeUserRole") - public ResponseResult removeUserRole( - @ApiParam(name = "roleId", value = "角色id", required = true) - @RequestParam("roleId") String roleId, - @ApiParam(name = "userId", value = "用户id", required = true) - @RequestParam("userId") String userId){ - boolean remove = roleService.removeUserRole(roleId,userId); - return ResponseResult.SUCCESS(remove); - } - } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java index 9a07633c..172a5f18 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java @@ -25,5 +25,5 @@ public interface RoleDao extends BaseMapper { void saveUserRole(@Param("roleId") String roleId,@Param("userId") String userId); - int removeUserRole(@Param("roleId") String roleId,@Param("userId") String userId); + int removeUserRole(@Param("roleId") String roleId); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java index c84a826f..0baa2ee6 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java @@ -24,7 +24,5 @@ public interface RoleService extends IService { boolean saveUserRole(UserRoleVO userRoleVO); - boolean removeUserRole(String roleId, String userId); - } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java index 90160e42..72eb962a 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java @@ -38,6 +38,8 @@ public class RoleServiceImpl extends ServiceImpl implements @Override public boolean saveUserRole(UserRoleVO userRoleVO) { String roleId = userRoleVO.getRoleId(); + baseMapper.removeUserRole(roleId); + List userIds = userRoleVO.getUserIds(); userIds.forEach(userId -> { baseMapper.saveUserRole(roleId,userId); @@ -45,9 +47,4 @@ public class RoleServiceImpl extends ServiceImpl implements return true; } - @Override - public boolean removeUserRole(String roleId, String userId) { - int remove = baseMapper.removeUserRole(roleId,userId); - return remove>0; - } } \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml index 81dbebb4..83b79342 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml @@ -17,7 +17,7 @@ - DELETE FROM hrms_employee_role WHERE user_id = #{userId} and role_id = #{roleId} + DELETE FROM hrms_employee_role WHERE role_id = #{roleId}