package com.yonge.cooleshow.admin.controller;

import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.toolset.base.page.PageInfo;
import com.yonge.toolset.mybatis.support.PageUtil;

import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationRecordVo;
import com.yonge.cooleshow.biz.dal.dto.search.ActivityEvaluationRecordSearch;
import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationRecordService;

@RestController
@RequestMapping("/activityEvaluationRecord")
@Api(value = "评测活动参与记录表", tags = "评测活动参与记录表")
public class ActivityEvaluationRecordController extends BaseController {

    @Autowired
    private ActivityEvaluationRecordService activityEvaluationRecordService;

	/**
     * 查询单条
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "详情", notes = "传入id")
    @PreAuthorize("@pcs.hasPermissions('activityEvaluationRecord/detail')")
    public HttpResponseResult<ActivityEvaluationRecordVo> detail(@PathVariable("id") Long id) {
    	return succeed(activityEvaluationRecordService.detail(id));
	}
    
    /**
     * 查询分页
     */
    @PostMapping("/page")
    @ApiOperation(value = "查询分页", notes = "传入activityEvaluationRecordSearch")
    @PreAuthorize("@pcs.hasPermissions('activityEvaluationRecord/page')")
    public HttpResponseResult<PageInfo<ActivityEvaluationRecordVo>> page(@RequestBody ActivityEvaluationRecordSearch query) {
		IPage<ActivityEvaluationRecordVo> pages = activityEvaluationRecordService.selectPage(PageUtil.getPage(query), query);
        return succeed(PageUtil.pageInfo(pages));
	}

}