|
|
@@ -1,7 +1,6 @@
|
|
|
package com.xunmei.system.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.xunmei.common.core.constant.UserConstants;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
import com.xunmei.common.core.web.controller.BaseController;
|
|
|
import com.xunmei.common.core.web.domain.AjaxResult;
|
|
|
@@ -9,7 +8,6 @@ import com.xunmei.common.log.annotation.Log;
|
|
|
import com.xunmei.common.log.enums.BusinessType;
|
|
|
import com.xunmei.common.security.annotation.RequiresPermissions;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
-import com.xunmei.system.api.domain.SysDept;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import com.xunmei.system.api.domain.SysUser;
|
|
|
import com.xunmei.system.service.ISysDeptService;
|
|
|
@@ -46,7 +44,12 @@ public class SysDeptController extends BaseController
|
|
|
@GetMapping("/list")
|
|
|
public AjaxResult list(SysOrg dept)
|
|
|
{
|
|
|
- List<SysOrg> depts = orgService.list(new QueryWrapper<>(dept));
|
|
|
+ QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>(dept);
|
|
|
+ if (StringUtils.isNotNull(dept.getName())){
|
|
|
+ queryWrapper.like("name",dept.getName());
|
|
|
+ dept.setName(null);
|
|
|
+ }
|
|
|
+ List<SysOrg> depts = orgService.list(queryWrapper);
|
|
|
return success(depts);
|
|
|
}
|
|
|
|
|
|
@@ -101,11 +104,12 @@ public class SysDeptController extends BaseController
|
|
|
{
|
|
|
Long deptId = dept.getId();
|
|
|
// deptService.checkDeptDataScope(deptId);
|
|
|
- if (orgService.list(new QueryWrapper<SysOrg>().eq("name",dept.getName()).eq("deleted",0L)).size()>0)
|
|
|
+ if (orgService.list(new QueryWrapper<SysOrg>().eq("name",dept.getName()).eq("deleted",0L)).size()>1)
|
|
|
{
|
|
|
return error("修改部门'" + dept.getName() + "'失败,部门名称已存在");
|
|
|
}
|
|
|
- else if (dept.getParentId().equals(deptId))
|
|
|
+ else
|
|
|
+ if (dept.getParentId().equals(deptId))
|
|
|
{
|
|
|
return error("修改部门'" + dept.getName() + "'失败,上级部门不能是自己");
|
|
|
}
|
|
|
@@ -115,7 +119,7 @@ public class SysDeptController extends BaseController
|
|
|
// }
|
|
|
dept.setUpdateBy(SecurityUtils.getUsername());
|
|
|
dept.setUpdateTime(new Date());
|
|
|
- return toAjax(orgService.update(new QueryWrapper<>(dept)));
|
|
|
+ return toAjax(orgService.updateById(dept));
|
|
|
}
|
|
|
|
|
|
/**
|