Shopizer网站数据库设计

Database schema

The database schema information decribed in this section is divided into 5 sections

  1. Merchant information
  2. Product catalogue
  3. Order information
  4. Tax information
  5. References tables

Merchant information

Shopizer supports multiple store fronts having different inventory. A store owner is defined as a merchant and its identifier is a merchant id (MerchantId). Most store related entity tables in the system contains a MerchantId column. A merchant identifier (merchantId) is created from MERCHANT_ID table every time a new store is created. A new MERCHANT_USER_INFO entity is created also for each new MerchantId created. MERCHANT_STORE entity table contains store related information for a given MerchantId. There can be many merchant user per MerchantId and one MerchantStore per MerchantId. Each MerchantUser can be given differnect access control role for a given MerchantStore. MERCHANT_REGISTRATION entity contains global registration of a merchant to the system such as registration codes and payment information if supported. MERCHANT_REGISTRATION_DEF (not used for now) defines payment fees per resistration code. MERCHANT_USER_ROLE_DEF is a reference table containing roles that can be assign to each MerchantUser. The table MERCHANT_USER_ROLE contains all roles assigned to a given MerchantUser. The administration name (login name) is the primary key for role assignation. An administration name needs to be unique in the system.

CENTRAL_GROUP entity contains Shopizer's main menu global function and CENTRAL_FUNCTION contains drop down menu items for a given menu group. The association group function is made in CENTRAL_REG_ASSOCIATION and a foreign key to MERCHANT_REGISTRATION_DEF_CODE let the system display or not menu items according to the Merchant registration code. By default the system is configured to desplay all groups and all functions. MERCHANT_CONFIGURATION table contains all cofigurations for Shopizer's subcomponents such as payment gatway information, shipping carrier, integration API credentials, tax settings etc…

Product catalogue

The following section describes the product catalogue schema tables which applies to the following concept:

A Product belongs to a Category. A Product can have one to many Prices. A Price can have 0 to one Special. Products can have Proterties defined as Product Options.

PRODUCT table contains product entity core attributes (name, price, image …) and the table PRODUCT_DESCRIPTION contains product description for a given language. REVIEWS and REVIEWS tables contains reviews description submited by the system registered customers / users. PRODUCT_TYPE table drives catalogue and shopping cart behaviors such as specific function for digital product types.

PRODUCTS_OPTIONS are additional information that can be added to a product core attributes for instance color, size… PRODUCT_OPTION table contains the selection types available radio, select, text and checkbox. PRODUCT_ATTRIBUTES table defines the PRODUCT_OPTION for a given PRODUCT, it contains related information such as a specific price increase or a weight increase. A PRODUCT_ATTRIBUTE can be read only which mean that this attribute is only displayed for information, by example this can be used to display product specifications. When read only is set to false, the attribute will be a selectable option when adding the item to the shopping cart.

A PRODUCT can have one to many prices. The PRODUCT price core attribute defines the base one time product price. A SPECIAL can be assigned to a product which will ajust base price. Other prices can be defined in PRODUCTS_PRICE, for instance an item can have an installation price and an activation price. All those prices can also have a special defined in PRODUCTS_PRICE_SPECIALS.

PRODUCT_RELATIONSHIP table contains an association between a product and another product. The relation contains an association type which can be used to display featured items, cross sell and up sell functionalities.

Install MySQL schema

You will need to create a database

instructions are in <SHOPIZER>\schema\readme.txt

Here they are :

1- Log in MySQL as root

mysql>CREATE DATABASE SALESMANAGER;
mysql>GRANT USAGE, SELECT ON *.* TO <YOUR USERNAME>@localhost IDENTIFIED BY '<YOUR PASSWORD>' with grant option;
mysql>grant all privileges on SALESMANAGER.* to <YOUR USERNAME>@localhost;
mysql>grant all privileges on SALESMANAGER.* to <YOUR USERNAME>@'%';
mysql>GRANT FILE ON *.* TO <YOUR USERNAME>@localhost;
mysql>GRANT FILE ON *.* TO <YOUR USERNAME>@'%';
mysql>FLUSH PRIVILEGES; 

edit <SHOPIZER>/sm-core/conf/properties/system.properties

#MySQL
database.driver=com.mysql.jdbc.Driver
database.jdbcUrl=jdbc:mysql://localhost:3306/SALESMANAGER
database.user=<YOUR USER NAME>
database.password=<YOUR PASSWORD>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

edit <SHOPIZER>\schema\build.properties

uncomment MySQL section and comment HSQLDB

#MySQL
db_port=3306
db_username=<YOUR USER NAME>
db_password=<YOUR PASSWORD>
salesmanager_db_name=SALESMANAGER

2) run <SHOPIZER>\schema\shopizer-build-mysql.bat

