package com.ozs.web.controller.home;

import com.ozs.common.core.controller.BaseController;
import com.ozs.common.core.domain.AjaxResult;
import com.ozs.entity.vo.MsgAlarmVo;
import com.ozs.service.MsgAlarmService;
import com.ozs.system.service.DataScoreUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author : sunhh
 * @create 2023/3/7 14:34
 */
@RestController
@RequestMapping("/home")
public class HomeController extends BaseController {

    @Resource
    private MsgAlarmService msgAlarmService;
    @Autowired
    private DataScoreUtil dataScoreUtil;

    /**
     * 统计数量
     */
    @GetMapping("/statisticsNum")
    public AjaxResult statisticsNum() {
        MsgAlarmVo msgAlarmVo = (MsgAlarmVo) dataScoreUtil.setDataScore(getUserId(), new MsgAlarmVo());
        Map<String, Integer> map = msgAlarmService.statisticsNum(msgAlarmVo);
        return AjaxResult.success(map);
    }
}
