package io.renren.modules.app.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
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;

import io.renren.modules.admin.entity.ReportEntity;
import io.renren.modules.admin.service.ReportService;
import io.renren.common.utils.R;


/**
 * 报告管理
 *
 * @author huwhois
 * @email huwhois@163.com
 * @date 2020-12-29 10:27:09
 */
@RestController
@RequestMapping("app/report")
public class AppReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 分会场列表
     */
    @GetMapping("/listbranch/{mid}/{bid}")
    public R listByBranch(@PathVariable("mid") Long mid, @PathVariable("bid") Long bid){
        List<ReportEntity> list = reportService.listByBranch(mid, bid, "start_time");

        return R.ok().put("list", list);
    }
    
    @GetMapping("/listbranch/{mid}")
    public R listByBranch(@PathVariable("mid") Long mid){
        List<ReportEntity> list = reportService.listByBranch(mid, null);

        return R.ok().put("list", list);
    }

    /**
     * 信息
     */
    @GetMapping("/info/{aid}")
    public R info(@PathVariable("aid") Long aid){
        ReportEntity report = reportService.getById(aid);

        return R.ok().put("report", report);
    }


}
