| | |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public Result add(PlatformForm form) { |
| | | Platform entity = PlatformForm.getEntityByForm(form, null); |
| | | entity.setParentId(0); |
| | | Date now = new Date(); |
| | | entity.setCreateTime(now); |
| | | entity.setUpdateTime(now); |
| | | baseMapper.insert(entity); |
| | | if (! CollectionUtils.isEmpty(form.getDeployList())) { |
| | | List<Platform> childList = form.getDeployList().stream().map(deploy -> { |
| | | Platform child = new Platform(); |
| | | BeanUtils.copyProperties(deploy, child); |
| | | child.setParentId(entity.getId()); |
| | | child.setCreateTime(now); |
| | | child.setUpdateTime(now); |
| | | return child; |
| | | }).collect(Collectors.toList()); |
| | | this.saveBatch(childList); |