相当于记账本,但是比记账本的功能更加强大。 package com.xxxy.ksj.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.xxxy.ksj.pojo.AccountBook;
import com.xxxy.ksj.pojo.User;
import com.xxxy.ksj.service.AccountBookService;
@Controller
public class AccountBookController {
@Autowired AccountBookService accountBookService;
@RequestMapping("main")
public String myAccountBook(HttpSession session,Model m){
User user = (User) session.getAttribute("loginUser");
List<AccountBook> list = accountBookService.myAccountBook(user.getUid());
m.addAttribute("ablist", list);
return "main.jsp";
}
@RequestMapping("add")
public String add(AccountBook ab,HttpSession session){
User user = (User) session.getAttribute("loginUser");
ab.setUser(user);
accountBookService.addAccountBook(ab);
return "redirect:main";
}
}
评论