package com.pj.project.tb_car;

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_car -- 
 * @author qzy 
 */
@Service
public class TbCarService extends ServiceImpl<TbCarMapper, TbCar>implements IService<TbCar> {

	/** 底层 Mapper 对象 */
	@Autowired
    TbCarMapper tbCarMapper;

	/** 增 */
	int add(TbCar t){
		return tbCarMapper.add(t);
	}

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

	/** 改 */
	int update(TbCar t){
		return tbCarMapper.update(t);
	}

	/** 查 */
	TbCar getById(Long id){
		return tbCarMapper.getById(id);
	}

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


	public TbCar findByCardNo(String cardNo) {
		QueryWrapper<TbCar>ew=new QueryWrapper<>();
		ew.eq("card_no",cardNo);
		return getOne(ew);
	}
}
