src/com/marry/controller/UserController.java
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.marry.controller;
import com.github.pagehelper.PageInfo;
import com.marry.entity.User;
import com.marry.service.UserService;
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("user")
public class UserController {
@Autowired
private UserService userService;
@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<User> pageInfo=userService.selectList(name, tel,2,0, pageNo);
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("name",name);
model.addAttribute("tel",tel);
model.addAttribute("user","active");
return "manage/userList";
}
@RequestMapping("view/{uid}")
public String view(@PathVariable("uid") Integer uid, Model model){
User user=userService.select(uid);
model.addAttribute("user",user);
return "person";
}
@RequestMapping("update")
public String update(User user,Model model,String manage){
userService.update(user);
if (!StringUtils.isEmpty(manage)){
return "redirect:/user/list";
}
model.addAttribute("user",user);
return "redirect:view/"+user.getUid();
}
后面还有 32 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。