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

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.risk.leverage.group.RiskLeverageGroupSearchPageEntity">

        select count(*)
        from risk_leverage_group
        <where>
            <if test="platform != null and platform != ''">
                and platform=#{platform}
            </if>
            <if test="groupCode != null and groupCode != ''">
                and group_code=#{groupCode}
            </if>
            <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" resultType="com.crm.rely.backend.core.pojo.table.RiskLeverageGroupTable"
            parameterType="com.crm.rely.backend.core.entity.risk.leverage.group.RiskLeverageGroupSearchPageEntity">

        select *
        from risk_leverage_group
        <where>
            <if test="platform != null and platform != ''">
                and platform=#{platform}
            </if>
            <if test="groupCode != null and groupCode != ''">
                and group_code=#{groupCode}
            </if>
            <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>