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


    <select id="selectList" resultType="com.crm.rely.backend.core.pojo.table.CustomAllocationRosterCommentTable"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.comment.CustomAllocationRosterCommentSearchEntity">
        select *
        from custom_allocation_roster_comment
        <include refid="selectCondition"></include>
        order by add_time desc
        <if test="page != null">
            limit #{page.offset},#{page.row}
        </if>
    </select>
    <select id="selectCount" resultType="java.lang.Integer"
            parameterType="com.crm.rely.backend.core.entity.custom.allocation.roster.comment.CustomAllocationRosterCommentSearchEntity">
        select count(*)
        from custom_allocation_roster_record
        <include refid="selectCondition"></include>

    </select>

    <sql id="selectCondition">
        <where>
            <if test="allocationRosterId!=null">
                and allocation_roster_id =#{allocationRosterId}
            </if>
            <if test="startDate != null">
                and add_time <![CDATA[>=]]>#{startDate}
            </if>
            <if test="endDate != null">
                and add_time <![CDATA[<=]]>#{endDate}
            </if>
        </where>
    </sql>
</mapper>