当前位置: 首页 > news >正文

国家开发银行助学贷款网站余姚建设公司网站

国家开发银行助学贷款网站,余姚建设公司网站,响应式 网站 开发,手机微信小程序开发教程EAV #xff1a; Entity - Attribute - Value 的缩写#xff0c;是数据库模型的一种#xff0c;使用eav建模的好处是可以动态为数据模型增加或移除属性。1. 问题提出:假设需要定义一个实体Customer的信息#xff0c;通常我们只要定义一个表为customer#xff0c;并定义相应…EAV Entity - Attribute - Value 的缩写是数据库模型的一种使用eav建模的好处是可以动态为数据模型增加或移除属性。1. 问题提出:假设需要定义一个实体Customer的信息通常我们只要定义一个表为customer并定义相应的属性即可。倘若某天需要为customer增加一个新的属性如“毕业学校”那么就需要更改表的结构。如果使用EAV模型则不必改变表结构。2. Magento的EAV模型定义:在Magento中EAV模型相关的表定义有Java代码eav_attributeeav_attribute_groupeav_attribute_optioneav_attribute_option_valueeav_attribute_seteav_entityeav_entity_attributeeav_entity_datetimeeav_entity_decimaleav_entity_inteav_entity_storeeav_entity_texteav_entity_typeeav_entity_varchareav_attributeeav_attribute_groupeav_attribute_optioneav_attribute_option_valueeav_attribute_seteav_entityeav_entity_attributeeav_entity_datetimeeav_entity_decimaleav_entity_inteav_entity_storeeav_entity_texteav_entity_typeeav_entity_varchar现在让我来观察最重要的三张表eav_entity_typeeav_entity_attributeeav_attribute1) eav_entity_type表用来定义实体的基本信息。Sql代码mysqlselect*fromeav_entity_typewhereentity_type_id1;---------------------------------------------------------------------------------------| entity_type_id | entity_type_code | entity_model      | attribute_model | entity_table    | ---------------------------------------------------------------------------------------|              1 | customer         | customer/customer |                 | customer/entity |---------------------------------------------------------------------------------------mysql select * from eav_entity_type where entity_type_id1;---------------------------------------------------------------------------------------| entity_type_id | entity_type_code | entity_model | attribute_model | entity_table | ---------------------------------------------------------------------------------------| 1 | customer | customer/customer | | customer/entity |---------------------------------------------------------------------------------------2). eav_entity_attribute表用来定义实体customer模型包含哪些属性Sql代码mysqlselect*fromeav_entity_attributewhereentity_type_id1;-----------------------------------------------------------------------------------------| entity_attribute_id | entity_type_id | attribute_set_id | attribute_group_id | attribute_id |-----------------------------------------------------------------------------------------|                   1 |              1 |                1 |                  1 |            1 ||                   2 |              1 |                1 |                  1 |            2 ||                   3 |              1 |                1 |                  1 |            3 ||                   4 |              1 |                1 |                  1 |            4 ||                   5 |              1 |                1 |                  1 |            5 ||                   6 |              1 |                1 |                  1 |            6 ||                   7 |              1 |                1 |                  1 |            7 ||                   8 |              1 |                1 |                  1 |            8 ||                   9 |              1 |                1 |                  1 |            9 ||                  10 |              1 |                1 |                  1 |           10 ||                  11 |              1 |                1 |                  1 |           11 ||                  12 |              1 |                1 |                  1 |           12 ||                  13 |              1 |                1 |                  1 |           13 ||                  14 |              1 |                1 |                  1 |           14 ||                  15 |              1 |                1 |                  1 |           15 ||                  16 |              1 |                1 |                  1 |           16 |-----------------------------------------------------------------------------------------mysql select * from eav_entity_attribute where entity_type_id1;-----------------------------------------------------------------------------------------| entity_attribute_id | entity_type_id | attribute_set_id | attribute_group_id | attribute_id |-----------------------------------------------------------------------------------------| 1 | 1 | 1 | 1 | 1 || 2 | 1 | 1 | 1 | 2 || 3 | 1 | 1 | 1 | 3 || 4 | 1 | 1 | 1 | 4 || 5 | 1 | 1 | 1 | 5 || 6 | 1 | 1 | 1 | 6 || 7 | 1 | 1 | 1 | 7 || 8 | 1 | 1 | 1 | 8 || 9 | 1 | 1 | 1 | 9 || 10 | 1 | 1 | 1 | 10 || 11 | 1 | 1 | 1 | 11 || 12 | 1 | 1 | 1 | 12 || 13 | 1 | 1 | 1 | 13 || 14 | 1 | 1 | 1 | 14 || 15 | 1 | 1 | 1 | 15 || 16 | 1 | 1 | 1 | 16 |-----------------------------------------------------------------------------------------3), 由上表推出customer实体包含16个属性下面的语句查看每个属性的具体定义Sql代码mysqlselect*fromeav_attributewhereattribute_id16andattribute_id1 ;--------------------------------------------------------------| attribute_id | entity_type_id | attribute_code   | backend_type |--------------------------------------------------------------|            1 |              1 | website_id       | static||            2 |              1 | store_id         | static||            3 |              1 | created_in       | varchar||            4 |              1 | prefix           | varchar||            5 |              1 | firstname        | varchar||            6 |              1 | middlename       | varchar||            7 |              1 | lastname         | varchar||            8 |              1 | suffix           | varchar||            9 |              1 | email            | static||           10 |              1 | group_id         | static||           11 |              1 | dob              | datetime     ||           12 |              1 | password_hash    | varchar||           13 |              1 | default_billing  | int||           14 |              1 | default_shipping | int||           15 |              1 | taxvat           | varchar||           16 |              1 | confirmation     | varchar|--------------------------------------------------------------mysql select * from eav_attribute where attribute_id16 and attribute_id1 ;--------------------------------------------------------------| attribute_id | entity_type_id | attribute_code | backend_type |--------------------------------------------------------------| 1 | 1 | website_id | static || 2 | 1 | store_id | static || 3 | 1 | created_in | varchar || 4 | 1 | prefix | varchar || 5 | 1 | firstname | varchar || 6 | 1 | middlename | varchar || 7 | 1 | lastname | varchar || 8 | 1 | suffix | varchar || 9 | 1 | email | static || 10 | 1 | group_id | static || 11 | 1 | dob | datetime || 12 | 1 | password_hash | varchar || 13 | 1 | default_billing | int || 14 | 1 | default_shipping | int || 15 | 1 | taxvat | varchar || 16 | 1 | confirmation | varchar |--------------------------------------------------------------所以使用上述的模型一旦有CUSTOMER属性定义的添加和删除只需要增加或删除 eav_entity_attribute的记录即可3. 使用EAV模型现在在Magento系统注册一个新的用户看看实例数据如何存放在数据库Sql代码mysqlselect*fromcustomer_entity            ;-----------------------------------------------------------------------------| entity_id | entity_type_id | attribute_set_id | website_id | email              |-----------------------------------------------------------------------------|         1 |              1 |                0 |          1 | koda.guogmail.com |-----------------------------------------------------------------------------mysql select*fromcustomer_entity_varchar    ;----------------------------------------------------------------------------------------| value_id | entity_type_id | attribute_id | entity_id | value                               |----------------------------------------------------------------------------------------|        1 |              1 |            5 |         1 | Koda                                ||        2 |              1 |            7 |         1 | Guo                                 ||        4 |              1 |            3 |         1 | DefaultStoreView||        5 |              1 |           12 |         1 | 2256e441b74ab3454a41c821f5de1e9d:9s |----------------------------------------------------------------------------------------mysql select * from customer_entity ;-----------------------------------------------------------------------------| entity_id | entity_type_id | attribute_set_id | website_id | email |-----------------------------------------------------------------------------| 1 | 1 | 0 | 1 | koda.guogmail.com |-----------------------------------------------------------------------------mysql select * from customer_entity_varchar ;----------------------------------------------------------------------------------------| value_id | entity_type_id | attribute_id | entity_id | value |----------------------------------------------------------------------------------------| 1 | 1 | 5 | 1 | Koda || 2 | 1 | 7 | 1 | Guo || 4 | 1 | 3 | 1 | Default Store View || 5 | 1 | 12 | 1 | 2256e441b74ab3454a41c821f5de1e9d:9s |----------------------------------------------------------------------------------------从上表看到customer_entity 和customer_entity_varchar用来存放相应属性的实际输入值。如Koda, Guo分别属性编号5,7即firstname和lastname实际值和customer实体定义相对应的实例存放的相关表包括Java代码customer_entitycustomer_entity_datetimecustomer_entity_decimalcustomer_entity_intcustomer_entity_textcustomer_entity_varcharcustomer_entitycustomer_entity_datetimecustomer_entity_decimalcustomer_entity_intcustomer_entity_textcustomer_entity_varchar总结了解Magento的EAV模型结构是扩展Magento必须的知识。 其意义在于我们常常需要扩展Magento某些实体的属性或者创建自定义的eav模型实例。希望本文对你有所启示。
http://www.zqtcl.cn/news/185533/

