package com.zd.laboratory.controller;

import com.zd.common.core.utils.SecurityUtils;
import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.web.domain.AjaxResult;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.system.api.laboratory.domain.LabMessageUser;
import com.zd.laboratory.service.ILabMessageUserService;
import com.zd.laboratory.service.ILabSubjectAccessRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/myWork")
@Api(tags = {"个人工作台"})
public class LabMyWorkbenchController extends BaseController {

    @Autowired
    private ILabSubjectAccessRecordService labSubjectAccessRecordService;
    @Autowired
    private ILabMessageUserService labMessageUserService;

    /**
     * 实验室进出统计
     */
    @ApiOperation(value = "个人实验室进出统计")
    @PostMapping("/record/statistics")
    public AjaxResult recordStatistics() {
        return AjaxResult.success(labSubjectAccessRecordService.recordStatistics());
    }

    /**
     * 个人消息通知列表
     */
    @ApiOperation(value = "个人消息通知列表")
    @GetMapping("/message")
    public TableDataInfo message(LabMessageUser labMessageUser) {
        labMessageUser.setJoinUserId(SecurityUtils.getUserId());
        startPage();
        List<LabMessageUser> list = labMessageUserService.selectLabMessageUserList(labMessageUser);
        return getDataTable(list);
    }

    /**
     * 个人消息查看详情
     */
    @ApiOperation(value = "个人消息查看详情")
    @GetMapping(value = "/{id}")
    public AjaxResult messageInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(labMessageUserService.selectLabMessageUserById(id));
    }

    //  学习资料调用安全培训列表 /train/list/my

    //  进出记录调用我的进出记录列表  /record/list/my

    //  考试证书调用考试系统，我的证书 /exam/queryMyCert

}
