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

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.finance.rate.FinanceRateSearchListEntity">

        select count(*) from finance_rate
        <where>
            <if test="type!=null ">
                and `type`=#{type}
            </if>
            <if test="currency!=null and currency!=''">
                and currency=#{currency}
            </if>
            <if test="transformCurrency!=null and transformCurrency!=''">
                and transform_currency=#{transformCurrency}
            </if>
        </where>

    </select>

    <select id="pageList" resultType="com.crm.rely.backend.core.pojo.table.FinanceRateTable"
            parameterType="com.crm.rely.backend.core.entity.finance.rate.FinanceRateSearchListEntity">

        select * from finance_rate
        <where>
            <if test="type!=null ">
                and `type`=#{type}
            </if>
            <if test="currency!=null and currency!=''">
                and currency=#{currency}
            </if>
            <if test="transformCurrency!=null and transformCurrency!=''">
                and transform_currency=#{transformCurrency}
            </if>
        </where>
        limit #{page.offset},#{page.row}
    </select>
    <select id="searchList" resultType="com.crm.rely.backend.core.pojo.table.FinanceRateTable"
            parameterType="com.crm.rely.backend.core.entity.finance.rate.FinanceRateSearchListEntity">

        select * from finance_rate
        <where>
            <if test="type!=null ">
                and `type`=#{type}
            </if>
            <if test="currency!=null and currency!=''">
                and currency=#{currency}
            </if>
            <if test="transformCurrency!=null and transformCurrency!=''">
                and transform_currency=#{transformCurrency}
            </if>
        </where>
    </select>

</mapper>