package com.vv.controller;
import java.util.List;
import java.util.Map;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.vv.pojo.User;
import com.vv.service.IUserService;
@Controller
public String dispUser(){
//查询一条id=30的用户
User u = userService.selectOne(new EntityWrapper<User>().eq("id", "30"));
System.out.println(u.toString());
return "user/dispuser";
}
import java.util.List;
import java.util.Map;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.vv.pojo.User;
import com.vv.service.IUserService;
@Controller
public class UserController{
<!-- 服务和Dao Mybatis plus都自动为你做好了,此处注解服务也可以,注解Dao也可以。不要自己写什么代码-->
@Autowired
private IUserService userService;
public String dispUser(){
//查询一条id=30的用户
User u = userService.selectOne(new EntityWrapper<User>().eq("id", "30"));
System.out.println(u.toString());
return "user/dispuser";
}
}
==========================================