<?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.crm.manager.dao.mapper.UserResignMapper">

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.user.info.UserResignSearchEntity">

        select count(*) from user_resign
        <where>
            <if test="name!=null and name!=''">
                and `name` like concat(#{name},"%")
            </if>
            <if test="userName!=null and userName!=''">
                and `user_name` like concat(#{userName},"%")
            </if>
            <if test="email!=null and email!=''">
                and `email` = #{email}
            </if>
            <if test="resignStatus!=null">
                and `resign_status`= #{resignStatus}
            </if>
            <if test="ibNo!=null and ibNo!=''">
                and `ib_no` = #{ibNo}
            </if>
        </where>
    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.UserResignTable"
            parameterType="com.crm.rely.backend.core.entity.user.info.UserResignSearchEntity">
        select * from user_resign
        <where>
            <if test="name!=null and name!=''">
                and `name` like concat(#{name},"%")
            </if>
            <if test="userName!=null and userName!=''">
                and `user_name` like concat(#{userName},"%")
            </if>
            <if test="email!=null and email!=''">
                and `email` = #{email}
            </if>
            <if test="resignStatus!=null">
                and `resign_status`= #{resignStatus}
            </if>
            <if test="ibNo!=null and ibNo!=''">
                and `ib_no` = #{ibNo}
            </if>
        </where>
        order by id desc
        <if test="page != null">
            limit #{page.offset},#{page.row}
        </if>
    </select>

</mapper>