src/com/marry/controller/GrapherController.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.marry.controller;

import com.github.pagehelper.PageInfo;
import com.marry.entity.Grapher;
import com.marry.entity.User;
import com.marry.service.GrapherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("grapher")
public class GrapherController {
    @Autowired
    private GrapherService grapherService;

    @ModelAttribute
    public String path(HttpServletRequest request){
        return request.getServletPath();
    }

    @RequestMapping("list")
    public String list(String name, String tel, Integer pageNo, Model model){
        if (pageNo==null){
            pageNo=1;
        }
        if (StringUtils.isEmpty(name))name=null;
        if (StringUtils.isEmpty(tel))tel=null;
        PageInfo<Grapher> pageInfo=grapherService.selectList(name, tel, pageNo);
        model.addAttribute("pageInfo",pageInfo);
        model.addAttribute("name",name);
        model.addAttribute("tel",tel);
        model.addAttribute("grapher","active");
        return "manage/grapherList";
    }


    @RequestMapping("toOrder/{gid}")
    public String toOrder(@PathVariable("gid") Integer gid, Model model,HttpSession session){
        User user= (User) session.getAttribute("login");
        if (user==null){
            return "login";
        }
        Grapher grapher=grapherService.select(gid);
        model.addAttribute("grapher",grapher);
        return "order";
    }

    @RequestMapping("update")
    public String update(Grapher grapher,Model model){
        grapherService.update(grapher);
        model.addAttribute("grapher",grapher);
后面还有 21 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。