| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.panzhihua.common.interfaces.OperLog; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.model.Department; |
| | | import com.panzhihua.sangeshenbian.model.SystemUser; |
| | | import com.panzhihua.sangeshenbian.model.entity.Department; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUser; |
| | | import com.panzhihua.sangeshenbian.service.IDepartmentService; |
| | | import com.panzhihua.sangeshenbian.service.ISystemUserService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | if(null == department.getPid()){ |
| | | department.setPid(0); |
| | | } |
| | | int count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()).eq(Department::getName, department.getName())); |
| | | long count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()).eq(Department::getName, department.getName())); |
| | | if(0 < count){ |
| | | return R.fail("单位名称重复。"); |
| | | } |
| | |
| | | if(null == department.getPid()){ |
| | | department.setPid(0); |
| | | } |
| | | int count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()) |
| | | long count = departmentService.count(new LambdaQueryWrapper<Department>().eq(Department::getPid, department.getPid()) |
| | | .eq(Department::getName, department.getName()).ne(Department::getId, department.getId())); |
| | | if(0 < count){ |
| | | return R.fail("单位名称重复。"); |
| | |
| | | @ApiOperation(value = "删除单位信息", tags = {"三个身边后台-用户管理"}) |
| | | @OperLog(operModul = "三个身边后台",operType = 3, businessType = "删除单位信息") |
| | | public R delete(@PathVariable("id") Integer id){ |
| | | int count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getOneDepartmentId, id).or().eq(SystemUser::getTwoDepartmentId, id) |
| | | long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getOneDepartmentId, id).or().eq(SystemUser::getTwoDepartmentId, id) |
| | | .or().eq(SystemUser::getThreeDepartmentId, id).or().eq(SystemUser::getFourDepartmentId, id).ne(SystemUser::getStatus, 3)); |
| | | if(0 < count){ |
| | | return R.fail("该单位已被使用,删除失败。"); |