package com.usky.system.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.system.domain.SysMobileBanner;
import com.usky.system.service.SysMobileBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 移动端_banner图配置表 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-03-30
 */
@RestController
@RequestMapping("/sysMobileBanner")
public class SysMobileBannerController extends BaseController{

    @Autowired
    private SysMobileBannerService sysMobileBannerService;

    /**
     * 租户管理-系统配置-移动端banner图配置新增
     *
     * @param sysMobileBanner
     * @return
     */
    @PostMapping("addMobileBanner")
    public ApiResult<Void> addMobileBanner(@RequestBody SysMobileBanner sysMobileBanner){
        sysMobileBannerService.addMobileBanner(sysMobileBanner);
        return ApiResult.success();
    }

    /**
     * 租户管理-系统配置-移动端banner图配置修改
     *
     * @param sysMobileBanner
     * @return
     */
    @PutMapping("updateMobileBanner")
    public ApiResult<Void> updateMobileBanner(@RequestBody SysMobileBanner sysMobileBanner) {
        sysMobileBannerService.updateMobileBanner(sysMobileBanner);
        return ApiResult.success();
    }

    /**
     * 租户管理-系统配置-移动端banner图配置查询
     *
     * @param tenantId 租户ID
     * @return
     */
    @GetMapping("getMobileBanner")
    public ApiResult<List<SysMobileBanner>> getMobileBanner(@RequestParam Integer tenantId) {
        return ApiResult.success(sysMobileBannerService.getMobileBanner(tenantId));
    }
}

