| | |
| | | import com.ruoyi.oa.domain.BsBuilding; |
| | | import com.ruoyi.oa.mapper.BsBuildingMapper; |
| | | import com.ruoyi.oa.service.IBsBuildingService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean insertByBo(BsBuildingBo bo) { |
| | | List<BsBuilding> list = baseMapper.selectList(new LambdaQueryWrapper<BsBuilding>() |
| | | .eq(BsBuilding::getSchoolId, bo.getSchoolId()).eq(BsBuilding::getCode, bo.getCode())); |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("单元编号重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | BsBuilding add = BeanUtil.toBean(bo, BsBuilding.class); |
| | | if (bo.getParentId() == Long.valueOf(0)) { |
| | | BsSchool school = schoolMapper.selectById(bo.getSchoolId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateByBo(BsBuildingBo bo) { |
| | | List<BsBuilding> list = baseMapper.selectList(new LambdaQueryWrapper<BsBuilding>() |
| | | .ne(BsBuilding::getId, bo.getId()) |
| | | .eq(BsBuilding::getSchoolId, bo.getSchoolId()) |
| | | .eq(BsBuilding::getCode, bo.getCode())); |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("单元编号重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | BsBuilding update = BeanUtil.toBean(bo, BsBuilding.class); |
| | | if (bo.getParentId() == Long.valueOf(0)) { |
| | | BsSchool school = schoolMapper.selectById(bo.getSchoolId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | List<BsBuilding> list = baseMapper.selectList(new LambdaQueryWrapper<BsBuilding>() |
| | | .in(BsBuilding::getParentId, ids)); |