相关文章:

  • 建设执业资格注册中心网站办事大厅ui设计素材库
  • 个人网站免费建站4399电脑版网页链接
  • 重庆开县网站建设公司推荐网站建设与维护高职
  • 关于网站开发的技术博客海口网站设计建设
  • xx市院门户网站建设方案做视频特技的网站
  • 肇庆seo公司咨询23火星seo 网站
  • 天元建设集团有限公司破产新手seo网站做什么类型好
  • spa.net网站开发二次开发需要什么
  • 如何做网站静态页面商丘网签查询
  • 网站建设好学么模版型网站是怎样的
  • 网站维护建设费应计入科目高端营销型网站制作
  • 推荐几个好的网站wordpress 加载数据库表格也卖弄
  • 承德网站开发找人做网站安全吗
  • 百度网站推广电话眼镜网站怎么做竞价
  • 邢台建设银行官方网站为什么建设网站很多公司没有
  • 闵行做网站费用湖南正规网络营销哪家便宜
  • 找个公司做网站需要注意什么wordpress用户名长度
  • 推荐几个没封的正能量网站营销技巧和营销方法视频
  • html mip 网站桂林市临桂区
  • 做网站如何月入10万建行app怎么注册登录
  • 建设一个旅游网站毕业设计建设网站的功能定位是什么原因
  • wordpress网站导航模板杭州建设网站的公司
  • 如何做视频解析网站wordpress 关闭评论
  • 安福网站建设微信开发者工具怎么下载
  • 网罗设计网站威海网页设计制作公司
  • 网站用cmswordpress插件怎么做
  • 如何办好公司网站元器件网站搭建
  • 建设领域行政处罚查询网站wordpress数据库发文章
  • 怎么做网页的多开器宿迁seo优化
  • 别人帮做的网站怎么修改病句店铺引流的30种方法