zoukankan      html  css  js  c++  java
  • Java学习12.04

    图书管理系统——service层

    service.java

     1 import java.util.ArrayList;
     2 import java.util.List;
     3 
     4 import bean.dao;
     5 import bean.Book;
     6 
     7 public class Service {
     8     static dao dao=new dao();
     9     public static Boolean add(Book activity) {
    10         if(dao.findNameBook(activity.getNameBook())==true) {
    11             System.out.print("已存在");
    12             return false;
    13         }
    14         else{
    15             dao.add(activity);
    16             return true;
    17         }
    18     }
    19     
    20     public static  Boolean jieyue(Book activity) {
    21         if(dao.findNameBook(activity.getNameBook())==true) {
    22             System.out.print("已存在");
    23             Book book=new Book();
    24             book.setNumber(activity.getNumber());
    25             return false;
    26         }
    27         else{
    28             dao.add(activity);
    29             return true;
    30         }
    31     }
    32 
    33     public static ArrayList<Book> search(Book activity) {
    34         if(dao.findNameBook(activity.getNameBook())==true) {
    35             ArrayList<Book> activity1=dao.select(activity.getNameBook());
    36             //System.out.print(course1.getClassroom()+"  "+course1.getName()+"  "+course1.getTeacher());
    37             return activity1;
    38         }
    39         else {
    40             System.out.print("未找到");
    41             return null;
    42         }
    43             
    44     }
    45     public static List<Book> list() {    
    46         return dao.getAllinformation();
    47     }
    48 }

    serviceindex.java

     1 import java.util.ArrayList;
     2 import java.util.List;
     3 
     4 import bean.dao;
     5 import bean.Book;
     6 
     7 public class Service {
     8     static dao dao=new dao();
     9     public static Boolean add(Book activity) {
    10         if(dao.findNameBook(activity.getNameBook())==true) {
    11             System.out.print("已存在");
    12             return false;
    13         }
    14         else{
    15             dao.add(activity);
    16             return true;
    17         }
    18     }
    19     
    20     public static  Boolean jieyue(Book activity) {
    21         if(dao.findNameBook(activity.getNameBook())==true) {
    22             System.out.print("已存在");
    23             Book book=new Book();
    24             book.setNumber(activity.getNumber());
    25             return false;
    26         }
    27         else{
    28             dao.add(activity);
    29             return true;
    30         }
    31     }
    32 
    33     public static ArrayList<Book> search(Book activity) {
    34         if(dao.findNameBook(activity.getNameBook())==true) {
    35             ArrayList<Book> activity1=dao.select(activity.getNameBook());
    36             //System.out.print(course1.getClassroom()+"  "+course1.getName()+"  "+course1.getTeacher());
    37             return activity1;
    38         }
    39         else {
    40             System.out.print("未找到");
    41             return null;
    42         }
    43             
    44     }
    45     public static List<Book> list() {    
    46         return dao.getAllinformation();
    47     }
    48 }

    servicepeople.java

     1 import java.util.ArrayList;
     2 import java.util.List;
     3 
     4 import bean.daopeople;
     5 import bean.studentInfo;
     6 
     7 public class Servicepeople {
     8     static daopeople daopeople=new daopeople();
     9     public static Boolean add(studentInfo activity) {
    10         if(daopeople.findNamepeople(activity.getName())==true) {
    11             System.out.print("已存在");
    12             return false;
    13         }
    14         else{
    15             daopeople.add(activity);
    16             return true;
    17         }
    18     }
    19 
    20     public static ArrayList<studentInfo> search(studentInfo activity) {
    21         if(daopeople.findNamepeople(activity.getName())==true) {
    22             ArrayList<studentInfo> activity1=daopeople.select(activity.getName());
    23             //System.out.print(course1.getClassroom()+"  "+course1.getName()+"  "+course1.getTeacher());
    24             return activity1;
    25         }
    26         else {
    27             System.out.print("未找到");
    28             return null;
    29         }
    30             
    31     }
    32     public static List<studentInfo> list() {    
    33         return daopeople.getAllinformation();
    34     }
    35 }

    明天计划

    明天练习servlet层

  • 相关阅读:
    Prometheus对标签的处理
    Promethueus常用函数
    jenkins容器化docker-compose
    k8s常用命令
    k8s网络笔记
    动态更新已经存在配置
    prometheus远程写调优参数说明
    IndiaHacks 2016
    Codeforces Round #344 (Div. 2) Messager KMP的应用
    HDU1711 KMP的应用
  • 原文地址:https://www.cnblogs.com/Lizhichengweidashen/p/14204331.html
Copyright © 2011-2022 走看看