| | |
| | | import com.ruoyi.oa.domain.BsOrganization; |
| | | import com.ruoyi.oa.mapper.BsOrganizationMapper; |
| | | import com.ruoyi.oa.service.IBsOrganizationService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean insertByBo(BsOrganizationBo bo) { |
| | | List<BsOrganization> list = baseMapper.selectList(new LambdaQueryWrapper<BsOrganization>() |
| | | .eq(BsOrganization::getSchoolId, bo.getSchoolId()).eq(BsOrganization::getCode, bo.getCode())); |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("机构编号重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | BsOrganization add = BeanUtil.toBean(bo, BsOrganization.class); |
| | | if (bo.getParentId() == Long.valueOf(0)) { |
| | | BsSchool school = schoolMapper.selectById(bo.getSchoolId()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateByBo(BsOrganizationBo bo) { |
| | | List<BsOrganization> list = baseMapper.selectList(new LambdaQueryWrapper<BsOrganization>() |
| | | .ne(BsOrganization::getId, bo.getId()) |
| | | .eq(BsOrganization::getSchoolId, bo.getSchoolId()) |
| | | .eq(BsOrganization::getCode, bo.getCode())); |
| | | if (list.size() > 0) { |
| | | throw new ServiceException("机构编号重复", HttpStatus.HTTP_PARTIAL); |
| | | } |
| | | BsOrganization update = BeanUtil.toBean(bo, BsOrganization.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<BsOrganization> list = baseMapper.selectList(new LambdaQueryWrapper<BsOrganization>() |
| | | .in(BsOrganization::getParentId, ids)); |