<?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="cn.ibizlab.core.sample.mapper.IBIZSupplierMapper">

    <!--该方法用于重写mybatis中selectById方法，以实现查询逻辑属性-->
	<select id="selectById"  resultMap="IBIZSupplierResultMap" databaseId="dm">
        <![CDATA[select t1.* from (SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  ) t1 where supplierid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZSupplierResultMap" databaseId="hana">
        <![CDATA[select t1.* from (SELECT t1.\"ADDRESS\", t1.\"CREATEBY\", t1.\"CREATETIME\", t1.\"DELETEFLAG\", t1.\"EMAIL\", t1.\"SUPPLIERID\", t1.\"SUPPLIERNAME\", t1.\"UPDATEBY\", t1.\"UPDATETIME\" FROM \"t_supplier\" t1  ) t1 where supplierid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZSupplierResultMap" databaseId="mysql">
        <![CDATA[select t1.* from (SELECT t1.`ADDRESS`, t1.`CREATEBY`, t1.`CREATETIME`, t1.`DELETEFLAG`, t1.`EMAIL`, t1.`SUPPLIERID`, t1.`SUPPLIERNAME`, t1.`UPDATEBY`, t1.`UPDATETIME` FROM `t_supplier` t1  ) t1 where supplierid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZSupplierResultMap" databaseId="postgresql">
        <![CDATA[select t1.* from (SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  ) t1 where supplierid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZSupplierResultMap" databaseId="sqlserver">
        <![CDATA[select t1.* from (SELECT t1.[ADDRESS], t1.[CREATEBY], t1.[CREATETIME], t1.[DELETEFLAG], t1.[EMAIL], t1.[SUPPLIERID], t1.[SUPPLIERNAME], t1.[UPDATEBY], t1.[UPDATETIME] FROM [t_supplier] t1  ) t1 where supplierid=#{id}]]>
    </select>

    <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
    <resultMap id="IBIZSupplierResultMap" type="cn.ibizlab.core.sample.domain.IBIZSupplier" autoMapping="true">
		<id property="supplierid" column="supplierid" /><!--主键字段映射-->
            
		
    </resultMap>


    <!--数据集合[Default]-->
	 <select id="searchDefault"  parameterType="cn.ibizlab.core.sample.filter.IBIZSupplierSearchContext"  resultMap="IBIZSupplierResultMap">
         select t1.* from (
                <include refid="Default" />
         )t1
         <where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
         <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
     </select>

    <!--数据查询[CalUni]-->
    <sql id="CalUni" databaseId="dm">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
						 AND ( t1.ADDRESS =  #{srf.datacontext.address}  AND  t1.EMAIL =  #{srf.datacontext.email}  AND  t1.SUPPLIERNAME =  #{srf.datacontext.suppliername} )
			]]>
    </sql>
    <!--数据查询[CalUni]-->
    <sql id="CalUni" databaseId="hana">
		<![CDATA[ SELECT t1.\"ADDRESS\", t1.\"CREATEBY\", t1.\"CREATETIME\", t1.\"DELETEFLAG\", t1.\"EMAIL\", t1.\"SUPPLIERID\", t1.\"SUPPLIERNAME\", t1.\"UPDATEBY\", t1.\"UPDATETIME\" FROM \"t_supplier\" t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
						 AND ( t1.\"ADDRESS\" =  #{srf.datacontext.address}  AND  t1.\"EMAIL\" =  #{srf.datacontext.email}  AND  t1.\"SUPPLIERNAME\" =  #{srf.datacontext.suppliername} )
			]]>
    </sql>
    <!--数据查询[CalUni]-->
    <sql id="CalUni" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CREATEBY`, t1.`CREATETIME`, t1.`DELETEFLAG`, t1.`EMAIL`, t1.`SUPPLIERID`, t1.`SUPPLIERNAME`, t1.`UPDATEBY`, t1.`UPDATETIME` FROM `t_supplier` t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
						 AND ( t1.`ADDRESS` =  #{srf.datacontext.address}  AND  t1.`EMAIL` =  #{srf.datacontext.email}  AND  t1.`SUPPLIERNAME` =  #{srf.datacontext.suppliername} )
			]]>
    </sql>
    <!--数据查询[CalUni]-->
    <sql id="CalUni" databaseId="postgresql">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
						 AND ( t1.ADDRESS =  #{srf.datacontext.address}  AND  t1.EMAIL =  #{srf.datacontext.email}  AND  t1.SUPPLIERNAME =  #{srf.datacontext.suppliername} )
			]]>
    </sql>
    <!--数据查询[CalUni]-->
    <sql id="CalUni" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[ADDRESS], t1.[CREATEBY], t1.[CREATETIME], t1.[DELETEFLAG], t1.[EMAIL], t1.[SUPPLIERID], t1.[SUPPLIERNAME], t1.[UPDATEBY], t1.[UPDATETIME] FROM [t_supplier] t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
						 AND ( t1.[ADDRESS] =  #{srf.datacontext.address}  AND  t1.[EMAIL] =  #{srf.datacontext.email}  AND  t1.[SUPPLIERNAME] =  #{srf.datacontext.suppliername} )
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="dm">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="hana">
		<![CDATA[ SELECT t1.\"ADDRESS\", t1.\"CREATEBY\", t1.\"CREATETIME\", t1.\"DELETEFLAG\", t1.\"EMAIL\", t1.\"SUPPLIERID\", t1.\"SUPPLIERNAME\", t1.\"UPDATEBY\", t1.\"UPDATETIME\" FROM \"t_supplier\" t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CREATEBY`, t1.`CREATETIME`, t1.`DELETEFLAG`, t1.`EMAIL`, t1.`SUPPLIERID`, t1.`SUPPLIERNAME`, t1.`UPDATEBY`, t1.`UPDATETIME` FROM `t_supplier` t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="postgresql">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[ADDRESS], t1.[CREATEBY], t1.[CREATETIME], t1.[DELETEFLAG], t1.[EMAIL], t1.[SUPPLIERID], t1.[SUPPLIERNAME], t1.[UPDATEBY], t1.[UPDATETIME] FROM [t_supplier] t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="dm">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="hana">
		<![CDATA[ SELECT t1.\"ADDRESS\", t1.\"CREATEBY\", t1.\"CREATETIME\", t1.\"DELETEFLAG\", t1.\"EMAIL\", t1.\"SUPPLIERID\", t1.\"SUPPLIERNAME\", t1.\"UPDATEBY\", t1.\"UPDATETIME\" FROM \"t_supplier\" t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CREATEBY`, t1.`CREATETIME`, t1.`DELETEFLAG`, t1.`EMAIL`, t1.`SUPPLIERID`, t1.`SUPPLIERNAME`, t1.`UPDATEBY`, t1.`UPDATETIME` FROM `t_supplier` t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="postgresql">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEBY, t1.CREATETIME, t1.DELETEFLAG, t1.EMAIL, t1.SUPPLIERID, t1.SUPPLIERNAME, t1.UPDATEBY, t1.UPDATETIME FROM t_supplier t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[ADDRESS], t1.[CREATEBY], t1.[CREATETIME], t1.[DELETEFLAG], t1.[EMAIL], t1.[SUPPLIERID], t1.[SUPPLIERNAME], t1.[UPDATEBY], t1.[UPDATETIME] FROM [t_supplier] t1  
					 WHERE 	t1.DELETEFLAG = 'Y'
			]]>
    </sql>
</mapper>

