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

    <!--该方法用于重写mybatis中selectById方法，以实现查询逻辑属性-->
	<select id="selectById"  resultMap="IBIZBOOKResultMap" databaseId="mysql">
        <![CDATA[select t1.* from (SELECT t1.`AUTHOR`, t1.`BOOKNUMBER`, t1.`BORROWER`, t1.`BORROWER1`, t1.`BORROWER1_ID`, t1.`BORROWER2`, t1.`BORROWER2_ID`, t1.`BORROWER3`, t1.`BORROWER3_ID`, t1.`BORROWERID`, t1.`BORROWSTATUS`, t1.`BORROWWAY`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`IBIZBOOKID`, t1.`IBIZBOOKNAME`, t1.`ICON`, t1.`LENDOUTTIME`, t1.`PRESS`, t1.`PRICE`, t1.`RETURNLIB`, t1.`RETURNTIME`, t1.`SAILSTATE`, t1.`STEPSTATUS`, t1.`SUBTEXT`, t1.`TAG`, t1.`TYPE`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZBOOK` t1  ) t1 where ibizbookid=#{id}]]>
    </select>

    <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
    <resultMap id="IBIZBOOKResultMap" type="cn.ibizlab.core.sample.domain.IBIZBOOK" autoMapping="true">
		<id property="ibizbookid" column="ibizbookid" /><!--主键字段映射-->
		<result property="borrower1Id" column="borrower1_id" />
		<result property="borrower2Id" column="borrower2_id" />
		<result property="borrower3Id" column="borrower3_id" />
            
		
    </resultMap>


    <!--数据集合[Default]-->
	 <select id="searchDefault"  parameterType="cn.ibizlab.core.sample.filter.IBIZBOOKSearchContext"  resultMap="IBIZBOOKResultMap">
         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.`AUTHOR`, t1.`BOOKNUMBER`, t1.`BORROWER`, t1.`BORROWER1_ID`, t1.`BORROWER2`, t1.`BORROWER2_ID`, t1.`BORROWER3_ID`, t1.`BORROWERID`, t1.`BORROWSTATUS`, t1.`BORROWWAY`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`IBIZBOOKID`, t1.`IBIZBOOKNAME`, t1.`ICON`, t1.`LENDOUTTIME`, t1.`PRESS`, t1.`PRICE`, t1.`RETURNLIB`, t1.`RETURNTIME`, t1.`SAILSTATE`, t1.`STEPSTATUS`, t1.`SUBTEXT`, t1.`TYPE`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZBOOK` t1  
			]]>
    </sql>
    <!--数据查询[View]-->
    <sql id="View" databaseId="mysql">
		<![CDATA[ SELECT t1.`AUTHOR`, t1.`BOOKNUMBER`, t1.`BORROWER`, t1.`BORROWER1`, t1.`BORROWER1_ID`, t1.`BORROWER2`, t1.`BORROWER2_ID`, t1.`BORROWER3`, t1.`BORROWER3_ID`, t1.`BORROWERID`, t1.`BORROWSTATUS`, t1.`BORROWWAY`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`IBIZBOOKID`, t1.`IBIZBOOKNAME`, t1.`ICON`, t1.`LENDOUTTIME`, t1.`PRESS`, t1.`PRICE`, t1.`RETURNLIB`, t1.`RETURNTIME`, t1.`SAILSTATE`, t1.`STEPSTATUS`, t1.`SUBTEXT`, t1.`TAG`, t1.`TYPE`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `T_IBIZBOOK` t1  
			]]>
    </sql>
</mapper>

