introduce price_list to hsdb

This commit is contained in:
Peter Hormanns 2013-04-18 11:57:16 +02:00
parent 78a525fcc6
commit f32fd2c6b7
7 changed files with 80 additions and 39 deletions

View File

@ -168,3 +168,15 @@ INSERT INTO domain_option (domain_option_name)
VALUES ('multiviews');
INSERT INTO domain_option (domain_option_name)
VALUES ('php');
--
-- table: price_list
--
INSERT INTO price_list VALUES (1, 'Default Price List');
--
-- table: customer_price_list_mapping
--
INSERT INTO customer_price_list_mapping (SELECT bp_id, 1 FROM business_partner);

View File

@ -1,3 +1,6 @@
DROP TABLE customer_price_list_mapping ;
DROP TABLE price ;
DROP TABLE price_list ;
DROP TABLE bank_account ;
DROP SEQUENCE bank_account_bank_account_id_seq ;
DROP TABLE billdata ;

View File

@ -5,9 +5,9 @@
CREATE TABLE bank_account (
bank_account_id integer DEFAULT nextval(('"bank_account_bank_account_id_seq"'::text)::regclass) NOT NULL,
bp_id integer NOT NULL,
autodebit_ga boolean,
autodebit_ar boolean,
autodebit_op boolean,
autodebit_ga boolean NOT NULL,
autodebit_ar boolean NOT NULL,
autodebit_op boolean NOT NULL,
bank_customer character varying(50),
bank_account character varying(10),
bank_code character varying(8),
@ -59,6 +59,7 @@ CREATE TABLE basepacket (
basepacket_id integer DEFAULT nextval(('"basepacket_basepacket_id_seq"'::text)::regclass) NOT NULL,
basepacket_code character varying(10) NOT NULL,
description character varying(100) NOT NULL,
article_number integer NOT NULL,
sorting integer NOT NULL,
valid boolean NOT NULL
);
@ -144,6 +145,7 @@ CREATE SEQUENCE business_partner_bp_id_seq
CREATE TABLE component (
basepacket_id integer NOT NULL,
basecomponent_id integer NOT NULL,
article_number integer NOT NULL,
min_quantity integer NOT NULL,
max_quantity integer NOT NULL,
default_quantity integer NOT NULL,
@ -191,6 +193,38 @@ CREATE SEQUENCE contact_contact_id_seq
CACHE 1;
--
-- Name: price_list
--
CREATE TABLE price_list (
id serial primary key,
name character varying(20)
);
--
-- Name: customer_price_list_mapping
--
CREATE TABLE customer_price_list_mapping (
customer integer references business_partner(bp_id),
price_list integer references price_list(id)
);
--
-- Name: price
--
CREATE TABLE price (
id serial primary key,
article_number integer NOT NULL,
price decimal(10, 2) NOT NULL,
vat decimal(4,2) NOT NULL,
price_list integer references price_list(id)
);
--
-- Name: database_database_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
@ -202,8 +236,6 @@ CREATE SEQUENCE database_database_id_seq
CACHE 1;
SET default_with_oids = false;
--
-- Name: database; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

View File

@ -32,14 +32,14 @@ public class BankAccount extends AbstractEntity implements Serializable {
@OneToOne(fetch = EAGER)
private Customer customer;
@Column(name = "autodebit_ga", columnDefinition = "boolean", nullable = true)
private Boolean autoDebitGA;
@Column(name = "autodebit_ga", columnDefinition = "boolean", nullable = false)
private Boolean autoDebitGA = Boolean.FALSE;
@Column(name = "autodebit_ar", columnDefinition = "boolean", nullable = true)
private Boolean autoDebitAR;
@Column(name = "autodebit_ar", columnDefinition = "boolean", nullable = false)
private Boolean autoDebitAR = Boolean.FALSE;
@Column(name = "autodebit_op", columnDefinition = "boolean", nullable = true)
private Boolean autoDebitOP;
@Column(name = "autodebit_op", columnDefinition = "boolean", nullable = false)
private Boolean autoDebitOP = Boolean.FALSE;
@Column(name = "bank_customer", columnDefinition = "character varying(50)", nullable = true)
private String bankCustomer;

View File

@ -80,16 +80,9 @@ public class Customer extends AbstractEntity implements Serializable {
private Set<Contact> contacts;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
//@AnnFieldIO(referredProps = "customer")//gut
//@AnnFieldIO(referredProps = "customer.CustomersTariff.domainDiscountUntil")//Das ist Kappes!
//@AnnFieldIO(referredProps = "customer.billData.domainDiscountUntil.year")//falsch!
//@AnnFieldIO(referredProps = "customer.billData.domainDiscountUntil.cdate")//gut
//@AnnFieldIO(referredProps = {"customer.billData.domainDiscountUntil.cdate", "customer.billData."})//schlecht!
//@AnnFieldIO(referredProps = {"customer.billData.domainDiscountUntil.cdate", "customer.billData"})//gut
private BankAccount bankAccount;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
// @AnnFieldIO(referredProps = "domainDiscountUntil")//gut!
private CustomersTariff billData;
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")

View File

@ -29,13 +29,6 @@ public class BasePac implements Serializable {
components = new HashSet<Component>();
}
public BasePac(String name, String desc, int sortPos) {
this.name = name;
this.description = desc;
this.sorting = sortPos;
this.valid = true;
}
@Id
@GeneratedValue(strategy = SEQUENCE, generator = "BasePacsSeqGen")
@Column(name = "basepacket_id", columnDefinition = "integer")
@ -47,6 +40,9 @@ public class BasePac implements Serializable {
@Column(name = "description", columnDefinition = "character varying(100)")
private String description;
@Column(name = "article_number", columnDefinition = "integer", nullable=false)
private int articleNumber;
@Column(name = "sorting", columnDefinition = "integer")
private int sorting;
@ -154,4 +150,12 @@ public class BasePac implements Serializable {
return false;
return true;
}
public int getArticleNumber() {
return articleNumber;
}
public void setArticleNumber(int articleNumber) {
this.articleNumber = articleNumber;
}
}

View File

@ -33,6 +33,9 @@ public class Component implements Serializable {
@JoinColumn(name="basecomponent_id")
private BaseComponent baseComponent;
@Column(name = "article_number", columnDefinition = "integer", nullable=false)
private int articleNumber;
@Column(name = "min_quantity", columnDefinition = "integer")
private int minimumQuantity;
@ -54,20 +57,6 @@ public class Component implements Serializable {
public Component() {
}
public Component(BasePac basePac, BaseComponent baseComp, int min, int max,
int def, int incr, int incl, boolean adminOnly) {
this.setBasePacId(basePac.id());
this.basePac = basePac;
this.setBaseComponentId(baseComp.id());
this.baseComponent = baseComp;
this.minimumQuantity = min;
this.maximimumQuantity = max;
this.defaultQuantity = def;
this.incrementQuantity = incr;
this.includedQuantity = incl;
this.adminOnly = adminOnly;
}
public BasePac getBasePac() {
return basePac;
}
@ -150,4 +139,12 @@ public class Component implements Serializable {
return baseComponentId;
}
public int getArticleNumber() {
return articleNumber;
}
public void setArticleNumber(int articleNumber) {
this.articleNumber = articleNumber;
}
}