|
@ -188,6 +188,11 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addDepartment(ManagementDto.AddDepartment param, Long userId) { |
|
|
public void addDepartment(ManagementDto.AddDepartment param, Long userId) { |
|
|
|
|
|
//同级之下部门名称不可重复
|
|
|
|
|
|
Integer repeat = departmentDao.queryNameRepeat(param.getParentId(),param.getDepartmentName(),param.getOid()); |
|
|
|
|
|
if (1 <= repeat) { |
|
|
|
|
|
throw new BaseException(DefaultCodeError.DEPARTMENT_NAME_REPEAT); |
|
|
|
|
|
} |
|
|
OrganizationDepartment department = new OrganizationDepartment(); |
|
|
OrganizationDepartment department = new OrganizationDepartment(); |
|
|
department.setId(snowflake.nextId()); |
|
|
department.setId(snowflake.nextId()); |
|
|
department.setName(param.getDepartmentName()); |
|
|
department.setName(param.getDepartmentName()); |
|
@ -206,6 +211,11 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateDepartment(ManagementDto.UpdateDepartment param, Long userId) { |
|
|
public void updateDepartment(ManagementDto.UpdateDepartment param, Long userId) { |
|
|
|
|
|
//同级之下部门名称不可重复
|
|
|
|
|
|
Integer repeat = departmentDao.queryNameRepeatUpdate(param.getDid(),param.getDepartmentName(),param.getOid()); |
|
|
|
|
|
if (1 <= repeat) { |
|
|
|
|
|
throw new BaseException(DefaultCodeError.DEPARTMENT_NAME_REPEAT); |
|
|
|
|
|
} |
|
|
OrganizationDepartment department = new OrganizationDepartment(); |
|
|
OrganizationDepartment department = new OrganizationDepartment(); |
|
|
department.setId(param.getDid()); |
|
|
department.setId(param.getDid()); |
|
|
department.setName(param.getDepartmentName()); |
|
|
department.setName(param.getDepartmentName()); |
|
@ -241,6 +251,11 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addPosition(ManagementDto.AddPosition param, Long userId) { |
|
|
public void addPosition(ManagementDto.AddPosition param, Long userId) { |
|
|
|
|
|
//同级之下 职位名称不可重复
|
|
|
|
|
|
Integer repeat = positionDao.queryNameRepeat(param.getDepartmentId(),param.getPositionName()); |
|
|
|
|
|
if (1 <= repeat) { |
|
|
|
|
|
throw new BaseException(DefaultCodeError.POSITION_NAME_REPEAT); |
|
|
|
|
|
} |
|
|
OrganizationPosition position = new OrganizationPosition(); |
|
|
OrganizationPosition position = new OrganizationPosition(); |
|
|
position.setId(snowflake.nextId()); |
|
|
position.setId(snowflake.nextId()); |
|
|
position.setName(param.getPositionName()); |
|
|
position.setName(param.getPositionName()); |
|
@ -267,6 +282,12 @@ public class ManagementService implements IManagementService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updatePosition(ManagementDto.UpdatePosition param, Long userId) { |
|
|
public void updatePosition(ManagementDto.UpdatePosition param, Long userId) { |
|
|
|
|
|
//同级之下 职位名称不可重复
|
|
|
|
|
|
Integer repeat = positionDao.queryNameRepeat(param.getDepartmentId(),param.getPositionName()); |
|
|
|
|
|
if (1 <= repeat) { |
|
|
|
|
|
throw new BaseException(DefaultCodeError.POSITION_NAME_REPEAT); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
OrganizationPosition position = new OrganizationPosition(); |
|
|
OrganizationPosition position = new OrganizationPosition(); |
|
|
position.setId(param.getPositionId()); |
|
|
position.setId(param.getPositionId()); |
|
|
position.setRoleName(param.getPositionName()); |
|
|
position.setRoleName(param.getPositionName()); |
|
@ -317,6 +338,12 @@ public class ManagementService implements IManagementService { |
|
|
positionTypeRelationList.add(positionTypeRelation); |
|
|
positionTypeRelationList.add(positionTypeRelation); |
|
|
} |
|
|
} |
|
|
positionTypeRelationDao.bindRole(positionTypeRelationList); |
|
|
positionTypeRelationDao.bindRole(positionTypeRelationList); |
|
|
|
|
|
}else { |
|
|
|
|
|
OrganizationPositionTypeRelationExample positionTypeRelationExample = new OrganizationPositionTypeRelationExample(); |
|
|
|
|
|
positionTypeRelationExample.createCriteria().andPositionIdEqualTo(param.getPositionId()); |
|
|
|
|
|
OrganizationPositionTypeRelation positionTypeRelation = new OrganizationPositionTypeRelation(); |
|
|
|
|
|
positionTypeRelation.setRecStatus((byte) 2); |
|
|
|
|
|
positionTypeRelationDao.updateByExampleSelective(positionTypeRelation,positionTypeRelationExample); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|