package cn.ysk.cashier.controller;

import cn.ysk.cashier.dto.TbMiniAppPagesDto;
import cn.ysk.cashier.mybatis.service.TbMiniAppPagesService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author GYJ
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/miniAppPages")
public class TbMiniAppPagesController {

    final private TbMiniAppPagesService tbMiniAppPagesService;

    @PostMapping
    @ApiOperation("新增/system/miniAppPages")
    public ResponseEntity<Object> createTbMiniAppPages(@Validated @RequestBody TbMiniAppPagesDto pagesDto) {
        return tbMiniAppPagesService.createTbMiniAppPages(pagesDto);
    }

    @PutMapping
    @ApiOperation("修改/system/miniAppPages")
    public ResponseEntity<Object> updateTbMiniAppPages(@Validated @RequestBody TbMiniAppPagesDto pagesDto) {
        return tbMiniAppPagesService.updateTbMiniAppPages(pagesDto);
    }

    @DeleteMapping("/{pagesId}")
    @ApiOperation("删除/system/miniAppPages")
    public ResponseEntity<Object> deleteTbMiniAppPages(@PathVariable Integer pagesId) {
        return tbMiniAppPagesService.deleteTbMiniAppPages(pagesId);
    }

    @GetMapping
    @ApiOperation("查询/system/miniAppPages")
    public ResponseEntity<Object> getTbMiniAppPages(@RequestParam Map<String, Object> params) {
        return tbMiniAppPagesService.getTbMiniAppPages(params);
    }
}
