package com.zcxk.track.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcxk.track.dao.GpsDataHisMapper;
import com.zcxk.track.entity.GpsDataHis;
import com.zcxk.track.entity.TaskTrack;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


/**
 * 用户历史GPS数据服务接口
 *
 * @author yjy
 * @since 2021-1-16
 */
@Service
public class GpsDataHisService extends ServiceImpl<GpsDataHisMapper, GpsDataHis> {
    @Resource
    private GpsDataHisMapper gpsDataHisMapper;
    /**
     * 批量增加数据
     *
     * @param
     * @return
     */
    public boolean insert(List<GpsDataHis> GpsDataHis) {
        return this.saveBatch(GpsDataHis);
    }
    /**
     *  查询数据
     *
     * @param
     * @return
     */
    public List<GpsDataHis> selectGpsDataHis(TaskTrack taskTrack) {
        return taskTrack==null?new ArrayList<>():this.list(new QueryWrapper<GpsDataHis>().eq("USER_ID",taskTrack.getUserId())
                .gt("UPLOAD_DATE",taskTrack.getTaskStartDate())
                .lt("UPLOAD_DATE",taskTrack.getTaskEndDate()));
    }
}
