package market.Qms.metallurgy.mapper;

import market.Qms.metallurgy.vo.ComMscStdSpecBias;

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 ComMscStdSpecBiasMapper extends GenericMapper<ComMscStdSpecBias, String> {

	/**
     * 获得最大编号
     * @return
     */
	@Select("select 'SICQ'||to_char(nvl(max(to_number(substr(t.sic,-6))),0)+1,'fm099999') from  com_msc_std_spec_bias t WHERE SUBSTR (sic, 0, 4) ='SICQ'")
	public String getMax();
	
	@Select("select 'STDQ'||to_char(nvl(max(to_number(substr(t.std_code,-5))),0)+1,'fm09999') from  com_msc_std_spec_bias t WHERE SUBSTR (std_code, 0, 4) ='STDQ'")
	public String getStdCode();
	
	@Update("UPDATE COM_MSC_STD_SPEC_BIAS SET VALIDFLAG = 1,DELETE_NAME = NULL,DELETE_TIME = NULL WHERE SIC = #{sic}")
	public void updates(@Param("sic") String sic);
	
	@Update("UPDATE COM_MSC_STD_SPEC_BIAS_C SET VALIDFLAG = 1,DELETE_NAME = NULL,DELETE_TIME = NULL WHERE SIC = #{sic} AND INDEX_SEQ = #{index}")
	public void updatec(@Param("sic") String sic,@Param("index") Integer index);
}
