E-commerce data warehouse for big data projects, business data introduction, business data simulation, business data generation, business data modeling

6. Introduction to business data

6.5 Business data simulation

6.5.1 Connect to MySQL

insert image description here

6.5.2 Create table statement

insert image description here
insert image description here
insert image description here
insert image description here

insert image description here

insert image description here

Note: After finishing, remember to right-click and refresh the object browser to see the tables in the database.

6.5.3 Generate business data

6.5.3.1 Create the db_log folder under the /opt/module/ directory of hadoop102

[summer@hadoop102 module]$ mkdir db_log/

insert image description here

6.5.3.2 Upload gmall2020-mock-db-2021-11-14.jar and application.properties to the /opt/module/db_log path of hadoop102

insert image description here

insert image description here

6.5.3.3 Modify application.properties related configuration according to requirements

logging.level.root=info


spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://hadoop102:3306/gmall?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=000000

logging.pattern.console=%m%n


mybatis-plus.global-config.db-config.field-strategy=not_null


#业务日期
mock.date=2020-06-14
#是否重置  注意:第一次执行必须设置为1,后续不需要重置不用设置为1
mock.clear=1
#是否重置用户 注意:第一次执行必须设置为1,后续不需要重置不用设置为1
mock.clear.user=1

#生成新用户数量
mock.user.count=100
#男性比例
mock.user.male-rate=20
#用户数据变化概率
mock.user.update-rate:20

#收藏取消比例
mock.favor.cancel-rate=10
#收藏数量
mock.favor.count=100

#每个用户添加购物车的概率
mock.cart.user-rate=50
#每次每个用户最多添加多少种商品进购物车
mock.cart.max-sku-count=8 
#每个商品最多买几个
mock.cart.max-sku-num=3 

#购物车来源  用户查询,商品推广,智能推荐, 促销活动
mock.cart.source-type-rate=60:20:10:10

#用户下单比例
mock.order.user-rate=50
#用户从购物中购买商品比例
mock.order.sku-rate=50
#是否参加活动
mock.order.join-activity=1
#是否使用购物券
mock.order.use-coupon=1
#购物券领取人数
mock.coupon.user-count=100

#支付比例
mock.payment.rate=70
#支付方式 支付宝:微信 :银联
mock.payment.payment-type=30:60:10


#评价比例 好:中:差:自动
mock.comment.appraise-rate=30:10:10:50

#退款原因比例:质量问题 商品描述与实际描述不一致 缺货 号码不合适 拍错 不想买了 其他
mock.refund.reason-rate=30:10:20:5:15:5:5

insert image description here

This piece, if you change it, you also need to change the corresponding one, username and password

6.5.3.4 And execute it in this directory, the following command will generate 2020-06-14 date data

[summer@hadoop102 db_log]$ java -jar gmall2020-mock-db-2021-11-14.jar

insert image description hereCheck the gmall database to see if there is data from 2020-06-14. You can view the order_info table. If you have not run the above command, the table has no data. After running the above command, the table has data.

6.5.4 Business Data Modeling

  EZDML, a database design tool, can be used to assist us in sorting out complex business table relationships.

6.5.4.1 Download address

http://www.ezdml.com/download_cn.html

6.5.4.2 Instructions for use

6.5.4.2.1 Create a new model

insert image description here

6.5.4.2.2 Naming the model

insert image description here

6.5.4.2.3 Click the icon to select the model

insert image description here

6.5.4.2.4 Import database

insert image description here

6.5.4.2.5 Configuring Database Connections

insert image description here

6.5.4.2.6 Select the table to be imported (the table not selected does not need to be imported)

insert image description here

6.5.4.2.7 Create table relationship

insert image description here

6.5.4.2.7.1 Step 1: Click to select the main table (the table where the primary key is located)

insert image description here

6.5.4.2.7.2 Step 2: Click the connect button

insert image description here

6.5.4.2.7.3 Step 3: Click on the slave table to configure the connection conditions

insert image description here

6.5.4.2.7.4 Step 4: Effect display

insert image description hereThen join the tables one by one, you can

6.5.4.3 Tips for use

6.5.4.3.1 Thumbnail

insert image description here

6.5.4.3.2 Hotkeys

Hold down the shift key and click on the table with the mouse to perform multiple selections to realize batch movement
Hold down the ctrl key and use the mouse to circle the table to perform multiple selections to realize batch movement

Guess you like

Origin blog.csdn.net/Redamancy06/article/details/127553066