package com.sqx.modules.activity.controller;

import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.activity.dto.ActivityPartRecordQueryDTO;
import com.sqx.modules.activity.service.ActivityPartRecordService;
import com.sqx.modules.activity.vo.ActivityPartRecordVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动参与记录
 * @author : codingliang
 * @date : 2024-6-24
 */
@Api(tags = "活动-活动参与记录管理")
@RestController
@RequestMapping("admin/activity-part-record")
@RequiredArgsConstructor
public class ActivityPartRecordController{

    private final ActivityPartRecordService activityPartRecordService;

    @GetMapping("page")
    @ApiOperation(value = "活动参与记录分页", response = PageUtils.class)
    public Result page(ActivityPartRecordQueryDTO queryDTO) {
        PageUtils page = activityPartRecordService.page(queryDTO);
        return Result.success().put("data", page);
    }

    @GetMapping("{id}")
    @ApiOperation(value = "根据id获取活动参与记录信息", response = ActivityPartRecordVO.class)
    public Result getById(@PathVariable @ApiParam("记录id") Long id) {
        ActivityPartRecordVO vo = activityPartRecordService.getVoById(id);
        return Result.success().put("data", vo);
    }
}
