package com.lightinit.hsdataportal.controller.share;

import com.lightinit.hsdataportal.entity.BaseExample;
import com.lightinit.hsdataportal.model.NotificationListModel;
import com.lightinit.hsdataportal.service.INotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @Author: sunxiang
 * @Date: 2018/7/11 14:54
 * @Description:
 **/
@Controller
@RequestMapping(value = "/share/notification")
public class NotificationShareController {
    @Autowired
    private INotificationService notificationService;
    @RequestMapping(value="index.htm")
    public ModelAndView getDataIndex( @RequestParam(defaultValue = "1") int pageNo){
        ModelAndView modelAndView = new ModelAndView("share/notification/index");
        BaseExample.Page pager = new BaseExample.Page();
        pager.setPageNo(pageNo);
        List<NotificationListModel> outputModel=notificationService.getNotificationIndex(pager,0);
        pager.setTotal(notificationService.getNotificationCount(0));//共享id目前不需要
        modelAndView.addObject("outputModel", outputModel);
        modelAndView.addObject("pager",pager);
        return modelAndView;
    }

}
