src/main/java/cn/pzhu/pserson/controller/NoticeController.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package cn.pzhu.pserson.controller;
import cn.pzhu.pserson.domain.Notice;
import cn.pzhu.pserson.service.NoticeService;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
public class NoticeController {
@Autowired
private NoticeService noticeService;
// 如果在目录下输入为空,则跳转到指定链接
@RequestMapping(value = "/notice/")
public ModelAndView index(ModelAndView mv) {
mv.setViewName("notice/list?pageNum=1&pageSize=6");
return mv;
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value = "/notice/{formName}")
public String index(@PathVariable String formName) {
String blank = "/notice/list?pageNum=1&pageSize=6";
return blank;
}
@RequestMapping(value = "/notice/list", method = RequestMethod.GET)
public String list(Model model, HttpSession session) {
List<Notice> notice_list = noticeService.getNoticeList();
model.addAttribute("list", notice_list);
model.addAttribute("userid", session.getAttribute("userid"));
return "notice/list";
}
@RequestMapping(value = "/notice/add", method = RequestMethod.GET)
public String add(Model model, Integer id) {
if (id != null) {
Notice notice = noticeService.get_NoticeInfo(id);
model.addAttribute("notice", notice);
}
return "/notice/add";
}
@RequestMapping(value = "/notice/add", method = RequestMethod.POST)
@ResponseBody
public JSONObject add(@RequestBody Notice notice) {
JSONObject jsonObject = new JSONObject();
if (notice.getId() != null) {
noticeService.update_NoticeInfo(notice);
} else {
noticeService.insertNotice(notice);
后面还有 14 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。