为SMART属性创建逻辑

时间:2016-06-21 08:33:59

标签: php sql logic

我正在建立一个产品库存应用程序,它允许用户为产品创建主模板,例如

    CPU 
      - cpu_option1
      - cpu_option2
      - cpu_option3
    MEM
      - mem_option1
      - mem_option2
      - mem_option3

当我选择cpu_option1时,mem_option2mem_option3不可用。

These rules are not pre-programmed, these rules are created/changed by any user

我正在广泛搜索这些智能属性的示例以及如何实现逻辑/设计模式。

ontopic:我正在寻找存储和使用这些规则的设计模式

1 个答案:

答案 0 :(得分:1)

数据库看起来像这样:

  • 组件(id,name)

    1 - CPU

    2 - MEM

  • 选项(ID,名称)

    1 - cpu_option1

    2 - cpu_option2

    3 - cpu_option3

    4 - mem_option1

    5 - mem_option2

    6 - mem_option3

  • Components2Options(cid,oid)

    1 - 1

    1 - 2

    1 - 3

    2 - 4

    2 - 5

    2 - 6

  • Options2Combine(oid1,oid2)

    1 - 4

    2 - 5

    3 - 5

    3 - 6

此示例显示

  • cpu_option1适用于mem_option1
  • cpu_option2适用于mem_option2
  • cpu_option3适用于mem_option2和mem_option3

如果这回答了你的问题?

相关问题