首页>代码>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));
    }
}
最近下载更多
15578157792  LV7 2024年10月24日
Tomcat80  LV5 2024年8月14日
9605451tjb  LV4 2024年8月7日
TY0165  LV20 2024年6月18日
llllllK  LV5 2024年5月13日
Luck_ZDM  LV12 2024年4月12日
13521878735  LV3 2024年3月26日
森sdfgf  LV8 2024年2月8日
skook7  LV2 2023年12月14日
qwerdf963  LV3 2023年11月20日
最近浏览更多
gann2015  LV25 6月6日
哪里的完整版  LV8 2月26日
Boss绝  LV10 1月27日
ma406805131  LV19 2024年12月19日
wjh007  LV5 2024年12月17日
sjwc88  LV4 2024年12月4日
王愉悦  LV4 2024年12月3日
haomc052829  LV4 2024年12月3日
shaohuaqingfu  LV3 2024年11月6日
15578157792  LV7 2024年10月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友