package com.pj.project.tb_declare;

import java.util.List;

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 com.pj.utils.sg.*;
import org.springframework.transaction.annotation.Transactional;

/**
 * Service: tb_declare -- 
 * @author lzm 
 */
@Service
@Transactional
public class TbDeclareService extends ServiceImpl<TbDeclareMapper, TbDeclare> implements IService<TbDeclare> {

	/** 底层 Mapper 对象 */
	@Autowired
	TbDeclareMapper tbDeclareMapper;

	/** 增 */
	int add(TbDeclare t){
		return tbDeclareMapper.add(t);
	}

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

	/** 改 */
	int update(TbDeclare t){
		return tbDeclareMapper.update(t);
	}

	/** 查 */
	TbDeclare getById(Long id){
		return tbDeclareMapper.getById(id);
	}

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


	public TbDeclare findByProductionCode(String productionCode) {
		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
		ew.eq("production_code",productionCode);
		return getOne(ew);
	}

	public TbDeclare findByDeclareNo(String declareNo) {
		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
		ew.eq("declare_no",declareNo);
		return getOne(ew);
	}
}
