zoukankan      html  css  js  c++  java
  • JavaWeb项目开发案例精粹-第6章报价管理系统-06po层

    1.

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <beans xmlns="http://www.springframework.org/schema/beans"
     3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     4        xmlns:context="http://www.springframework.org/schema/context"
     5        xmlns:aop="http://www.springframework.org/schema/aop"
     6        xmlns:tx="http://www.springframework.org/schema/tx"
     7        xsi:schemaLocation="http://www.springframework.org/schema/beans
     8            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
     9            http://www.springframework.org/schema/context
    10            http://www.springframework.org/schema/context/spring-context-2.5.xsd
    11            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    12            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    13     <!-- 配置哪些包下的类需要自动扫描 -->
    14     <context:component-scan base-package="com.sanqing"/>    
    15    
    16     <!-- 这里的jun要与persistence.xml中的 <persistence-unit name="jun" transaction-type="RESOURCE_LOCAL">
    17     中的name值要一致,这样才能找到相关的数据库连接
    18      -->
    19    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    20          <property name="persistenceUnitName" value="jun"/>
    21    </bean>  
    22    <!-- 配置事物管理器 --> 
    23    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    24         <property name="entityManagerFactory" ref="entityManagerFactory"/>
    25    </bean>
    26    <!-- 配置使用注解来管理事物 -->
    27    <tx:annotation-driven transaction-manager="transactionManager"/>
    28     
    29 </beans>

    2.

     1 package com.sanqing.po;
     2 
     3 import javax.persistence.Column;
     4 import javax.persistence.Entity;
     5 import javax.persistence.GeneratedValue;
     6 import javax.persistence.Id;
     7 import javax.persistence.Table;
     8 @Entity @Table(name="tb_customer")
     9 public class Customer {            //客户信息类
    10     @Id @Column(length=20)
    11     private String customerNO;    //客户编号
    12     @Column(length=15)
    13     private String customerName;//客户名称
    14     @Column(length=15)
    15     private String phone;        //客户电话
    16     @Column(length=30)
    17     private String address;        //客户地址
    18     @Column(length=15)
    19     private String relationman;    //客户联系人
    20     @Column(length=30)
    21     private String otherInfo;    //其他信息
    22     public Customer(){}
    23     public Customer(String customerNO) {
    24         this.customerNO = customerNO;
    25     }
    26     public String getCustomerNO() {
    27         return customerNO;
    28     }
    29     public void setCustomerNO(String customerNO) {
    30         this.customerNO = customerNO;
    31     }
    32     
    33     public String getCustomerName() {
    34         return customerName;
    35     }
    36     public void setCustomerName(String customerName) {
    37         this.customerName = customerName;
    38     }
    39     
    40     public String getPhone() {
    41         return phone;
    42     }
    43     public void setPhone(String phone) {
    44         this.phone = phone;
    45     }
    46     
    47     public String getAddress() {
    48         return address;
    49     }
    50     public void setAddress(String address) {
    51         this.address = address;
    52     }
    53     
    54     public String getRelationman() {
    55         return relationman;
    56     }
    57     public void setRelationman(String relationman) {
    58         this.relationman = relationman;
    59     }
    60     
    61     public String getOtherInfo() {
    62         return otherInfo;
    63     }
    64     public void setOtherInfo(String otherInfo) {
    65         this.otherInfo = otherInfo;
    66     }
    67 }

    3.

     1 package com.sanqing.po;
     2 
     3 import java.util.Date;
     4 
     5 import javax.persistence.CascadeType;
     6 import javax.persistence.Column;
     7 import javax.persistence.Entity;
     8 import javax.persistence.Id;
     9 import javax.persistence.JoinColumn;
    10 import javax.persistence.ManyToOne;
    11 import javax.persistence.Table;
    12 import javax.persistence.Temporal;
    13 import javax.persistence.TemporalType;
    14 
    15 @Entity @Table(name="tb_order")
    16 public class Order {            //订单信息类
    17     @Id @Column(length=10)
    18     private String orderNO;        //订单编码
    19     @ManyToOne(cascade=CascadeType.REFRESH)
    20     @JoinColumn(name="customerNO")
    21     private Customer customer;    //客户
    22     @ManyToOne(cascade=CascadeType.REFRESH)
    23     @JoinColumn(name="productNO")
    24     private Product product;    //产品
    25     @Column(length=10)
    26     private int quantity;        //产品数量
    27     @Temporal(TemporalType.DATE) 
    28     private Date orderTime;        //订单的时间
    29     @Column(length=50)
    30     private String otherInfo;    //其他信息
    31     public String getOrderNO() {
    32         return orderNO;
    33     }
    34     public void setOrderNO(String orderNO) {
    35         this.orderNO = orderNO;
    36     }
    37     
    38     public Customer getCustomer() {
    39         return customer;
    40     }
    41     public void setCustomer(Customer customer) {
    42         this.customer = customer;
    43     }
    44 
    45     public Product getProduct() {
    46         return product;
    47     }
    48     public void setProduct(Product product) {
    49         this.product = product;
    50     }
    51     
    52     public int getQuantity() {
    53         return quantity;
    54     }
    55     public void setQuantity(int quantity) {
    56         this.quantity = quantity;
    57     }
    58     
    59     public Date getOrderTime() {
    60         return orderTime;
    61     }
    62     public void setOrderTime(Date orderTime) {
    63         this.orderTime = orderTime;
    64     }
    65     
    66     public String getOtherInfo() {
    67         return otherInfo;
    68     }
    69     public void setOtherInfo(String otherInfo) {
    70         this.otherInfo = otherInfo;
    71     }
    72 }

    4.

     1 package com.sanqing.po;
     2 
     3 import javax.persistence.CascadeType;
     4 import javax.persistence.Column;
     5 import javax.persistence.Entity;
     6 import javax.persistence.Id;
     7 import javax.persistence.JoinColumn;
     8 import javax.persistence.ManyToOne;
     9 import javax.persistence.Table;
    10 
    11 @Entity @Table(name="tb_product")
    12 public class Product {                //产品信息类
    13     @Id @Column(length=15)
    14     private String productNO;        //产品编号
    15     @ManyToOne(cascade=CascadeType.REFRESH)
    16     @JoinColumn(name="producttypeNO")
    17     private ProductType productType;//产品类型
    18     @Column(length=20)
    19     private String productName;        //产品名称
    20     @Column(length=20)
    21     private String producingArea;    //产品所在区域
    22     @Column(length=20)
    23     private String productOwner;    //产品所有者
    24     @Column(length=20)
    25     private String unit;            //产品单位
    26     @Column
    27     private double price;            //产品价格
    28     @Column
    29     private int quantity;            //产品数量
    30     @Column(length=50)
    31     private String otherInfo;        //其他信息
    32     
    33     public String getProductNO() {
    34         return productNO;
    35     }
    36     public void setProductNO(String productNO) {
    37         this.productNO = productNO;
    38     }
    39     
    40     public String getProductName() {
    41         return productName;
    42     }
    43     public void setProductName(String productName) {
    44         this.productName = productName;
    45     }
    46     
    47     public String getProducingArea() {
    48         return producingArea;
    49     }
    50     public void setProducingArea(String producingArea) {
    51         this.producingArea = producingArea;
    52     }
    53     
    54     public String getProductOwner() {
    55         return productOwner;
    56     }
    57     public void setProductOwner(String productOwner) {
    58         this.productOwner = productOwner;
    59     }
    60     
    61     public String getUnit() {
    62         return unit;
    63     }
    64     public void setUnit(String unit) {
    65         this.unit = unit;
    66     }
    67     
    68     public double getPrice() {
    69         return price;
    70     }
    71     public void setPrice(double price) {
    72         this.price = price;
    73     }
    74     
    75     public int getQuantity() {
    76         return quantity;
    77     }
    78     public void setQuantity(int quantity) {
    79         this.quantity = quantity;
    80     }
    81     
    82     public String getOtherInfo() {
    83         return otherInfo;
    84     }
    85     public void setOtherInfo(String otherInfo) {
    86         this.otherInfo = otherInfo;
    87     }
    88     
    89     public ProductType getProductType() {
    90         return productType;
    91     }
    92     public void setProductType(ProductType productType) {
    93         this.productType = productType;
    94     }
    95 }

    5.

     1 package com.sanqing.po;
     2 
     3 import javax.persistence.Column;
     4 import javax.persistence.Entity;
     5 import javax.persistence.Id;
     6 import javax.persistence.Table;
     7 
     8 @Entity @Table(name="tb_producttype")
     9 public class ProductType {            //产品类别信息
    10     private String producttypeNO;    //产品类别编号
    11     private String producttypeName;    //产品类别名称
    12     public ProductType(){}            //默认构造方法
    13     public ProductType(String producttypeNO) {//自定义构造方法
    14         this.producttypeNO = producttypeNO;
    15     }
    16     @Id @Column(length=15)
    17     public String getProducttypeNO() {//获得产品类别编号
    18         return producttypeNO;
    19     }
    20     public void setProducttypeNO(String producttypeNO) {//设置产品类别编号
    21         this.producttypeNO = producttypeNO;
    22     }
    23     @Column(length=20)
    24     public String getProducttypeName() {//获得产品类别名称
    25         return producttypeName;
    26     }
    27     public void setProducttypeName(String producttypeName) {//设置产品类别名称
    28         this.producttypeName = producttypeName;
    29     }
    30 }

    6.

     1 package com.sanqing.po;
     2 
     3 import java.util.Date;
     4 
     5 import javax.persistence.CascadeType;
     6 import javax.persistence.Column;
     7 import javax.persistence.Entity;
     8 import javax.persistence.Id;
     9 import javax.persistence.JoinColumn;
    10 import javax.persistence.ManyToOne;
    11 import javax.persistence.Table;
    12 import javax.persistence.Temporal;
    13 import javax.persistence.TemporalType;
    14 
    15 @Entity  @Table(name="tb_quotation")
    16 public class Quotation {            //报价信息类
    17     @Id @Column(length=15)
    18     private String quotationNO;        //报价编号
    19     @Column(length=15)
    20     private String quotationMan;    //报价人
    21     @Temporal(TemporalType.DATE)
    22     private Date quotationTime;        //报价时间
    23     @Column(length=50)
    24     private String otherInfo;            //其他信息
    25     @ManyToOne(cascade=CascadeType.REFRESH)
    26     @JoinColumn(name="productNO")
    27     private Product product ;        //产品
    28     @ManyToOne(cascade=CascadeType.REFRESH)
    29     @JoinColumn(name="customerNO")
    30     private Customer customer;        //客户
    31     
    32     public String getQuotationNO() {
    33         return quotationNO;
    34     }
    35     public void setQuotationNO(String quotationNO) {
    36         this.quotationNO = quotationNO;
    37     }
    38     
    39     public String getQuotationMan() {
    40         return quotationMan;
    41     }
    42     public void setQuotationMan(String quotationMan) {
    43         this.quotationMan = quotationMan;
    44     }
    45     
    46     public Date getQuotationTime() {
    47         return quotationTime;
    48     }
    49     public void setQuotationTime(Date quotationTime) {
    50         this.quotationTime = quotationTime;
    51     }
    52     
    53     public String getOtherInfo() {
    54         return otherInfo;
    55     }
    56     public void setOtherInfo(String otherInfo) {
    57         this.otherInfo = otherInfo;
    58     }
    59 
    60     public Product getProduct() {
    61         return product;
    62     }
    63     public void setProduct(Product product) {
    64         this.product = product;
    65     }
    66 
    67     public Customer getCustomer() {
    68         return customer;
    69     }
    70     public void setCustomer(Customer customer) {
    71         this.customer = customer;
    72     }
    73 }

    7.

     1 package com.sanqing.po;
     2 
     3 import javax.persistence.Column;
     4 import javax.persistence.Entity;
     5 import javax.persistence.EnumType;
     6 import javax.persistence.Enumerated;
     7 import javax.persistence.Id;
     8 import javax.persistence.Table;
     9 
    10 @Entity @Table(name="tb_user")
    11 public class User {                //用户信息类
    12     @Id @Column(length=18)
    13     private String username;    //用户名
    14     @Column(length=18)
    15     private String password;    //用户密码
    16     @Column
    17     private int grade;            //用户级别
    18     
    19     public String getUsername() {
    20         return username;
    21     }
    22 
    23     public void setUsername(String username) {
    24         this.username = username;
    25     }
    26     
    27     public String getPassword() {
    28         return password;
    29     }
    30 
    31     public void setPassword(String password) {
    32         this.password = password;
    33     }
    34     
    35     public int getGrade() {
    36         return grade;
    37     }
    38 
    39     public void setGrade(int grade) {
    40         this.grade = grade;
    41     }
    42 }

     

  • 相关阅读:
    Myeclipse2013 SVN安装方法以及项目上传到svn服务器
    Gson把json串转换成java实体对象
    使用HttpClient向服务器发送restful post请求
    使用HttpURLConnection向服务器发送post和get请求
    http://www.ibm.com/developerworks/cn/opensource/os-cn-cas/
    CAS单点登录配置[5]:测试与总结
    CAS单点登录配置[4]:客户端配置
    CAS单点登录配置[3]:服务器端配置
    CAS单点登录配置[2]:证书生成
    【Oracle/Java】向三张表各插入百万数据,共用时18分3秒,平均每张表6分钟
  • 原文地址:https://www.cnblogs.com/shamgod/p/5328348.html
Copyright © 2011-2022 走看看