package com.aidex.web.controller.app;


import com.aidex.common.app.server.IAppService;
import com.aidex.common.core.domain.R;
import com.aidex.system.domain.SysNotice;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;


@RestController
@RequestMapping("/app")
@Tag(name = "小程序相关接口", description = "小程序管调用接口")
public class AppController {


    @Autowired
    private IAppService iAppService;

    @GetMapping("/carousel")
    @ApiOperation(value = "获取轮播信息", notes = "获取轮播信息", produces = "application/json")
    public R<List<SysNotice>> carousel()
    {
        return R.data(iAppService.getCarouselList());
    }

    @GetMapping("/notice")
    @ApiOperation(value = "获取通知公告", notes = "获取通知公告", produces = "application/json")
    public R<List<SysNotice>> notice()
    {
        return R.data(iAppService.getNoticeList());
    }

    @GetMapping("/noticeAndCarouseldetails/{id}")
    @ApiOperation(value = "获取轮播或公告详情", notes = "获取轮播或公告详情", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "数据主键ID", required = true, dataType = "String", paramType = "query")})
    public R<SysNotice> noticeAndCarouseldetails(@PathVariable("id") String id)
    {
        return R.data(iAppService.findCarouselAndNoticeDetails(id));
    }
}
