修改 新增工厂时 判断新增的工厂类型为工厂时 再同步新增对应部门

This commit is contained in:
furongxin 2024-06-24 11:28:41 +08:00
parent 23a801ec69
commit fd0cf751ae

View File

@ -59,14 +59,18 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
FactoryInfoDO factoryInfo = BeanUtils.toBean(createReqVO, FactoryInfoDO.class);
factoryInfoMapper.insert(factoryInfo);
//同步插入对应 生产部的下级部门
DeptRespDTO deptRespDTO = new DeptRespDTO();
deptRespDTO.setFactoryId(factoryInfo.getId());
deptRespDTO.setName(createReqVO.getShortName());
deptRespDTO.setParentId(130L); //这里设置上级部门为 生产部
deptRespDTO.setLeaderUserId(createReqVO.getLeaderUserId());
deptRespDTO.setStatus(CommonStatusEnum.ENABLE.getStatus());
deptApi.createDept(deptRespDTO);
// 新增的为工厂类型时
if ("3".equals(createReqVO.getType())) {
//同步插入对应 生产部的下级部门
DeptRespDTO deptRespDTO = new DeptRespDTO();
deptRespDTO.setFactoryId(factoryInfo.getId());
deptRespDTO.setName(createReqVO.getShortName());
deptRespDTO.setParentId(130L); //这里设置上级部门为 生产部
deptRespDTO.setLeaderUserId(createReqVO.getLeaderUserId());
deptRespDTO.setStatus(CommonStatusEnum.ENABLE.getStatus());
deptApi.createDept(deptRespDTO);
}
// 返回
return factoryInfo.getId();