优化接口

master
chen 4 years ago
parent 02de2d7817
commit ba08009eac
  1. 27
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgProcessUserController.java
  2. 6
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgProcessUserServiceImpl.java
  3. 21
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/RoleController.java
  4. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/RoleDao.java
  5. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/RoleService.java
  6. 7
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/RoleServiceImpl.java
  7. 2
      dq-financial-hrms/src/main/resources/mapper/hrms/RoleDao.xml

@ -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<DgProcessUser> wrapper = new QueryWrapper<>();
wrapper.eq("process_id",processId).eq("user_id",userId);
boolean remove = processUserService.remove(wrapper);
//更新流程管理的更新时间
UpdateWrapper<DgProcessManage> 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();
}
}

@ -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<DgProcessUserMapper, D
@Override
public boolean saveCopySendUser(CopySendUserRequest copySendUserRequest) {
Integer processId = copySendUserRequest.getProcessId();
QueryWrapper<DgProcessUser> wrapper = new QueryWrapper<>();
wrapper.eq("process_id",processId);
baseMapper.delete(wrapper);
List<Integer> userIds = copySendUserRequest.getUserIds();
userIds.forEach(userId -> {
DgProcessUser processUser = new DgProcessUser();

@ -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<String> 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);
}
}

@ -25,5 +25,5 @@ public interface RoleDao extends BaseMapper<RoleEntity> {
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);
}

@ -24,7 +24,5 @@ public interface RoleService extends IService<RoleEntity> {
boolean saveUserRole(UserRoleVO userRoleVO);
boolean removeUserRole(String roleId, String userId);
}

@ -38,6 +38,8 @@ public class RoleServiceImpl extends ServiceImpl<RoleDao, RoleEntity> implements
@Override
public boolean saveUserRole(UserRoleVO userRoleVO) {
String roleId = userRoleVO.getRoleId();
baseMapper.removeUserRole(roleId);
List<String> userIds = userRoleVO.getUserIds();
userIds.forEach(userId -> {
baseMapper.saveUserRole(roleId,userId);
@ -45,9 +47,4 @@ public class RoleServiceImpl extends ServiceImpl<RoleDao, RoleEntity> implements
return true;
}
@Override
public boolean removeUserRole(String roleId, String userId) {
int remove = baseMapper.removeUserRole(roleId,userId);
return remove>0;
}
}

@ -17,7 +17,7 @@
</insert>
<delete id="removeUserRole">
DELETE FROM hrms_employee_role WHERE user_id = #{userId} and role_id = #{roleId}
DELETE FROM hrms_employee_role WHERE role_id = #{roleId}
</delete>
<select id="listRoleIdAndName" resultType="com.daqing.framework.domain.hrms.ext.RoleVO">

Loading…
Cancel
Save