| | |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.modules.patrol.entity.PatrolRecord; |
| | | import org.springblade.modules.patrol.service.IPatrolRecordService; |
| | | import org.springblade.modules.place.entity.PlaceCheckEntity; |
| | | import org.springblade.modules.place.vo.PlaceCheckVO; |
| | | import org.springblade.modules.place.mapper.PlaceCheckMapper; |
| | |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 场所检查表 服务实现类 |
| | |
| | | return page.setRecords(baseMapper.selectPlaceCheckPage(page, placeCheck)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean savePlace(PlaceCheckVO placeCheck) throws Exception { |
| | | boolean save = save(placeCheck); |
| | | if (save) { |
| | | IPatrolRecordService bean = SpringUtil.getBean(IPatrolRecordService.class); |
| | | List<PatrolRecord> patrolRecordVOList = placeCheck.getPatrolRecordVOList(); |
| | | patrolRecordVOList.stream().forEach(item -> { |
| | | item.setPlaceCheckId(placeCheck.getId()); |
| | | }); |
| | | boolean b = bean.saveBatch(placeCheck.getPatrolRecordVOList()); |
| | | if (b) { |
| | | return b; |
| | | } |
| | | throw new Exception("保存失败!"); |
| | | } |
| | | return false; |
| | | } |
| | | } |