package cn.com.ty.lift.system.banner.controller;


import cn.com.ty.lift.system.banner.dao.entity.BannerImage;
import cn.com.ty.lift.system.banner.service.impl.BannerImageServiceImpl;
import cn.com.xwy.boot.web.dto.RestResponse;
import lombok.AllArgsConstructor;
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;

/**
 * <p>
 * banner图管理 前端控制器
 * </p>
 *
 * @author wang-hai-cheng
 * @since 2019-12-31
 */
@RestController
@AllArgsConstructor
@RequestMapping("/banner")
public class BannerImageController {
    private final BannerImageServiceImpl bannerService;

    /**
     * 查询banner列表
     *
     * @param bannerImage banner的type
     * @return RestResponse banner列表
     */
    @PostMapping("/list")
    public RestResponse list(@RequestBody BannerImage bannerImage) {
        return bannerService.banners(bannerImage);
    }

    /**
     * 新增banner
     *
     * @param bannerImage 要新增的信息
     * @return RestResponse 操作结果
     */
    @PostMapping("/add")
    public RestResponse add(@RequestBody BannerImage bannerImage) {
        return bannerService.modify(bannerImage);
    }

    /**
     * 修改banner
     *
     * @param bannerImage 要修改的信息
     * @return RestResponse 操作结果
     */
    @PostMapping("/modify")
    public RestResponse modify(@RequestBody BannerImage bannerImage) {
        return bannerService.modify(bannerImage);
    }

    /**
     * 删除banner
     *
     * @param bannerImage 要删除的banner的id
     * @return RestResponse 操作结果
     */
    @PostMapping("/delete")
    public RestResponse delete(@RequestBody BannerImage bannerImage) {
        return bannerService.delete(bannerImage);
    }
}