package com.pj.project.tb_unit;

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_unit -- 车辆规格
 * @author qzy 
 */
@Service
public class TbUnitService extends ServiceImpl<TbUnitMapper,TbUnit>implements IService<TbUnit> {

	/** 底层 Mapper 对象 */
	@Autowired
    TbUnitMapper tbUnitMapper;

	/** 增 */
	int add(TbUnit t){
		return tbUnitMapper.add(t);
	}

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

	/** 改 */
	int update(TbUnit t){
		return tbUnitMapper.update(t);
	}

	/** 查 */
	TbUnit getById(Long id){
		return tbUnitMapper.getById(id);
	}

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


	public TbUnit findByUnit(Double cardSize) {
		QueryWrapper<TbUnit>ew=new QueryWrapper<>();
		ew.eq("unit",cardSize);
		return getOne(ew);
	}
}
