package com.mandi.basicconfig.mapper;

import java.util.List;
import java.util.Map;

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

import com.mandi.basicconfig.persist.FdRepertoryNexus;

public interface FdRepertoryNexusMapper {
	
	@Select("select * from fd_repertory_nexus where sdepartNo=#{sdepartNo} and ckNo=#{ckNo} and ywdyNo=#{ywdyNo} ")
	public FdRepertoryNexus getbyIds(FdRepertoryNexus renexus);
	@Select("select top 1 * from fd_repertory_nexus where ckNo=#{ckNo} and ywdyNo=#{ywdyNo} ")
	public FdRepertoryNexus getbyckNoAndYwdyNo(@Param("ckNo") String ckNo,@Param("ywdyNo") String ywdyNo);
	
	@Insert("insert into fd_repertory_nexus (sdepartNo,ckNo,ywdyNo) values (#{sdepartNo},#{ckNo},#{ywdyNo}) ")
	public int insertRepertoryNexus(FdRepertoryNexus renexus);
	@Update("update fd_repertory_nexus set sdepartNo=#{sdepartNo} where ckNo=#{ckNo} and ywdyNo=#{ywdyNo}")
	public int updateRepertoryNexus(FdRepertoryNexus renexus);
	
	@Delete("delete from fd_repertory_nexus where sdepartNo=#{sdepartNo} and  ckNo=#{ckNo} and ywdyNo=#{ywdyNo} ")
	public int delRepertoryNexus(FdRepertoryNexus renexus);
	
	@Delete("delete from fd_repertory_nexus where sdepartNo=#{sdepartNo} ")
	public int delRepertoryNexusBySdepartNo(String sdepartNo);
	
	
	@Select("select * from fd_repertory_nexus where sdepartNo=#{sdepartNo} ")
	public List<FdRepertoryNexus> getBySdepartNo(String sdepartNo);
	
	@Select("select b.name+'('+a.name+')' ckName,b.code+'_'+a.depotNo as code from repertory  a LEFT JOIN nc_ywdy b on a.pk_org =b.pkid where a.depotNo LIKE 'C%'  and b.code in ('101','102','103','113','111','114') ORDER BY b.code ASC ")
	public List<Map<String, Object>> getAllCk();
	
	
	
	
	
	
	

}