| | |
| | | package com.panzhihua.westcommittee.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.interfaces.OperLog; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.util.ObjectUtils; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/setDeptAdmin") |
| | | @ApiOperation(value = "设置单位管理员", tags = {"西区纪委后台-人员管理"}) |
| | | @OperLog(operModul = "西区纪委后台",operType = 2,businessType = "设置单位管理员") |
| | | public R setDeptAdmin(@RequestParam(name = "id",value = "用户id",required = true) Integer id, @RequestParam(name = "deptId",value = "单位id",required = true) Integer deptId){ |
| | | SystemUser systemUser = systemUserService.getById(id); |
| | | if(!systemUser.getOneDepartmentId().equals(deptId)){ |
| | | return R.fail("不能设置非所属单位管理员为单位管理员"); |
| | | } |
| | | boolean update = systemUserService.update(new LambdaUpdateWrapper<SystemUser>().eq(SystemUser::getIsDeptAdmin, deptId).set(SystemUser::getIsDeptAdmin, 0)); |
| | | if(update){ |
| | | systemUser.setIsDeptAdmin(1); |
| | | systemUserService.updateById(systemUser); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("设置失败"); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/unfreeze/{id}") |
| | | @ApiOperation(value = "解冻账号", tags = {"西区纪委后台-人员管理"}) |