| | |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.exception.ServiceException; |
| | | import com.sinata.common.utils.BeanUtils; |
| | | import com.sinata.common.utils.StringUtils; |
| | | import com.sinata.system.domain.MwTransitCar; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.dto.MwTransitCarDTO; |
| | | import com.sinata.system.domain.query.TransitCarQuery; |
| | | import com.sinata.system.domain.vo.MwTransitCarVO; |
| | | import com.sinata.system.enums.DepartmentEnum; |
| | | import com.sinata.system.mapper.MwTransitCarMapper; |
| | | import com.sinata.system.service.MwTransitCarService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public PageDTO<MwTransitCarVO> pageList(TransitCarQuery query) { |
| | | String treeCode = sysDepartmentService.getTreeCode(query.getDepartmentId()); |
| | | String treeCode; |
| | | if (Objects.isNull(query.getDepartmentId())) { |
| | | SysDepartment department = sysDepartmentService.getMyDepartment(); |
| | | treeCode = department.getTreeCode(); |
| | | } else { |
| | | SysDepartment department = sysDepartmentService.getById(query.getDepartmentId()); |
| | | //如果是处置单位,则获取父级部门 |
| | | if (department.getOrgType().equals(DepartmentEnum.DISPOSAL_UNIT.getCode())) { |
| | | department = sysDepartmentService.getDepartmentByParentId(department.getParentId()); |
| | | } |
| | | treeCode = department.getTreeCode(); |
| | | } |
| | | if (StringUtils.isBlank(treeCode)) { |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | | Page<MwTransitCarVO> page = baseMapper.pageList(new Page<>(query.getPageCurr(), query.getPageSize()), query, treeCode); |
| | | return PageDTO.of(page); |
| | | } |
| | |
| | | MwTransitCar mwTransitCar = BeanUtils.copyBean(dto, MwTransitCar.class); |
| | | updateById(mwTransitCar); |
| | | } |
| | | |
| | | /** |
| | | * 关联车辆列表 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MwTransitCarVO> getCarListByRouteId(Long id) { |
| | | return baseMapper.getCarListByRouteId(id); |
| | | } |
| | | } |