4.事务层Service层
1 package com.wang.service; 2 3 import java.util.List; 4 5 import com.wang.dao.HomeCostDao; 6 import com.wang.pojo.HomeCost; 7 8 public class HomeCostService { 9 10 HomeCostDao homeCostDao = new HomeCostDao(); 11 12 //新增消费账单 13 public int add(HomeCost homecost) { 14 return homeCostDao.add(homecost); 15 } 16 17 //删除消费账单 18 public int delete(int id) { 19 return homeCostDao.delete(id); 20 } 21 22 //修改消费账单 23 public int update(HomeCost homecost) { 24 return homeCostDao.update(homecost); 25 } 26 27 //关键字查询 28 public List<HomeCost> query(String keyword) { 29 return homeCostDao.query(keyword); 30 } 31 32 //全部消费记录 33 public List<HomeCost> list() { 34 return homeCostDao.list(); 35 } 36 37 //由id查找某条消费记录 38 public HomeCost getHomeCostById(int id) { 39 return homeCostDao.getHomeCostById(id); 40 } 41 42 } HomeCostService.java
标签:HomeCost,return,int,homeCostDao,家庭,id,记账,public From: https://www.cnblogs.com/azure011328/p/17991483