package market.Com.mapper;

import java.util.List;

import market.Com.vo.ComBaseStationRCraft;

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

import com.hnshituo.orm.GenericMapper;

public interface ComBaseStationRCraftMapper extends GenericMapper<ComBaseStationRCraft,Object> {
	/**
	 * 工艺参数信息
	 * @param processpointcode
	 * @return
	 */
	@Select("select a.craft_param_code,"
			+ "a.craft_param_desc,"
			+ "b.craft_param_type,"
			+ "b.craft_param_level,"
			+ "a.seq,"
			+ "a.allow_count,"
			+ "a.create_name,"
			+ "a.create_time "
			+ "from COM_BASE_STATION_R_CRAFT a "
			+ "left join COM_BASE_CRAFT b "  
			+ " on a.craft_param_code = b.craft_param_code "
			+ "left join COM_BASE_STATION c "
			+ "on a.process_point_code = c.process_point_code  where c.process_point_code = #{processpointcode} and a.validflag ='1' order by seq")
	public List<ComBaseStationRCraft> doQueryBySql(@Param("processpointcode") String processpointcode);
	
	/**
	 * 联合主键删除
	 */
	@Delete("delete from COM_BASE_STATION_R_CRAFT a where a.process_code = #{processcode} and a.process_point_code = #{processpointcode} and a.craft_param_code = #{craftparamcode} ")
	public void  doDeleteBySql(
			@Param("processcode") String processcode,
			@Param("processpointcode") String processpointcode,
			@Param("craftparamcode") String craftparamcode
			);
	/**
	 * 联合主键查询(唯一)
	 */
	@Select("select a.* from COM_BASE_STATION_R_CRAFT a where a.process_code = #{processcode} and a.process_point_code = #{processpointcode} and a.craft_param_code = #{craftparamcode} ")
	public ComBaseStationRCraft doQueryOneBySql(
			@Param("processcode") String processcode,
			@Param("processpointcode") String processpointcode,
			@Param("craftparamcode") String craftparamcode
			);

	/***
	 * 2018年1月30日修改，删除工序点关联的所有数据
	 * @param pointCode
	 */
	@Delete("delete from COM_BASE_STATION_R_CRAFT a where a.process_point_code = #{pointCode} ")
	public void doDelete(@Param("pointCode") String pointCode);
}
