package cn.ysk.cashier.controller.shop;

import cn.ysk.cashier.dto.shop.TbShopAdDto;
import cn.ysk.cashier.mybatis.service.TbShopAdService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author GYJ
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/ad")
public class TbShopAdController {
    final private TbShopAdService tbShopAdService;

    @PostMapping
    public ResponseEntity<Object> createTbShopAd(@RequestBody TbShopAdDto adDto) {
        return tbShopAdService.createTbShopAd(adDto);
    }

    @PutMapping
    public ResponseEntity<Object> updateTbShopAd(@RequestBody TbShopAdDto adDto) {
        return tbShopAdService.updateTbShopAd(adDto);
    }

    @DeleteMapping("/{adId}")
    public ResponseEntity<Object> deleteTbShopAd(@PathVariable Integer adId) {
        return tbShopAdService.deleteTbShopAd(adId);
    }

    @GetMapping
    public ResponseEntity<Object> getTbShopAd(@RequestParam Map<String, Object> params) {
        return tbShopAdService.getTbShopAd(params);
    }
}
