package com.bwie.system.controller;

import com.bwie.common.domain.Bill;
import com.bwie.system.dao.BillDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：zhangchengzhi
 * @Package：com.bwie.system.controller
 * @Project：test_7.26_bill
 * @name：BillController
 * @Date：2024/7/26 9:00
 */
@RestController
@RequestMapping("/bill")
public class BillController {



    @Autowired
            private BillDao billDao;

    @PostMapping("/list")
            public void list(){


        System.out.println("表bill里的数据");

        List<Bill> list = billDao.selectAll();
        for (Bill bill : list) {
            System.out.println("序号:"+bill.getBillId()+",账单金额:"+bill.getBillMoney()+",账单时间:"+bill.getBillDate());
        }

    }

@PostMapping("/add")
    public void add(@RequestBody Bill bill){

    int i = billDao.add(bill);
    if (i>0){
        System.out.println("账单添加成功");
    }
}













}
