package com.uas.platform.b2b.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.uas.platform.b2b.model.Notice;
import com.uas.platform.b2b.model.NoticeBody;
import com.uas.platform.b2b.service.NoticeService;
import com.uas.platform.core.model.PageInfo;
import com.uas.platform.core.model.PageParams;

/**
 * 系统公告
 * 
 * @author yingp
 * 
 */
@Controller
@RequestMapping("/info/notice")
public class NoticeController {

	@Autowired
	private NoticeService noticeService;

	/**
	 * 系统公告分页查找
	 * 
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
	@ResponseBody
	public Page<Notice> getNotices(PageParams params) {
		return noticeService.findAllByPageInfo(new PageInfo(params));
	}

	/**
	 * 系统公告正文详细
	 * 
	 */
	@RequestMapping(value = "/{noticeId}", method = RequestMethod.GET)
	@ResponseBody
	public NoticeBody getInquiryItemById(@PathVariable("noticeId") Long noticeId) {
		return noticeService.findNoticeBody(noticeId);
	}

}
