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

    <select id="countList" resultType="integer"
            parameterType="com.crm.rely.backend.core.entity.system.push.massage.SysPushMassageSearchPageEntity">

        select count(*) from sys_push_massage
        <where>
            <if test="type!=null">
                and `type`=#{type}
            </if>
        </where>

    </select>

    <select id="searchPageList" resultType="com.crm.rely.backend.core.pojo.table.SysPushMassageTable"
            parameterType="com.crm.rely.backend.core.entity.system.push.massage.SysPushMassageSearchPageEntity">

        select * from sys_push_massage
        <where>
            <if test="type!=null">
                and `type`=#{type}
            </if>
        </where>
        order by sub_index
        <if test="page!=null">
            limit #{page.offset},#{page.row}
        </if>

    </select>

    <select id="searchList" resultType="com.crm.rely.backend.core.pojo.table.SysPushMassageTable"
            parameterType="com.crm.rely.backend.core.entity.system.push.massage.SysPushMassageSearchEntity">

        select * from sys_push_massage
        <where>
            <if test="type!=null">
                and `type` in(#{type},-1)
            </if>
        </where>
        order by `type` desc, sub_index

    </select>


</mapper>