BillService.java

张创琦

  1. package com.zcq.service;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.zcq.dao.BillMapper;
  5. import com.zcq.entity.Bill;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import java.util.List;
  9. @Service
  10. public class BillService {
  11. @Autowired
  12. private BillMapper billMapper;
  13. public List<Bill> list(Bill b) {
  14. return billMapper.select(b);
  15. }
  16. public int add(Bill b) {
  17. return billMapper.insert(b);
  18. }
  19. public Bill get(Long id) {
  20. return billMapper.selectByPrimaryKey(id);
  21. }
  22. public int update(Bill b) {
  23. return billMapper.updateByPrimaryKey(b);
  24. }
  25. public int delete(Long id) {
  26. return billMapper.deleteByPrimaryKey(id);
  27. }
  28. public PageInfo<Bill> listPage(Bill b, int pageNum, int pageSize) {
  29. return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> {
  30. billMapper.select(b);
  31. });
  32. }
  33. }