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

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

    <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
    <resultMap id="IBIZSample0001ResultMap" type="cn.ibizlab.core.sample.domain.IBIZSample0001" autoMapping="true">
		<id property="ibizsample0001id" column="ibizsample0001id" /><!--主键字段映射-->
		<result property="ibizsample0002id" column="ibizsample0002id" />
            
		
		<!--通过mybatis自动注入关系属性[主实体]，fetchType="lazy"为懒加载配置 -->
		<association property="sample0002Sample00011N" javaType="cn.ibizlab.core.sample.domain.IBIZSample0002" column="ibizsample0002id" select="cn.ibizlab.core.sample.mapper.IBIZSample0002Mapper.selectById" fetchType="lazy"></association>
    </resultMap>

	<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_IBIZSAMPLE0001_IBIZSAMPLE0002_IBIZSAMPLE0002ID] -->
	 <select id="selectByIbizsample0002id" resultMap="IBIZSample0001ResultMap">
         select t1.* from (
                <include refid="Default" />
			 ) t1
			 where  ibizsample0002id=#{ibizsample0002id}
     </select>

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

    <!--数据查询[Default]-->
    <sql id="Default" databaseId="dm">
		<![CDATA[ SELECT t1.CREATEDATE, t1.CREATEMAN, t1.FIELD01, t1.FIELD02, t1.FIELD05, t1.FIELD06, t1.FIELD07, t1.FIELD08, t1.FIELD09, t1.FIELD10, t1.FIELD11, t1.FIELD12, t1.FIELD13, t1.FIELD14, t1.FIELD15, t1.FIELD16, t1.FIELD17, t1.FIELD18, t1.FIELD19, t1.FIELD20, t1.FIELD21, t1.FIELD22, t1.FIELD24, t1.FIELD27, t1.IBIZSAMPLE0001ID, t1.IBIZSAMPLE0001NAME, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZSAMPLE0001 t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="hana">
		<![CDATA[ SELECT t1.\"CREATEDATE\", t1.\"CREATEMAN\", t1.\"FIELD01\", t1.\"FIELD02\", t1.\"FIELD05\", t1.\"FIELD06\", t1.\"FIELD07\", t1.\"FIELD08\", t1.\"FIELD09\", t1.\"FIELD10\", t1.\"FIELD11\", t1.\"FIELD12\", t1.\"FIELD13\", t1.\"FIELD14\", t1.\"FIELD15\", t1.\"FIELD16\", t1.\"FIELD17\", t1.\"FIELD18\", t1.\"FIELD19\", t1.\"FIELD20\", t1.\"FIELD21\", t1.\"FIELD22\", t1.\"IBIZSAMPLE0001ID\", t1.\"IBIZSAMPLE0001NAME\", t1.\"UPDATEDATE\", t1.\"UPDATEMAN\" FROM \"T_IBIZSAMPLE0001\" t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="mysql">
		<![CDATA[ SELECT t1.`ADDRESS`, t1.`CITY`, t1.`COLOR`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DISKIMG`, t1.`FIELD`, t1.`FIELD01`, t1.`FIELD02`, t1.`FIELD05`, t1.`FIELD06`, t1.`FIELD07`, t1.`FIELD08`, t1.`FIELD09`, t1.`FIELD10`, t1.`FIELD11`, t1.`FIELD12`, t1.`FIELD13`, t1.`FIELD14`, t1.`FIELD15`, t1.`FIELD16`, t1.`FIELD17`, t1.`FIELD18`, t1.`FIELD19`, t1.`FIELD2`, t1.`FIELD20`, t1.`FIELD21`, t1.`FIELD22`, t1.`FIELD24`, t1.`FIELD27`, t1.`IBIZSAMPLE0001ID`, t1.`IBIZSAMPLE0001NAME`, t1.`IBIZSAMPLE0002ID`, t1.`IBIZSAMPLE0002NAME`, t1.`IP`, t1.`LATITUDE`, t1.`LONGITUDE`, t1.`PICTURE`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZSAMPLE0001` t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="postgresql">
		<![CDATA[ SELECT t1.CREATEDATE, t1.CREATEMAN, t1.FIELD01, t1.FIELD02, t1.FIELD05, t1.FIELD06, t1.FIELD07, t1.FIELD08, t1.FIELD09, t1.FIELD10, t1.FIELD11, t1.FIELD12, t1.FIELD13, t1.FIELD14, t1.FIELD15, t1.FIELD16, t1.FIELD17, t1.FIELD18, t1.FIELD19, t1.FIELD20, t1.FIELD21, t1.FIELD22, t1.FIELD24, t1.FIELD27, t1.IBIZSAMPLE0001ID, t1.IBIZSAMPLE0001NAME, t1.UPDATEDATE, t1.UPDATEMAN FROM T_IBIZSAMPLE0001 t1  
			]]>
    </sql>
    <!--数据查询[Default]-->
    <sql id="Default" databaseId="sqlserver">
		<![CDATA[ SELECT t1.[CREATEDATE], t1.[CREATEMAN], t1.[FIELD01], t1.[FIELD02], t1.[FIELD05], t1.[FIELD06], t1.[FIELD07], t1.[FIELD08], t1.[FIELD09], t1.[FIELD10], t1.[FIELD11], t1.[FIELD12], t1.[FIELD13], t1.[FIELD14], t1.[FIELD15], t1.[FIELD16], t1.[FIELD17], t1.[FIELD18], t1.[FIELD19], t1.[FIELD20], t1.[FIELD21], t1.[FIELD22], t1.[FIELD23], t1.[FIELD24], t1.[FIELD25], t1.[FIELD26], t1.[FIELD27], t1.[IBIZSAMPLE0001ID], t1.[IBIZSAMPLE0001NAME], t1.[UPDATEDATE], t1.[UPDATEMAN] FROM [T_IBIZSAMPLE0001] t1  
			]]>
    </sql>
</mapper>

