更新添加部门和人员的判断

This commit is contained in:
panshuling321 2022-09-27 17:30:20 +08:00
parent 3749895d5e
commit 13d082727d
7 changed files with 25 additions and 3 deletions

View File

@ -30,13 +30,14 @@ public class WorkOrderController extends BaseController {
@GetMapping("/getPage")
public TableDataInfo getOrderPage(HttpServletRequest request, Integer orderType,
String userName){
String userName, Integer status){
startPage();
LoginUser logUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>();
params.put("orderType", orderType);
params.put("userName", userName);
params.put("tenantId", logUser.getTenantId());
params.put("status", status);
return getDataTable(workOrderService.getOrderPage(params));
}

View File

@ -35,7 +35,8 @@ public class WorkUserController extends BaseController {
String userName,
String loginName,
String phone,
String email) {
String email,
Integer type) {
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
@ -50,6 +51,7 @@ public class WorkUserController extends BaseController {
params.put("loginName", loginName);
params.put("phone", phone);
params.put("email", email);
params.put("type", type);
return getDataTable(workUserService.getPage(params));
}

View File

@ -75,6 +75,13 @@ public class WorkDeptServiceImpl implements WorkDeptService {
throw new CustomException("部门已存在");
}
if(domain.getParentDeptId() != null){
XhpcWorkDeptDomain parentDeptDomain = deptMapper.selectByPrimaryKey(domain.getParentDeptId());
if(parentDeptDomain != null && !parentDeptDomain.getType().equals(domain.getType())){
throw new CustomException("部门类型与上级部门类型不一致");
}
}
return deptMapper.insert(domain) > 0;
}

View File

@ -131,6 +131,12 @@ public class WorkUserServiceImpl implements WorkUserService {
if(StringUtils.isNotNull(sysUser)){
throw new CustomException("新增用户'" + domain.getUserName() + "'失败,手机号码已存在");
}
XhpcWorkDeptDomain deptDomain = deptMapper.selectByPrimaryKey(domain.getDeptId());
if (deptDomain == null || !deptDomain.getType().equals(domain.getType())){
throw new CustomException("所属部门不存在或部门类型与人员不一致");
}
workUserMapper.insert(domain);
SysUser user = new SysUser();

View File

@ -37,7 +37,7 @@
and parent_dept_id=#{params.parentDeptId}
</if>
<if test="params.type !=null and params.type!=''">
and type=#{params.parentDeptId}
and type=#{params.type}
</if>
<choose>
<when test="params.parentDeptIds !=null and params.parentDeptIds!=''">

View File

@ -84,6 +84,9 @@
<if test="params.tenantId!=null and params.tenantId!=''">
and o.tenant_id = #{params.tenantId}
</if>
<if test="params.status!=null and params.status!=''">
and o.status = #{params.status}
</if>
GROUP BY o.work_order_id
ORDER BY o.status ASC,o.create_time desc
</select>

View File

@ -124,6 +124,9 @@
<if test="params.deptId!=null">
and (d.work_dept_id=#{params.deptId} or d.parent_dept_id=#{params.deptId})
</if>
<if test="params.type!=null and params.type!=''">
and u.type = #{params.type}
</if>
<if test="params.userName!=null and params.userName!=''">
and u.user_name like concat('%', #{params.userName}, '%')
</if>