package market.Slm.FundManagement.mapper;
import java.util.List;

import org.apache.ibatis.annotations.Select;

import market.Slm.FundManagement.vo.SlmFundThirdAccountUsed;

import com.hnshituo.orm.GenericMapper;

public interface SlmFundThirdAccountUsedMapper extends GenericMapper<SlmFundThirdAccountUsed,Object> {

	void doCarryover(SlmFundThirdAccountUsed used);

	SlmFundThirdAccountUsed sumUsed(String first_account_no);

	List<SlmFundThirdAccountUsed> doQueryHistory(SlmFundThirdAccountUsed used,int i, int pageSize);
	
	// 合同账户查询：根据合同号；
	@Select("select * from (\n" +
		      "    select * from SLM_FUND_THIRD_ACCOUNT_USED where\n" +
		      "\t\t flag='0' and THIRD_ACCOUNT_NO= #{thirdNo}\n" +
		      "\t\t \tand CARRYOVER_FLAG='1'\n" +
		      "    union all\n" +
		      "                select * from SLM_FUND_THIRD_ACCOUNT_USED where\n" +
		      "            CARRYOVER_FLAG = '0' and THIRD_ACCOUNT_NO = \n" +
		      "                                     #{thirdNo}\n" +
		      "            and FLAG = '0'\n" +
		      "    )")
	List<SlmFundThirdAccountUsed> doQueryZYByCon(String thirdNo);

	int doQueryHistoryCount(SlmFundThirdAccountUsed used);
}
