首页>代码>SpringBoot开发网站后台管理系统>/springboot-mini/src/main/java/com/zyxx/api/controller/IndexApiController.java
package com.zyxx.api.controller;

import com.zyxx.api.service.IndexApiService;
import com.zyxx.business.service.BannerInfoService;
import com.zyxx.business.service.NoticeInfoService;
import com.zyxx.common.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页相关
 *
 * @Author Lizhou
 * @Date 2020-09-25 10:28:28
 **/
@Api(tags = "首页相关")
@RestController
@RequestMapping("api/index")
public class IndexApiController {

    @Autowired
    private IndexApiService indexApiService;
    @Autowired
    private BannerInfoService bannerInfoService;
    @Autowired
    private NoticeInfoService noticeInfoService;

    @ApiOperation(value = "获取首页数据", notes = "获取首页数据")
    @GetMapping("initIndexData")
    public ResponseResult initIndexData() {
        return indexApiService.initIndexData();
    }

    @ApiOperation(value = "根据id获取轮播信息", notes = "根据id获取轮播信息")
    @ApiImplicitParams(@ApiImplicitParam(name = "id", value = "轮播id", required = true))
    @PostMapping("getBannerInfoById")
    public ResponseResult getBannerInfoById(Integer id) {
        if (null == id || 0 == id) {
            return ResponseResult.error("数据错误");
        }
        return ResponseResult.success(bannerInfoService.getById(id));
    }

    @ApiOperation(value = "根据id获取公告信息", notes = "根据id获取公告信息")
    @ApiImplicitParams(@ApiImplicitParam(name = "id", value = "公告id", required = true))
    @PostMapping("getNoticeInfoById")
    public ResponseResult getNoticeInfoById(Integer id) {
        if (null == id || 0 == id) {
            return ResponseResult.error("数据错误");
        }
        return ResponseResult.success(noticeInfoService.getById(id));
    }
}
最近下载更多
Luck_ZDM  LV11 4月12日
13521878735  LV3 3月26日
森sdfgf  LV8 2月8日
skook7  LV2 2023年12月14日
qwerdf963  LV3 2023年11月20日
JAVA小菜雀  LV7 2023年11月9日
edpwyg  LV14 2023年10月22日
asdsasddas  LV6 2023年4月20日
ming_123_9715  LV23 2023年4月9日
huangkexin  LV1 2023年4月4日
最近浏览更多
akittyboy  LV9 4月16日
HANCW  LV8 4月16日
Luck_ZDM  LV11 4月12日
宋金成 4月8日
暂无贡献等级
wwwwww1  LV12 4月8日
13521878735  LV3 3月26日
15103432984  LV2 3月16日
jay1992  LV14 3月11日
LoveAsY 3月10日
暂无贡献等级
407129151  LV6 2月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友