package cn.com.ty.lift.ud.bannerImage.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.service.IService;

import cn.com.ty.lift.ud.bannerImage.controller.query.BannerImageQuery;
import cn.com.ty.lift.ud.bannerImage.mapper.entity.BannerImageEntity;
import cn.com.ty.lift.ud.bannerImage.service.IBannerImageService;
import cn.com.ty.lift.ud.common.BaseController;
import cn.com.ty.lift.ud.common.DelReq;
import cn.com.xwy.boot.web.dto.RestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 轮播图 轮播图管理API
 * 
 * @author Xson
 * @date 2020-04-23
 */
@Api(tags = "轮播图 轮播图管理API- 魏瑞锋")
@RestController
@RequestMapping("/api/bannerImages")
public class BannerImageController
    extends BaseController<BannerImageEntity, BannerImageQuery> {

    private final Logger log = LoggerFactory.getLogger(BannerImageController.class);
    
    private @Autowired IBannerImageService bannerImageService;

    @Override
    protected IService<BannerImageEntity> getService() {
        return bannerImageService;
    }
    
    @ApiOperation(value = "批量启用")
    @PostMapping("useBath")
    public RestResponse useBath(@RequestBody DelReq ids) {
        bannerImageService.updateByIds(ids.getIds(),1);
        return RestResponse.success("启用成功");
    }
    
    @ApiOperation(value = "批量关闭")
    @PostMapping("noUseBath")
    public RestResponse noUseBath(@RequestBody DelReq ids) {
        bannerImageService.updateByIds(ids.getIds(),0);
        return RestResponse.success( "关闭成功");
    }
}