package com.diagbot.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.diagbot.dto.GetNewsNoticeInfoByIdDTO;
import com.diagbot.dto.NewsNoticePageDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.dto.SysDictionaryInfoDTO;
import com.diagbot.facade.MedNewsNoticeFacade;
import com.diagbot.vo.GetNewsNoticeInfoByIdVO;
import com.diagbot.vo.NewsNoticePageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;
import java.util.Map;

/**
 * <p>
 * 消息通知表 前端控制器
 * </p>
 *
 * @author songxl
 * @since 2022-04-12
 */
@RestController
@RequestMapping("/medNewsNotice")
@Api(value = "消息通知相关接口API", tags = { "消息通知相关接口API" })
public class MedNewsNoticeController {
    @Autowired
    private MedNewsNoticeFacade medNewsNoticeFacade;

    @ApiOperation(value = "消息通知-获取未读消息数量[by:songxl]",
            notes = "消息通知-获取未读消息数量")
    @PostMapping("/getNewsCount")
    public RespDTO<Map<String,Integer>> getNewsCount() {
        return RespDTO.onSuc(medNewsNoticeFacade.getNewsCount());
    }


    @ApiOperation(value = "消息通知--列表页查询[by:songxl]",
            notes = "消息通知--列表页查询")
    @PostMapping("/newsNoticePage")
    public RespDTO<IPage<NewsNoticePageDTO>> newsNoticePage(@RequestBody NewsNoticePageVO newsNoticePageVO) {
        return RespDTO.onSuc(medNewsNoticeFacade.newsNoticePage(newsNoticePageVO));
    }

    @ApiOperation(value = "消息通知--查看消息通知详情[by:songxl]",
            notes = "消息通知--查看消息通知详情")
    @PostMapping("/getNewsNoticeInfoById")
    public RespDTO<GetNewsNoticeInfoByIdDTO> getNewsNoticeInfoById(@RequestBody GetNewsNoticeInfoByIdVO getNewsNoticeInfoByIdVO) {
        return RespDTO.onSuc(medNewsNoticeFacade.getNewsNoticeInfoById(getNewsNoticeInfoByIdVO));
    }

    @ApiOperation(value = "消息通知-获取通知类型、阅读状态下拉框内容[by:songxl]",
            notes = "消息通知-获取通知类型、阅读状态下拉框内容")
    @PostMapping("/getNewsDropDownBox")
    public RespDTO<Map<String, List<SysDictionaryInfoDTO>>> getNewsDropDownBox() {
        return RespDTO.onSuc(medNewsNoticeFacade.getNewsDropDownBox());
    }
}
