/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ifish.mapper;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;

/**
 *
 * @author Administrator
 */
public class Tbl_Push_List_MapperSql {

    public String getPushList(@Param("userid") Integer userId, @Param("pushtype") String pushType, @Param("pagesize") Integer pageSize, @Param("first") Integer firstResult) {
        StringBuilder sb = new StringBuilder();

        sb.append("SELECT push_id,user_id,device_id,show_name,phone_type,push_type,push_title,push_context,create_time,push_link,jpush_status,google_status FROM TBL_PUSH_LIST WHERE ");
        sb.append("user_id = #{userid} ");
        if (StringUtils.isNotBlank(pushType)) {
            sb.append("AND push_type = #{pushtype} ");
        }
        sb.append("ORDER BY push_id DESC LIMIT ").append(firstResult).append(",").append(pageSize);

        return sb.toString();
    }

}
