Subversion Repositories SmartDukaan

Rev

Rev 34474 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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


import javax.persistence.*;

@Entity
@NamedQuery(
        name = "decrementGift",
        query = "UPDATE GiftEntity g SET g.maxRedemptions = g.maxRedemptions - 1 WHERE g.id = :giftId AND g.maxRedemptions > 0"
)
@Table(name = "web.gifts")
public class GiftEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private String name;
    @Column(name = "thumbnail_url")
    private String thumbnailUrl;
    @Column(name = "min_cart_value")
    private Double minCartValue;
    @Column(name = "max_redemptions")
    private Integer maxRedemptions;
    @Column(name = "offer_id")
    private Integer offerId;
    @Column(name = "product_category")
    private String productCategory;
    @Column(name = "fofo_store")
    private String fofoStore;
    @Column(name = "max_cart_value")
    private Double maxCartValue;


    public GiftEntity(Integer id, String name, String thumbnailUrl, Integer validity, Double minCartValue, Integer maxRedemptions, Integer offerId, String productCategory, String fofoStore, Double maxCartValue) {
        this.id = id;
        this.name = name;
        this.thumbnailUrl = thumbnailUrl;
        this.minCartValue = minCartValue;
        this.maxRedemptions = maxRedemptions;
        this.offerId = offerId;
        this.productCategory = productCategory;
        this.fofoStore = fofoStore;
        this.maxCartValue = maxCartValue;

    }

    public GiftEntity() {

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getThumbnailUrl() {
        return thumbnailUrl;
    }

    public void setThumbnailUrl(String thumbnailUrl) {
        this.thumbnailUrl = thumbnailUrl;
    }

    public Double getMinCartValue() {
        return minCartValue;
    }

    public void setMinCartValue(Double minCartValue) {
        this.minCartValue = minCartValue;
    }

    public Integer getMaxRedemptions() {
        return maxRedemptions;
    }

    public void setMaxRedemptions(Integer maxRedemptions) {
        this.maxRedemptions = maxRedemptions;
    }

    public Integer getOfferId() {
        return offerId;
    }

    public void setOfferId(Integer offerId) {
        this.offerId = offerId;
    }

    public Double getMaxCartValue() {
        return maxCartValue;
    }

    public void setMaxCartValue(Double maxCartValue) {
        this.maxCartValue = maxCartValue;
    }

    public String getProductCategory() {
        return productCategory;
    }

    public void setProductCategory(String productCategory) {
        this.productCategory = productCategory;
    }

    public String getFofoStore() {
        return fofoStore;
    }

    public void setFofoStore(String fofoStore) {
        this.fofoStore = fofoStore;
    }


    @Override
    public String toString() {
        return "Gift{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", thumbnailUrl='" + thumbnailUrl + '\'' +
                ", minCartValue=" + minCartValue +
                ", maxRedemptions=" + maxRedemptions +
                ", offerId=" + offerId +
                ", productCategory=" + productCategory +
                ", fofoStore=" + fofoStore +
                ", maxCartValue=" + maxCartValue +
                '}';
    }
}