package market.Qms.metallurgy.mapper;
import java.util.List;

import market.Api.Qms.vo.ComMscStdChem;
import market.Api.Qms.vo.ComMscStdDetectionC;
import market.Api.Qms.vo.ComMscStdPhy;
import market.Api.Qms.vo.ComMscStdSpecC;
import market.Api.Qms.vo.DetailMsc;
import market.Qms.metallurgy.vo.ComBaseStd;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hnshituo.orm.GenericMapper;
public interface ComBaseStdMapper extends GenericMapper<ComBaseStd, String> {
    /**
     * 获得最大编号
     * @return
     */
	@Select("select 'STD'||to_char("
			+ "nvl(max(to_number(substr(t.std_code,-7))),0)+1,'fm0999999') from  com_base_std t ")
	public String getMax();

	
	@Select("SELECT count(*) from COM_BASE_STD WHERE STD_NAME = #{name}")
	public Integer findname(@Param("name") String name);
	
	@Select("SELECT count(*) from COM_BASE_STD WHERE STD_NAME = #{name} AND STD_CODE != #{code}")
	public Integer findn(@Param("name") String name,@Param("code") String code);
	
	public Integer findvalid(String param);
	
	@Update("UPDATE COM_BASE_STD set DELETE_NAME = NULL,DELETE_TIME = NULL,VALIDFLAG = 1 WHERE STD_CODE =#{code}")
	public void updatec(String code);
	
	public List<ComMscStdChem> dofindchem(@Param("entity") DetailMsc entity);
	public List<ComMscStdPhy> dofindphy(@Param("entity") DetailMsc entity);
	public List<ComMscStdDetectionC> dofinddetection(@Param("param1") String param1,@Param("param2") String param2);
	public List<ComMscStdSpecC> dofindspec(@Param("param1") String param1,@Param("param2") String param2);
	
}
