@Controller
public class TbbillController {
?? ?
?? ?@Autowired
?? ?private TbbillService tbbillService;
?? ?
?? ?@Autowired
?? ?private TbproviderService tbproviderService;
?? ?
? ?@RequestMapping("addBill")
?? ?public String addBill(Tbbill bill) {
?? ??? ?
?? ??? ?tbbillService.insert(bill);
?? ??? ?return "redirect:findBillByPage.action";
?? ?}
?? ?@RequestMapping("findBillByPage")
?? ?public String findBillByPage(String uname, Integer ispay, Integer nowPage, Model model) {
?? ??? ?if (nowPage == null) {
?? ??? ??? ?nowPage = 1;
?? ??? ?}
?? ??? ?PageService page = new PageService();
?? ??? ?page.setGoodsname(uname);
?? ??? ?page.setIspay(ispay);
?? ??? ?page.setNowPage(nowPage);
?? ??? ?
?? ??? ?System.out.println("总记录数:"+tbbillService.getBillCount(page));
?? ??? ?
?? ??? ?// ?总记录数 算出总页数 getCount(*)
?? ??? ?page.setTotal(tbbillService.getBillCount(page));
?? ??? ?
?? ??? ?List<BillVO> list = tbbillService.findBillByPage(page);
?? ??? ?model.addAttribute("list", list);
?? ??? ?
?? ??? ?//分页的信息传递到前端页面
?? ??? ?model.addAttribute("nowPage", page.getNowPage());
?? ??? ?model.addAttribute("pageCount", page.getPageCount());
?? ??? ?model.addAttribute("total", page.getTotal());
?? ??? ?model.addAttribute("pageSize", page.getPageSize());
?? ??? ?
?? ??? ?return "admin_bill_list.jsp";
?? ?}
?? ?
?? ?@RequestMapping("deleteBillById")
?? ?public String deleteBillById(Integer id) {
?? ??? ?tbbillService.deleteByPrimaryKey(id);
?? ??? ?return "redirect:findBillByPage.action";
?? ?}
?? ?
?? ?//根据id获取账单信息
?? ?@RequestMapping("findBillById")
?? ?public String findBillById(Integer id,Model model) {
?? ??? ?Tbbill bill = tbbillService.selectByPrimaryKey(id);
?? ??? ?
?? ??? ?List<Tbprovider> list = tbproviderService.selectAll();
?? ??? ?model.addAttribute("proList", list);
?? ??? ?
?? ??? ?model.addAttribute("bill", bill);
?? ??? ?
?? ??? ?return "modify.jsp";
?? ?}