<?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.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformAccountMapperExt">

    <select id="getTelNumExists"
            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
        select *
        from content_platform_account
        where tel_num = #{telNum}
        <if test="id != null">
            and id != #{id}
        </if>
        limit 1
    </select>

    <select id="getChannelExists"
            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
        select *
        from content_platform_account
        where channel = #{channel}
        <if test="id != null">
            and id != #{id}
        </if>
        limit 1
    </select>

    <select id="getAccountCount" resultType="java.lang.Integer">
        select count(1)
        from content_platform_account
    </select>

    <select id="getAccountList"
            resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformAccount">
        select *
        from content_platform_account
        <if test="param!=null">
            <where>
                <if test="param.name != null and param.name !=''">
                    and name like concat('%', #{param.name}, '%')
                </if>
            </where>
        </if>
        order by create_timestamp desc
        limit #{offset}, #{pageSize}
    </select>

</mapper>