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.GpsDataMapper;
import com.zcxk.track.entity.GpsData;
import org.springframework.stereotype.Service;

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


/**
 * 用户GPS数据服务接口
 *
 * @author yjy
 * @since 2021-1-16
 */
@Service
public class GpsDataService extends ServiceImpl<GpsDataMapper, GpsData> {
    @Resource
    private GpsDataMapper gpsDataMapper;
    /**
     * 批量增加数据
     *
     * @param
     * @return
     */
    public boolean insert(GpsData GpsData) {
        return this.save(GpsData);
    }
    /**
     * 根据用户id查询数据
     *
     * @param userId 用户id
     * @return 单条数据
     */
    public List<GpsData> selectByUserId(Integer userId){
        return this.list(new QueryWrapper<GpsData>().eq("USER_ID",userId));
    }
    /**
     * 根据用户id删除数据
     *
     * @param userId 用户id
     * @return 单条数据
     */
    public boolean delete(Integer userId){
       return this.remove(new QueryWrapper<GpsData>().eq("USER_ID",userId));
    }
}
