package com.bonus.canteen.core.android.controller;

import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.android.domain.BaseSetting;
import com.bonus.canteen.core.android.domain.CarouselImage;
import com.bonus.canteen.core.android.dto.AppDTO;
import com.bonus.canteen.core.android.service.BaseSettingService;
import com.bonus.canteen.core.android.service.DeviceService;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@Api(tags = "android-双屏消费机-设备信息")
@RestController
@RequestMapping("/android/baseSetting")
public class BaseSettingController extends BaseController {

    @Resource
    private BaseSettingService baseSettingService;



    @ApiOperation("添加从基础设置")
    @RequestMapping("/addBaseSetting")
    public AjaxResult addBaseSetting(@RequestBody BaseSetting baseSetting) {
        return baseSettingService.addBaseSetting(baseSetting);
    }

    @ApiOperation("根据key获取基础设置")
    @RequestMapping("/getBaseSettingByKey")
    public AjaxResult getBaseSettingByKey(@RequestBody BaseSetting baseSetting) {
        return success(baseSettingService.getBaseSettingByKey(baseSetting));
    }


    @ApiOperation("新增轮播图")
    @RequestMapping("/addCarouseImage")
    public AjaxResult addCarouseImage(@RequestBody CarouselImage carouselImage) {
        return success(baseSettingService.addCarouseImage(carouselImage));
    }
    @ApiOperation("删除轮播图")
    @RequestMapping("/delCarouseImageById")
    public AjaxResult delCarouseImageById(@RequestBody CarouselImage carouselImage) {
        return success(baseSettingService.delCarouseImageById(carouselImage));
    }

    @ApiOperation("修改轮播图")
    @RequestMapping("/updateCarouseImageById")
    public AjaxResult updateCarouseImageById(@RequestBody CarouselImage carouselImage) {
        return success(baseSettingService.updateCarouseImageById(carouselImage));
    }

    @ApiOperation("查询轮播图")
    @RequestMapping("/getCarouselImage")
    public AjaxResult getCarouselImage(@RequestBody CarouselImage carouselImage) {
        return success(baseSettingService.getCarouselImage(carouselImage));
    }



}
