package com.pj.project.tb_bank;

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_bank -- 银行字典表
 * @author qzyReal 
 */
@Service
public class TbBankService  extends ServiceImpl <TbBankMapper,TbBank> implements IService<TbBank>  {

	/** 底层 Mapper 对象 */
	@Autowired
	TbBankMapper tbBankMapper;

	/** 增 */
	int add(TbBank t){
		return tbBankMapper.add(t);
	}

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

	/** 改 */
	int update(TbBank t){
		return tbBankMapper.update(t);
	}

	/** 查 */
	TbBank getById(Long id){
		return tbBankMapper.getById(id);
	}

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

	public TbBank getByName(String bankName){
        QueryWrapper<TbBank> ew = new QueryWrapper<>();
        ew.eq("bank_name", bankName);
        return getOne(ew);
    }
	

}
