<?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.IBIZCustomer_INTFMapper">

    <!--该方法用于重写mybatis中selectById方法，以实现查询逻辑属性-->
	<select id="selectById"  resultMap="IBIZCustomer_INTFResultMap" databaseId="dm">
        <![CDATA[select * from v_ibizcustomer t1     where  ibizcustomerid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZCustomer_INTFResultMap" databaseId="mysql">
        <![CDATA[select * from v_ibizcustomer t1     where  ibizcustomerid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZCustomer_INTFResultMap" databaseId="postgresql">
        <![CDATA[select * from v_ibizcustomer t1     where  ibizcustomerid=#{id}]]>
    </select>
	<select id="selectById"  resultMap="IBIZCustomer_INTFResultMap" databaseId="sqlserver">
        <![CDATA[select * from v_ibizcustomer t1     where  ibizcustomerid=#{id}]]>
    </select>

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


    <!--数据集合[CurCustomer]-->
	 <select id="searchCurCustomer"  parameterType="cn.ibizlab.core.sample.filter.IBIZCustomer_INTFSearchContext"  resultMap="IBIZCustomer_INTFResultMap">
         select t1.* from (
                <include refid="CurCustomer" />
         )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>

    <!--数据集合[Default]-->
	 <select id="searchDefault"  parameterType="cn.ibizlab.core.sample.filter.IBIZCustomer_INTFSearchContext"  resultMap="IBIZCustomer_INTFResultMap">
         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>

    <!--数据查询[CurCustomer]-->
    <sql id="CurCustomer" databaseId="dm">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEDATE, t1.CREATEMAN, t1.CUSTOMERUID, t1.IBIZCUSTOMERID, t1.IBIZCUSTOMERNAME, t1.ORGID, t1.SN, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZCUSTOMER t1  
					 WHERE 	( t1.ORGID =  #{srf.datacontext.orgid} )
			]]>
    </sql>
    <!--数据查询[CurCustomer]-->
    <sql id="CurCustomer" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`CUSTOMERUID`, t1.`IBIZCUSTOMERID`, t1.`IBIZCUSTOMERNAME`, t1.`ORGID`, t1.`SN`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZCUSTOMER` t1  
					 WHERE 	( t1.`ORGID` =  #{srf.datacontext.orgid} )
			]]>
    </sql>
    <!--数据查询[CurCustomer]-->
    <sql id="CurCustomer" databaseId="postgresql">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEDATE, t1.CREATEMAN, t1.CUSTOMERUID, t1.IBIZCUSTOMERID, t1.IBIZCUSTOMERNAME, t1.ORGID, t1.SN, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZCUSTOMER t1  
					 WHERE 	( t1.ORGID =  #{srf.datacontext.orgid} )
			]]>
    </sql>
    <!--数据查询[CurCustomer]-->
    <sql id="CurCustomer" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[ADDRESS], t1.[CREATEDATE], t1.[CREATEMAN], t1.[CUSTOMERUID], t1.[IBIZCUSTOMERID], t1.[IBIZCUSTOMERNAME], t1.[SN], t1.[UPDATEDATE], t1.[UPDATEMAN] FROM [T_IBIZCUSTOMER] t1  
					 WHERE 	( t1.[CREATEMAN] =  #{srf.datacontext.createman} )
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="dm">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEDATE, t1.CREATEMAN, t1.CUSTOMERUID, t1.IBIZCUSTOMERID, t1.IBIZCUSTOMERNAME, t1.ORGID, t1.SN, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZCUSTOMER t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`CUSTOMERUID`, t1.`IBIZCUSTOMERID`, t1.`IBIZCUSTOMERNAME`, t1.`ORGID`, t1.`SN`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZCUSTOMER` t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="postgresql">
		<![CDATA[ SELECT t1.ADDRESS, t1.CREATEDATE, t1.CREATEMAN, t1.CUSTOMERUID, t1.IBIZCUSTOMERID, t1.IBIZCUSTOMERNAME, t1.ORGID, t1.SN, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZCUSTOMER t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[ADDRESS], t1.[CREATEDATE], t1.[CREATEMAN], t1.[CUSTOMERUID], t1.[IBIZCUSTOMERID], t1.[IBIZCUSTOMERNAME], t1.[SN], t1.[UPDATEDATE], t1.[UPDATEMAN] FROM [T_IBIZCUSTOMER] t1  
			]]>
    </sql>
</mapper>

