package com.ruoyi.web.work.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.work.domain.News;
import com.ruoyi.web.work.service.INewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 企业管理
 *
 * @author lsw
 * @date 2024-04-16
 */
@RestController
@RequestMapping("/app/news")
public class Api_NewsController extends BaseController {

    @Autowired
    private INewsService newsService;

    @GetMapping("/list")
    public TableDataInfo list(News news) {
        news.setState(0);
        startPage();
        List<News> list = newsService.selectList(news);
        return getDataTable(list);
    }

    @GetMapping("/detail/{id}")
    public AjaxResult detail(@PathVariable("id") Long id) {
        return newsService.detail(id);
    }
}
