| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.exception.ServiceException; |
| | | import com.sinata.common.utils.BeanUtils; |
| | | import com.sinata.system.domain.MwTransitCarAnnualInspection; |
| | | import com.sinata.system.domain.dto.MwTransitCarAnnualInspectionDTO; |
| | | import com.sinata.system.domain.query.MwTransitCarAnnualInspectionQuery; |
| | | import com.sinata.system.domain.vo.MwTransitCarAnnualInspectionVO; |
| | | import com.sinata.system.mapper.MwTransitCarAnnualInspectionMapper; |
| | | import com.sinata.system.service.MwTransitCarAnnualInspectionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class MwTransitCarAnnualInspectionServiceImpl extends ServiceImpl<MwTransitCarAnnualInspectionMapper, MwTransitCarAnnualInspection> implements MwTransitCarAnnualInspectionService { |
| | | /** |
| | | * 年检记录分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageDTO<MwTransitCarAnnualInspectionVO> pageList(MwTransitCarAnnualInspectionQuery query) { |
| | | Page<MwTransitCarAnnualInspection> page = this.lambdaQuery() |
| | | .eq(MwTransitCarAnnualInspection::getCarId, query.getId()) |
| | | .orderByDesc(MwTransitCarAnnualInspection::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | return PageDTO.of(page, MwTransitCarAnnualInspectionVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MwTransitCarAnnualInspectionVO detail(Long id) { |
| | | return BeanUtils.copyBean(getById(id), MwTransitCarAnnualInspectionVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 新增年检记录 |
| | | * |
| | | * @param dto |
| | | */ |
| | | @Override |
| | | public void add(MwTransitCarAnnualInspectionDTO dto) { |
| | | MwTransitCarAnnualInspection mwTransitCarAnnualInspection = BeanUtils.copyBean(dto, MwTransitCarAnnualInspection.class); |
| | | save(mwTransitCarAnnualInspection); |
| | | } |
| | | |
| | | /** |
| | | * 编辑年检记录 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void edit(MwTransitCarAnnualInspectionDTO dto) { |
| | | if (Objects.isNull(dto.getId())) { |
| | | throw new ServiceException("年检记录id不能为空"); |
| | | } |
| | | MwTransitCarAnnualInspection mwTransitCarAnnualInspection = BeanUtils.copyBean(dto, MwTransitCarAnnualInspection.class); |
| | | updateById(mwTransitCarAnnualInspection); |
| | | } |
| | | } |