package com.lightinit.hsdataportal.controller.open;

import com.lightinit.hsdataportal.model.APIReceiveListModel;
import com.lightinit.hsdataportal.model.LoginUser;
import com.lightinit.hsdataportal.model.ReceiveListModel;
import com.lightinit.hsdataportal.service.IMyReceiveService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
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.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping(value = "/open/Receive")
public class MyReceiveController {
    @Autowired
    private IMyReceiveService myReceiveService;
    /**
     * 我的接单列表
     * @return
     */
    @RequestMapping(value = "receiveList.action")
    @ResponseBody
    @RequiresAuthentication
    public ModelAndView receiveList(HttpSession session) {
        LoginUser loginUser = (LoginUser) session.getAttribute(LoginUser.SESSION_KEY_LOGIN_USER);
        ModelAndView modelAndView = new ModelAndView("open/myreceive/list");
        List<ReceiveListModel> outputModel = myReceiveService.selectReceiveList(loginUser.getId());
        modelAndView.addObject("list", outputModel);
        return modelAndView;
    }
}
