<?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.CustomAllocationRosterAreaMapper">
    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.area.CustomAllocationRosterAreaSearchEntity">
        select count(*) from custom_allocation_roster_area
        <where>
            <if test="name != null and name!=''">
                and `name` like concat(#{name},'%')
            </if>
            <if test="country != null and country!=''">
                FIND_IN_SET(#{country}, country)
            </if>
        </where>
    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.CustomAllocationRosterAreaTable"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.area.CustomAllocationRosterAreaSearchEntity">
        select * from custom_allocation_roster_area
        <where>
            <if test="name != null and name!=''">
                and `name` like concat(#{name},'%')
            </if>
            <if test="country != null and country!=''">
                FIND_IN_SET(#{country}, country)
            </if>
        </where>
        order by id desc
        <if test="page != null">
            limit #{page.offset},#{page.row}
        </if>
    </select>
</mapper>