package com.pj.project.tb_driver;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Service: tb_driver -- 司机
 * @author qzy 
 */
@Service
public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver>implements IService<TbDriver> {

	/** 底层 Mapper 对象 */
	@Autowired
    TbDriverMapper tbDriverMapper;

	/** 增 */
	int add(TbDriver t){
		return tbDriverMapper.add(t);
	}

	/** 删 */
	int delete(Long id){
		return tbDriverMapper.delete(id);
	}

	/** 改 */
	int update(TbDriver t){
		return tbDriverMapper.update(t);
	}

	/** 查 */
	TbDriver getById(Long id){
		return tbDriverMapper.getById(id);
	}

	/** 查集合 - 根据条件（参数为空时代表忽略指定条件） */  
	List<TbDriver> getList(SoMap so) {
		return tbDriverMapper.getList(so);	
	}


	public TbDriver findByIdCardNo(String idCardNo) {
		QueryWrapper<TbDriver>ew=new QueryWrapper<>();
		ew.eq("id_card",idCardNo);
		return getOne(ew);
	}
}
