<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.huazheng.project.mssql2.mapper.HzcrmMapper">

	<select id="selectTKeHuXiaoShouZZYeWuYNew" parameterType="TKeHuXiaoShouZZYeWuY" resultType="TKeHuXiaoShouZZYeWuY">
    	select top 20 a.* from (
			select ROW_NUMBER() OVER(ORDER BY id) as rowids,
				id,keHuID,yeWuYMC,yeWuYLoginName
			from T_KeHu_XiaoShouZZ_YeWuY
		) a where a.rowids &gt; #{rowids}
    </select>
    <select id="selectTKeHuNew" parameterType="TKeHu" resultType="TKeHu">
		select top 20 a.* from (
			select ROW_NUMBER() OVER(ORDER BY keHuID) as rowids,
				keHuID,keHuCode,keHuMC,xinBaoED,diQu
			from T_KeHu
		) a where a.rowids &gt; #{rowids}
    </select>
    <select id="selectSysSAPreturnNoNew" parameterType="SysSAPreturnNo" resultType="SysSAPreturnNo">
		select top 20 a.* from (
			select id as rowids,
				id,processName,shiLiH,('00'+sapNo) as sapNo,chuangJianSJ,faHuoHXMH
			from Sys_SAPreturnNo
		) a where a.rowids &gt; #{rowids}
    </select>
    
    
    
    
    
    <select id="selectTKeHuXiaoShouZZ" parameterType="TKeHu" resultType="TKeHuXiaoShouZZ">
		select id,keHuID,fuKuanTJ from T_KeHu_XiaoShouZZ where KeHuID = #{keHuID}
    </select>
    <select id="selectTKeHuXiaoShouZZYeWuY" parameterType="TKeHu" resultType="TKeHuXiaoShouZZYeWuY">
		select id,keHuID,yeWuYMC from T_KeHu_XiaoShouZZ_YeWuY where KeHuID = #{keHuID}
    </select>
	<select id="selectTWuLiaoDB" parameterType="TKeHu" resultType="TWuLiaoDB">
		select 
			a.id, a.chuangJianRLN, a.chuangJianR, a.chuangJianSJ, a.gengXinRLN, a.gengXinR, a.gengXinSJ, a.shanChuRLN, 
			a.shanChuR, a.shanChuSJ, a.shiFouYSC, a.keHuID, b.keHuMC, a.keHuWLMC, a.xiTongWLMC, a.xiTongWLBM, a.keHuWLBM
		from T_WuLiaoDB a
			left join t_kehu b on a.kehuid = b.kehuid
		where a.KeHuID = #{keHuID}
    </select>
    
    
    
	<select id="selectSysSAPreturnNoById" parameterType="SysSAPreturnNo" resultType="SysSAPreturnNo">
    	select id,processName,shiLiH,('00'+sapNo) as sapNo,chuangJianSJ,faHuoHXMH from Sys_SAPreturnNo where id = #{id}
    </select>
	<select id="selectTKeHuById" parameterType="TKeHu" resultType="TKeHu">
    	SELECT keHuID,keHuCode,keHuMC,xinBaoED,diQu from T_KeHu where keHuID = #{keHuID}
    </select>
	<select id="selectTKeHuXiaoShouZZById" parameterType="TKeHuXiaoShouZZ" resultType="TKeHuXiaoShouZZ">
    	SELECT id,keHuID,fuKuanTJ from T_KeHu_XiaoShouZZ where id = #{id}
    </select>
	<select id="selectTKeHuXiaoShouZZYeWuYById" parameterType="TKeHuXiaoShouZZYeWuY" resultType="TKeHuXiaoShouZZYeWuY">
    	SELECT id,keHuID,yeWuYMC,yeWuYLoginName from T_KeHu_XiaoShouZZ_YeWuY where id = #{id}
    </select>
	<select id="selectTWuLiaoDBById" parameterType="TWuLiaoDB" resultType="TWuLiaoDB">
		select 
			a.id, a.chuangJianRLN, a.chuangJianR, a.chuangJianSJ, a.gengXinRLN, a.gengXinR, a.gengXinSJ, a.shanChuRLN, 
			a.shanChuR, a.shanChuSJ, a.shiFouYSC, a.keHuID, b.keHuMC, a.keHuWLMC, a.xiTongWLMC, a.xiTongWLBM, a.keHuWLBM
		from T_WuLiaoDB a
			left join t_kehu b on a.kehuid = b.kehuid
		where a.id = #{id}
    </select>
    
    <select id="cascadeSysSAPreturnNoByVbap" parameterType="com.huazheng.project.hana.model.Vbap" resultType="SysSAPreturnNo">
    	select top 20 a.* from (
			select id as rowids,
				id,processName,shiLiH,('00'+sapNo) as sapNo,chuangJianSJ,faHuoHXMH
			from Sys_SAPreturnNo
		) a where sapNo = #{vbeln}
    </select>
    
    
    
    
    
</mapper>
