package com.zd.app.controller;

import com.zd.common.core.domain.R;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.system.api.laboratory.RemoteMessageContentService;
import com.zd.system.api.laboratory.domain.LabMessageUser;
import com.zd.system.api.laboratory.domain.vo.LabMessageUserListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhoupan
 * @Date: 2021/09/16/18:04
 * @Description:
 */
@Api(tags = {"消息管理"})
@RestController
@RequestMapping("/message/content")
public class MessageContentApi {

    @Autowired
    RemoteMessageContentService messageContentService;


    /**
     * 查询我的消息
     */
    @ApiOperation("查询我的消息列表")
    @GetMapping("/my/group/list")
    public TableDataInfo myGrouplist(@RequestParam Long pageNum, @RequestParam Long pageSize) {

        return  messageContentService.myGrouplist(pageNum, pageSize);
    }

    /**
     * 查询我的消息
     */
    @ApiOperation("查询我的消息列表")
    @GetMapping("/my/group/totalCount")
    public R<Object> myGroupTotalCount() {
        return  messageContentService.myGroupTotalCount();
    }

    /**
     * 查询安全准入消息信息
     */
    @ApiOperation("查询安全准入消息信息")
    @GetMapping("/my/group/read")
    public R<Object> myRead(@RequestParam Long messageId) {

        return  messageContentService.myRead(messageId);
    }


    /**
     * 查询我的消息
     */
    @ApiOperation("查询我的消息列表")
    @GetMapping("/my/{id}/group/list")
    public TableDataInfo myGrouplistById(@PathVariable("id") Long id , @RequestParam Long pageNum, @RequestParam Long pageSize) {
        return messageContentService.myGrouplistById(pageNum, pageSize,id);
    }

    /**
     * 变更消息已读状态
     */
    @ApiOperation("变更消息已读状态")
    @PostMapping("/readByLoginUser")
    public void readByLoginUser(@RequestBody LabMessageUser labMessageUser) {
        messageContentService.readByLoginUser(labMessageUser);
    }
}
