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

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

        select count(*) from user_hire
        <where>
            <if test="hireName!=null and hireName!=''">
                and `hire_name` like concat(#{hireName},"%")
            </if>
            <if test="phoneNumbe!=null and phoneNumbe!=''">
                and `phone_numbe`=#{phoneNumbe}
            </if>
            <if test="email!=null and email!=''">
                and `email`=#{email}
            </if>
        </where>
    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.UserHireTable"
            parameterType="com.crm.rely.backend.core.entity.user.info.UserHireSearchEntity">
        select * from user_hire
        <where>
            <if test="hireName!=null and hireName!=''">
                and `hire_name` like concat(#{hireName},"%")
            </if>
            <if test="phoneNumbe!=null and phoneNumbe!=''">
                and `phone_numbe`=#{phoneNumbe}
            </if>
            <if test="email!=null and email!=''">
                and `email`=#{email}
            </if>
        </where>
        order by id desc
        limit #{page.offset},#{page.row}
    </select>

</mapper>