package com.crm.manager.controller;

import com.crm.manager.service.activity.ActivityRaceSignFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultWithPagerDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.model.dto.activity.ActivityRaceSignInfoDto;
import com.crm.rely.backend.model.entity.activity.ActivityRaceSignListEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 比赛报名api
 *
 * @author y
 * @create 2022/7/19
 */
@RestController
@RequestMapping("/activity/race/sign")
public class ActivityRaceSignController {

    @Autowired
    private ActivityRaceSignFeignService activityRaceSignFeignService;

    /**
     * 根据ID获取报名信息
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/single")
    public BaseResultDto<ActivityRaceSignInfoDto> searchSingle(@RequestBody SingleLongEntity entity) throws Exception {
        return activityRaceSignFeignService.searchSingle(entity);
    }

    /**
     * 报名列表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/list")
    public BaseResultWithPagerDto<List<ActivityRaceSignInfoDto>> searchList(@RequestBody ActivityRaceSignListEntity entity) throws Exception {
        return activityRaceSignFeignService.searchList(entity);
    }
}