3) Change <SHOPIZER>/sm-core/conf/properties/systems.properties to use MySQL (make sure the other database configuration sections are commented)

#MySQL
database.driver=com.mysql.jdbc.Driver
database.jdbcUrl=jdbc:mysql://<HOST>:3306/SALESMANAGER
database.user=<YOUR USER>
database.password=<YOUR PASSORD>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

4) Shopizer will need a MySQL driver to connect to the database. You must download MySQL JDBC driver that matches your database version.

5) Rebuild sm-central and sm-shop web applications

Install Oracle schema

This procedure has been tested and works perfectly with Oracle APEX (Oracle Express / Oracle XE). The tests were done using version 10g. The procedure is described also in the source distribution in <SHOPIZER>\schema\readme.txt

1) Start Oracle XE administration web page and log in using SYS or SYSTEM account. Click on the administration arrow, click on database user arrow and then on create user. Username: salesmanager <or your own but will require changes in the properties file> Password: <PASSWORD>

2) The next step will be to build the schema and insert system data. The scripts for the schema creation task is located in shopizer-<SHOPIZER>\schema\sql\shopizer_oracle.sqland the all scripts in <SHOPIZER>\schema\sql\data for loading system data. Or you can execute <SHOPIZER>\schema\sql\shopizer_oracle.sql which includes every script to be run. It is recommended to uses the ANT tasks for doing this, if you have Ant installed, just set the database information in <SHOPIZER>\schema\build.properties. Uncomment Oracle connection database section and make sure the other database sectins are commented

#Oracle
db_port=1521
db_username=salesmanager or <YOUR USERNAME>
db_password=<YOUR PASSWORD>
salesmanager_db_name=XE

Then execute <SHOPIZER>\schema\shopizer-build-oracle.bat

3) Change <SHOPIZER>/sm-core/conf/properties/systems.properties to use Oracle (make sure the other database configuration sections are commented)

#Oracle
database.driver=oracle.jdbc.driver.OracleDriver
database.jdbcUrl=jdbc:oracle:thin:@<YOUR HOST>:1521:XE
database.user=salesmanager or <YOUR USERNAME>
database.password=<YOUR PASSWORD>
hibernate.dialect=org.hibernate.dialect.OracleDialect

4) Shopizer will need an Oracle thin driver to connect to the database. Your Oracle installation contains a jdbc driver you can use

ORACLE_HOME/jdbc/lib contains ojdbc14.jar that needs to be copied to <SHOPIZER>\sm-core\lib\misc

5) Rebuild sm-central and sm-shop web applications

基于MySQL,设计并实现一个简单的旅行预订系统。该系统涉及的信息有航班、大巴班车、宾馆房间和客户数据等信息。其关系模式如下: FLIGHTS (String flightNum, int price, int numSeats, int numAvail, String FromCity, String ArivCity); HOTELS(String location, int price, int numRooms, int numAvail); BUS(String location, int price, int numBus, int numAvail); CUSTOMERS(String custName,custID); RESERVATIONS(String custName, int resvType, String resvKey) 为简单起见,对所实现的应用系统作下列假设: 1. 在给定的一个班机上,所有的座位价格也一样;flightNum是表FLIGHTS的一个主码(primary key)。 2. 在同一个地方的所有的宾馆房间价格也一样;location是表HOTELS的一个主码。 3. 在同一个地方的所有大巴车价格一样;location是表 BUS的一个主码。 4. custName是表CUSTOMERS的一个主码。 5. 表RESERVATIONS包含着那些和客户预订的航班、大巴车或宾馆房间相应的条目,具体的说,resvType指出预订的类型(1为预订航班,2为预订宾馆房间,3为预订大巴车),而resvKey是表RESERVATIONS的一个主码。 6. 在表FLIGHTS中,numAvail表示指定航班上的还可以被预订的座位数。对于一个给定的航班(flightNum),数据库一致性的条件之一是,表RESERVATIONS中所有预订该航班的条目数加上该航班的剩余座位数必须等于该航班上总的座位数。这个条件对于表BUS和表HOTELS同样适用。 应用系统应完成如下基本功能: 1. 航班,大巴车,宾馆房间和客户基础数据的入库,更新(表中的属性也可以根据你的需要添加)。 2. 预定航班,大巴车,宾馆房间。 3. 查询航班,大巴车,宾馆房间,客户和预订信息。 4. 查询某个客户的旅行线路。 5. 检查预定线路的完整性。 6. 其他任意你愿意加上的功能。 作业检查: 1. 提交源程序,可执行程序,以及程序运行说明。 2. 系统分析、设计与实现报告。 3. 考试前检查完毕,延迟拒收。 4. 提交word文件,形式为:学号_姓名
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值