package com.ruoyi.web.work.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.work.service.IBannerService;
import com.ruoyi.web.work.service.IContractService;
import com.ruoyi.web.work.service.INewsService;
import com.ruoyi.web.work.service.INoticeService;
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;

/**
 * 通知公告
 *
 * @author 高伟森
 * @date 2024-04-18
 */
@RestController
@RequestMapping("/app/home")
public class Api_HomeController extends BaseController {
    @Autowired
    private INoticeService noticeService;

    @Autowired
    private IBannerService bannerService;

    @Autowired
    private IContractService contractService;

    @Autowired
    private INewsService newsService;


    @GetMapping("/banner/{type}")
    public AjaxResult banner(@PathVariable("type") Integer type) {
        return AjaxResult.success(bannerService.homeList(type));
    }

    @GetMapping("/news")
    public AjaxResult news() {
        return AjaxResult.success(newsService.homeList());
    }

    @GetMapping("/notice/{type}")
    public AjaxResult notice(@PathVariable("type") String type) {
        return AjaxResult.success(noticeService.homeList(type));
    }

    @GetMapping("/contract")
    public AjaxResult contract() {
        return AjaxResult.success(contractService.selectContract());
    }
}
