<?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.custom.dao.mapper.GoldenQuestionCustomMapper">

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionSearchEntity">
        select count(*) from golden_question_custom
        <where>
            <if test="question!=null and question!=''">
                and question like concat('%',#{question},'%')
            </if>
        </where>
    </select>

    <select id="pageList" resultType="com.crm.rely.backend.model.pojo.table.GoldenQuestionCustomTable"
            parameterType="com.crm.rely.backend.model.entity.golden.question.GoldenRewardQuestionSearchEntity">
        select * from golden_question_custom
        <where>
            <if test="question!=null and question!=''">
                and question like concat('%',#{question},'%')
            </if>
        </where>
        order by id desc
        <if test="page != null">
            limit #{page.offset},#{page.row}
        </if>
    </select>

    <select id="getCountQuestionByDate" resultType="integer">
        select * from golden_question_custom
        where custom_id = #{customId} and add_time <![CDATA[ >= ]]> #{startDate} and add_time <![CDATA[ < ]]> #{endDate}
        limit 1
    </select>

</mapper>