<?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="com.yonge.cooleshow.biz.dal.mapper.CooperateTenantMapper">
    <!-- 表字段 -->
    <sql id="baseColumns">
        t.id_ AS id
        , t.cooperate_tenant_name_ AS cooperateTenantName
        , t.cooperate_tenant_nature_ AS cooperateTenantNature
        , t.contacts_ AS contacts
        , t.phone_ AS phone
        , t.create_time_ AS createTime
        , t.update_time_ AS updateTime
    </sql>

    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.entity.CooperateTenant">
        SELECT
        <include refid="baseColumns"/>
        FROM cooperate_tenant t
        <where>
            <if test="param.keyword != null">
                and (t.cooperate_tenant_name_ like concat('%',#{param.keyword},'%')
                or t.contacts_ like concat('%',#{param.keyword},'%')
                or t.phone_ like concat('%',#{param.keyword},'%')
                )
            </if>
            <if test="param.cooperateTenantNature != null">
                and t.cooperate_tenant_nature_ = #{param.cooperateTenantNature}
            </if>
            <if test="param.submitStartTime != null">
                and t.create_time_ >= #{param.submitStartTime}
            </if>
            <if test="param.submitEndTime != null">
                and #{param.submitEndTime} >= t.create_time_
            </if>
        </where>
        order by t.update_time_ desc
    </select>
</mapper>