Subversion Repositories SmartDukaan

Rev

Rev 21714 | Rev 21984 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.fofo;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name="fofo.fofo_order", schema = "fofo")
@NamedQueries({
        @NamedQuery(name = "FofoOrder.selectCount", query = "select count(fo) from FofoOrder fo"),
        @NamedQuery(name = "FofoOrder.selectById", query = "select fo from FofoOrder fo where fo.id = :id"),
        @NamedQuery(name = "FofoOrder.selectByFofoId", query = "select fo from FofoOrder fo where fo.fofoId = :fofoId"),
        @NamedQuery(name = "FofoOrder.selectTotolAmountByFofoId", query = "select sum(fo.totalAmount) from FofoOrder fo where fo.fofoId = :fofoId group by fo.fofoId"),
        @NamedQuery(name = "FofoOrder.selectByInvoiceNumber", query = "select fo from FofoOrder fo where fo.invoiceNumber = :invoiceNumber")
})
public class FofoOrder implements Serializable{

        private static final long serialVersionUID = 1L;

        @Id
        @Column(name = "id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name = "fofo_id")
        private int fofoId;
        
        @Column(name = "customer_id")
        private int customerId;
        
        @Column(name = "customer_address_id")
        private int customerAddressId;
        
        @Column(name = "total_amount")
        private float totalAmount;
        
        @Column(name = "invoice_number", length = 50)
        private String invoiceNumber;
        
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public int getFofoId() {
                return fofoId;
        }
        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }
        public int getCustomerId() {
                return customerId;
        }
        public void setCustomerId(int customerId) {
                this.customerId = customerId;
        }
        public int getCustomerAddressId() {
                return customerAddressId;
        }
        public void setCustomerAddressId(int customerAddressId) {
                this.customerAddressId = customerAddressId;
        }
        public float getTotalAmount() {
                return totalAmount;
        }
        public void setTotalAmount(float totalAmount) {
                this.totalAmount = totalAmount;
        }
        public String getInvoiceNumber() {
                return invoiceNumber;
        }
        public void setInvoiceNumber(String invoiceNumber) {
                this.invoiceNumber = invoiceNumber;
        }
        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
        
        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                result = prime * result + customerAddressId;
                result = prime * result + customerId;
                result = prime * result + fofoId;
                result = prime * result + id;
                result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
                result = prime * result + Float.floatToIntBits(totalAmount);
                return result;
        }
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                FofoOrder other = (FofoOrder) obj;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (customerAddressId != other.customerAddressId)
                        return false;
                if (customerId != other.customerId)
                        return false;
                if (fofoId != other.fofoId)
                        return false;
                if (id != other.id)
                        return false;
                if (invoiceNumber == null) {
                        if (other.invoiceNumber != null)
                                return false;
                } else if (!invoiceNumber.equals(other.invoiceNumber))
                        return false;
                if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
                                + customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber
                                + ", createTimestamp=" + createTimestamp + "]";
        }
        
        
}