| | |
| | | package com.dji.sample.log.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dji.sample.common.model.Pagination; |
| | | import com.dji.sample.common.model.PaginationData; |
| | | import com.dji.sample.log.dao.IDroneFlightLogInfoMapper; |
| | | import com.dji.sample.log.dao.IDroneFlightLogMapper; |
| | | import com.dji.sample.log.model.entity.DroneFlightLogEntity; |
| | | import com.dji.sample.log.model.entity.DroneFlightLogInfoEntity; |
| | | import com.dji.sample.log.service.IDroneFlightLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @PROJECT_NAME: iot_drone_api |
| | |
| | | @Autowired |
| | | private IDroneFlightLogMapper mapper; |
| | | |
| | | @Autowired |
| | | private IDroneFlightLogInfoMapper droneFlightLogInfoMapper; |
| | | |
| | | @Override |
| | | public PaginationData<DroneFlightLogEntity> selectDroneFlightLog(long page, long pageSize, String workspaceId) { |
| | | |
| | | QueryWrapper<DroneFlightLogEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(DroneFlightLogEntity::getWorkspaceId, workspaceId); |
| | | wrapper.orderByDesc("start_time"); |
| | | Page<DroneFlightLogEntity> entityPage = mapper.selectPage( |
| | | new Page<>(page, pageSize), |
| | | wrapper); |
| | | |
| | | return new PaginationData<>(entityPage.getRecords(), new Pagination(entityPage)); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<DroneFlightLogInfoEntity> listByFid(long flightId) { |
| | | return droneFlightLogInfoMapper.selectList( |
| | | new LambdaQueryWrapper<DroneFlightLogInfoEntity>() |
| | | .eq(DroneFlightLogInfoEntity::getFlightId, flightId)); |
| | | } |
| | | |
| | | @Override |
| | | public void save(DroneFlightLogEntity entity) { |
| | | mapper.insert(entity); |