<?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.zhentao.mapper.MarrApplyMapper">

    <resultMap id="BaseResultMap" type="com.zhentao.entity.MarrApply">
            <id property="applyId" column="apply_id" />
            <result property="userId" column="user_id" />
            <result property="name" column="name" />
            <result property="phone" column="phone" />
            <result property="email" column="email" />
            <result property="age" column="age" />
            <result property="gender" column="gender" />
            <result property="area" column="area" />
            <result property="experience" column="experience" />
            <result property="serverTime" column="server_time" />
            <result property="introduction" column="introduction" />
            <result property="createTime" column="create_time" />
            <result property="createMan" column="create_man" />
            <result property="updateTime" column="update_time" />
            <result property="updateMan" column="update_man" />
            <result property="status" column="status" />
            <result property="idStatus" column="id_status" />
            <result property="reason" column="reason" />
    </resultMap>

    <sql id="Base_Column_List">
        apply_id,user_id,name,phone,email,age,
        gender,area,experience,server_time,introduction,
        create_time,create_man,update_time,update_man,status,id_status,reason
    </sql>

    <select id="selectPageByCondition" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM marr_apply
        <where>
            AND (id_status = '0' OR id_status IS NULL)
            <if test="name != null and name != ''">
                AND name LIKE CONCAT('%', #{name}, '%')
            </if>
            <if test="phone != null and phone != ''">
                AND phone LIKE CONCAT('%', #{phone}, '%')
            </if>
        </where>
        ORDER BY create_time DESC
    </select>
</mapper>
