<?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.CustomAllocationRosterScheduledMapper">
    <select id="countList"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.scheduled.CustomAllocationRosterScheduledSearchEntity"
            resultType="java.lang.Integer">
        SELECT
        count(*)
        FROM
        custom_allocation_roster_scheduled cars
        <where>
            <if test="startDate != null">
                and add_time <![CDATA[ >= ]]> #{startDate}
            </if>
            <if test="endDate != null">
                and add_time <![CDATA[ < ]]> #{endDate}
            </if>
        </where>
    </select>

    <select id="pageList"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.scheduled.CustomAllocationRosterScheduledSearchEntity"
            resultType="com.crm.rely.backend.core.pojo.table.CustomAllocationRosterScheduledTable">
        SELECT
        *
        FROM
        custom_allocation_roster_scheduled cars
        <where>
            <if test="startDate != null">
                and add_time <![CDATA[ >= ]]> #{startDate}
            </if>
            <if test="endDate != null">
                and add_time <![CDATA[ < ]]> #{endDate}
            </if>
        </where>
        order by add_time desc
        <if test="page!=null">
            limit #{page.offset},#{page.row}
        </if>
    </select>
</mapper>