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

    <select id="countList" parameterType="com.crm.rely.backend.core.entity.sales.SalesDpsBasicSalaryListEntity" resultType="Integer">
        select count(sdbs.id)
        from sales_dps_basic_salary sdbs
        <include refid="listWhere"></include>
    </select>

    <select id="findList" parameterType="com.crm.rely.backend.core.entity.sales.SalesDpsBasicSalaryListEntity" resultType="com.crm.rely.backend.core.pojo.table.SalesDpsBasicSalaryTable">
        select sdbs.*
        from sales_dps_basic_salary sdbs
        <include refid="listWhere"></include>
        <if test="page != null">
            limit #{page.offset},#{page.row}
        </if>
    </select>

    <sql id="listWhere">
        <where>
            <if test="salesNo != null and salesNo != ''">
                and sdbs.sales_no  like concat('%',#{salesNo},'%')
            </if>
            <if test="ym != null and ym != ''">
                and sdbs.ym = #{ym}
            </if>
        </where>
    </sql>
</mapper>