package com.jeeplus.pubmodules.luckyDraw.controller.app;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.logging.annotation.ApiLog;
import com.jeeplus.pubmodules.luckyDraw.service.LuckyDrawEventsService;
import com.jeeplus.pubmodules.luckyDraw.service.dto.LuckyDrawEventsDTO;
import io.swagger.annotations.Api;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api("app-活动")
@RestController
@RequestMapping(value = "/app/luckyDraw/events")
public class AppLuckyDrawEventsController {

    @Resource
    private LuckyDrawEventsService luckyDrawEventsService;

    @ApiLog("活动列表")
    @GetMapping("list")
    public ResponseEntity<IPage<LuckyDrawEventsDTO>> data_app(LuckyDrawEventsDTO luckyDrawEventsDTO, Page<LuckyDrawEventsDTO> page) throws Exception {
        IPage<LuckyDrawEventsDTO> result = new Page<LuckyDrawEventsDTO>();
        result = luckyDrawEventsService.findList (page,luckyDrawEventsDTO);
        return ResponseEntity.ok (result);
    }

    @ApiLog("查询活动数据详情")
    @GetMapping("queryById")
    public ResponseEntity queryById(@RequestParam("id") String id) {
        LuckyDrawEventsDTO luckyDrawEventsDTO = luckyDrawEventsService.queryById ( id );
        return ResponseEntity.ok (luckyDrawEventsDTO);
    }



}
