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

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.custom.remark.CustomRemarkSearchListEntity">

        select count(*) from custom_remark
        <where>
            <if test="customId!=null ">
                and `custom_id`=#{customId}
            </if>
            <if test="userId!=null ">
                and `user_id`=#{userId}
            </if>
        </where>

    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.CustomRemarkTable"
            parameterType="com.crm.rely.backend.core.entity.custom.remark.CustomRemarkSearchListEntity">

        select * from custom_remark
        <where>
            <if test="customId!=null ">
                and `custom_id`=#{customId}
            </if>
            <if test="userId!=null ">
                and `user_id`=#{userId}
            </if>
        </where>
        order by add_time desc
        limit #{page.offset},#{page.row}
    </select>


</mapper>