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

    <!--该方法用于重写mybatis中selectById方法，以实现查询逻辑属性-->
	<select id="selectById"  resultMap="MicroComponentResultMap" databaseId="mysql">
        <![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`FIELD`, 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.`FIELD23`, t1.`FIELD24`, t1.`FIELD25`, t1.`FIELD26`, t1.`FIELD27`, t1.`FIELD28`, t1.`FIELD29`, t1.`FIELD3`, t1.`FIELD30`, t1.`FIELD31`, t1.`FIELD32`, t1.`FIELD33`, t1.`FIELD34`, t1.`FIELD35`, t1.`FIELD36`, t1.`FIELD37`, t1.`FIELD38`, t1.`FIELD39`, t1.`FIELD4`, t1.`FIELD40`, t1.`FIELD5`, t1.`FIELD6`, t1.`FIELD7`, t1.`FIELD8`, t1.`FIELD9`, t1.`MICROCOMPONENTID`, t1.`MICROCOMPONENTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_MICROCOMPONENT` t1  ) t1 where microcomponentid=#{id}]]>
    </select>

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


    <!--数据集合[Default]-->
	 <select id="searchDefault"  parameterType="cn.ibizlab.core.sample.filter.MicroComponentSearchContext"  resultMap="MicroComponentResultMap">
         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="mysql">
		<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`FIELD`, 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.`FIELD23`, t1.`FIELD24`, t1.`FIELD25`, t1.`FIELD26`, t1.`FIELD27`, t1.`FIELD28`, t1.`FIELD29`, t1.`FIELD3`, t1.`FIELD30`, t1.`FIELD31`, t1.`FIELD32`, t1.`FIELD33`, t1.`FIELD34`, t1.`FIELD35`, t1.`FIELD36`, t1.`FIELD37`, t1.`FIELD38`, t1.`FIELD39`, t1.`FIELD4`, t1.`FIELD40`, t1.`FIELD5`, t1.`FIELD6`, t1.`FIELD7`, t1.`FIELD8`, t1.`FIELD9`, t1.`MICROCOMPONENTID`, t1.`MICROCOMPONENTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_MICROCOMPONENT` t1  
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="mysql">
		<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`FIELD`, 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.`FIELD23`, t1.`FIELD24`, t1.`FIELD25`, t1.`FIELD26`, t1.`FIELD27`, t1.`FIELD28`, t1.`FIELD29`, t1.`FIELD3`, t1.`FIELD30`, t1.`FIELD31`, t1.`FIELD32`, t1.`FIELD33`, t1.`FIELD34`, t1.`FIELD35`, t1.`FIELD36`, t1.`FIELD37`, t1.`FIELD38`, t1.`FIELD39`, t1.`FIELD4`, t1.`FIELD40`, t1.`FIELD5`, t1.`FIELD6`, t1.`FIELD7`, t1.`FIELD8`, t1.`FIELD9`, t1.`MICROCOMPONENTID`, t1.`MICROCOMPONENTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_MICROCOMPONENT` t1  
			]]>
    </sql>
</mapper>

