package com.pj.tb_port_news;

import com.pj.utils.sg.AjaxJson;
import com.pj.utils.so.SoMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * APP端口岸资讯
 *
 * @author loovi
 * @date
 */
@RestController
@RequestMapping("/app/TbPortNews/")
public class TbPortNewsAppController {

    @Autowired
    TbPortNewsService tbPortNewsService;

    /**
     * APP端获取最新的口岸资讯
     *
     * @author loovi
     * @date
     */
    @RequestMapping("getNewestList")
    public AjaxJson getNewestList(Long limit) {
        return tbPortNewsService.getNewestList(limit);
    }

    /**
     * APP端获取口岸资讯列表
     *
     * @author loovi
     * @date
     */
    @RequestMapping("getPortNewsList")
    public AjaxJson getPortNewsList() {
        SoMap so = SoMap.getRequestSoMap();
        so.put("isRelease", 1);
        List<TbPortNews> list = tbPortNewsService.getList(so.startPage());
        return AjaxJson.getPageData(so.getDataCount(), list);
    }

    @GetMapping("getById")
    public AjaxJson getById(Long id) {
        return tbPortNewsService.getPortNewsDetails(id);
    }
}
