1.数据协议层
public User selectById(Integer id);//通过id值查询用户
2.数据层
<select id="selectById" resultType="com.yongxing.manager.domain.User"> select * from user_inf where id=#{id} </select>
3.服务协议层
User findUserById(Integer id);
4.服务开发层
public User findUserById(Integer id) { return userDao.selectById(id); }
5.控制层
@RequestMapping("/user/selectUser/{id}") @ResponseBody public User getUserById(HttpSession session,@PathVariable int id){ User user=userServcie.findUserById(id); return user; }
注意:返回前台的是json数据
6.使用postman测试接口