productsbean.java

来自「网络商店」· Java 代码 · 共 47 行

JAVA
47
字号
package model;import java.util.*;public class ProductsBean {  private static List<Product> list = null;  public static List<Product> findAll() throws Exception {    if (list == null) {      list = Products.findAll();    }    return list;  }  public static void createTable() throws Exception {    Products.createTable();    list = null;  }  public static void create(Product p) throws Exception {    Products.create(p);    list = null;  }   public static void updateRecord(int id, String price) throws Exception {        Products.updateRecord(id, price);        list = null;    }   public static List<Product> getList() throws Exception {    System.out.println("getList");    if ( list == null )       list = Products.findAll();    return list;  }  public static Product find(int id) throws Exception {    return Products.find(id);  }    public static java.math.BigDecimal findPrice(int id) throws Exception {    return Products.findPrice(id);  }  public static String findDesc(int id) throws Exception {    return Products.findDesc(id);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?