{
  "name": "ch3",
  "nodes": [
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "value": "public",
          "mode": "list",
          "cachedResultName": "public"
        },
        "table": {
          "__rl": true,
          "value": "=lunar_products",
          "mode": "name"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        208,
        0
      ],
      "id": "adefb8c9-e9fb-4adc-a788-36899857b843",
      "name": "Select rows from a table",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "\u9810\u8cfc\u8a02\u55ae",
        "formDescription": "\u5e74\u83dc\u5546\u54c1\u9810\u8cfc\u8a02\u55ae",
        "formFields": {
          "values": [
            {
              "fieldLabel": "name"
            },
            {
              "fieldLabel": "phone"
            },
            {
              "fieldLabel": "email"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "position": [
        16,
        0
      ],
      "id": "abd9b36f-0570-4ade-a960-67f2f4136b2b",
      "name": "On form submission"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1046e21a-fa53-4f56-8c3d-a3383fe105cb",
              "name": "\u4e0b\u8a02\u5546\u54c1",
              "value": "={{ $json[\"\u9810\u8cfc\u5546\u54c1\u7de8\u865f\"] }}",
              "type": "array"
            },
            {
              "id": "0c3863d2-bf39-464e-99ff-0dc7f4255b7e",
              "name": "\u4e0b\u8a02\u6578\u91cf",
              "value": "={{ $json[\"\u8a02\u8cfc\u6578\u91cf\"] }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        624,
        0
      ],
      "id": "165b3821-aac1-4118-9589-d203a0102e2c",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "select stock_limit from lunar_products where product_name='{{ $json['\u4e0b\u8a02\u5546\u54c1'][0] }}'",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        832,
        0
      ],
      "id": "e88e73cc-7142-479d-ba34-1fcdac93d56e",
      "name": "Execute a SQL query",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "ddsd@dsajfkds",
        "subject": "agdga",
        "message": "agds",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        336,
        384
      ],
      "id": "2cd6f54e-c7b4-4ba6-bd58-aec86804fac9",
      "name": "[\u5eab\u5b58\u4e0d\u8db3] \u56de\u50b3\u300c\u5546\u54c1\u5df2\u552e\u5b8c\u300d\u932f\u8aa4\u8a0a\u606f",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "ddd@gmail.com",
        "subject": "ddd",
        "message": "dddd",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        592,
        224
      ],
      "id": "d1f126e7-63dc-4767-93ec-9f8c77fa1a4d",
      "name": "\u767c\u9001\u8a02\u8cfc\u78ba\u8a8d\u4fe1\u7d66\u5ba2\u6236",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "lunar_products",
          "mode": "list",
          "cachedResultName": "lunar_products"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": 0,
            "price": 0,
            "stock_limit": 0,
            "current_stock": 0
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "product_name",
              "displayName": "product_name",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "displayName": "category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "displayName": "price",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "stock_limit",
              "displayName": "stock_limit",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "current_stock",
              "displayName": "current_stock",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "pickup_date",
              "displayName": "pickup_date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "product_id",
              "displayName": "product_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        336,
        224
      ],
      "id": "af9ce5c8-a34a-412f-bbcd-2e5795b70f6f",
      "name": "\u6263\u6e1b\u5eab\u5b58",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "0ec44244-d52a-43d9-a175-968c6a6d320b",
              "leftValue": "={{ $json.stock_limit.toNumber()  }}",
              "rightValue": "={{ $('Edit Fields').item.json['\u4e0b\u8a02\u6578\u91cf'] }}",
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        16,
        240
      ],
      "id": "7feddca1-c725-47b1-9763-ac411a6bf2ae",
      "name": "\u5eab\u5b58 >= \u8a02\u8cfc\u6578\u91cf\uff1f"
    },
    {
      "parameters": {
        "formFields": {
          "values": [
            {
              "fieldLabel": "\u9810\u8cfc\u5546\u54c1\u7de8\u865f",
              "fieldType": "checkbox",
              "fieldOptions": {
                "values": [
                  {
                    "option": "={{ $json.product_name}}"
                  },
                  {
                    "option": "=\u7d05\u71d2\u8e44\u8180\u79ae\u76d2"
                  },
                  {
                    "option": "\u5e72\u8c9d\u863f\u8514\u7cd5\uff083\u65a4\u88dd\uff09"
                  },
                  {
                    "option": "\u6771\u5761\u8089\u516b\u65b9\u9032\u5bf6"
                  },
                  {
                    "option": "\u6e05\u84b8\u9c78\u9b5a\u5e74\u5e74\u6709\u9918"
                  },
                  {
                    "option": "\u5341\u5168\u5341\u7f8e\u7d44\u5408\u5305"
                  }
                ]
              },
              "limitSelection": "range"
            },
            {
              "fieldLabel": "\u8a02\u8cfc\u6578\u91cf",
              "fieldType": "number"
            },
            {
              "fieldLabel": "created_at",
              "fieldType": "date",
              "fieldName": "={{ $now.toISO() }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.5,
      "position": [
        416,
        0
      ],
      "id": "c24a7d77-f15c-4f3d-98f1-6ec7a7d77e8d",
      "name": "\u63a5\u6536\u8a02\u55ae"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        864,
        240
      ],
      "id": "89b16aed-4604-416b-b636-291667665018",
      "name": "\u65e9\u4e0a 8 \u9ede\u6aa2\u67e5"
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "lunar_products",
          "mode": "list",
          "cachedResultName": "lunar_products"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1072,
        240
      ],
      "id": "61554ac1-2ac6-49fe-9ada-003d5ab44a0e",
      "name": "\u67e5\u5269\u9918\u5eab\u5b58",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "315fe4f5-bb82-43da-adb6-01b3b62a48ae",
              "leftValue": "",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        1280,
        240
      ],
      "id": "a72f5cb0-b958-45dc-b041-b3e7763392c5",
      "name": "\u662f\u5426\u4f4e\u65bc\u9810\u8cfc\u4e0a\u9650\u7684 20%"
    },
    {
      "parameters": {
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.line",
      "typeVersion": 1,
      "position": [
        1488,
        144
      ],
      "id": "b7d8a7f8-8cc3-4bac-8309-897b53be6e81",
      "name": "\u901a\u77e5\u7d66\u63a1\u8cfc\u4eba\u54e1"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        864,
        576
      ],
      "id": "9a1b1f64-8c9d-4624-8080-06e4834eefff",
      "name": "\u6bcf\u5929\u6aa2\u67e5\u53d6\u8ca8\u65e5"
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "lunar_products",
          "mode": "list",
          "cachedResultName": "lunar_products"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1072,
        576
      ],
      "id": "f9bcdf5e-6578-4411-8089-a8157ff8f46a",
      "name": "\u53d6\u8ca8\u524d\u4e09\u5929\u7684\u8a02\u55ae",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "adsf@dsaf",
        "subject": "sdaf",
        "message": "sdaf",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1296,
        576
      ],
      "id": "3fc54a22-2287-40bf-bdf7-b3bc665f5bcb",
      "name": "\u63d0\u9192\u5ba2\u6236\u8a18\u5f97\u53d6\u8ca8",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        864,
        848
      ],
      "id": "b906cea9-58a4-4c3b-9f14-ecbc02a6ef78",
      "name": "\u6bcf\u9031\u4e00\u7d71\u8a08"
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "lunar_products",
          "mode": "list",
          "cachedResultName": "lunar_products"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1056,
        848
      ],
      "id": "3eb2818c-1921-450c-8cc7-36179be8a5a0",
      "name": "\u4e0a\u9031\u7684\u5e74\u83dc\u92b7\u552e\u7d71\u8a08\u5831\u8868",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "adsf@dsaf",
        "subject": "sdaf",
        "message": "sdaf",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1264,
        848
      ],
      "id": "c65996e2-1d97-45bb-835e-b051d22e72f9",
      "name": "\u5bc4\u7d66\u7ba1\u7406\u5c64",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select rows from a table": {
      "main": [
        [
          {
            "node": "\u63a5\u6536\u8a02\u55ae",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Execute a SQL query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute a SQL query": {
      "main": [
        [
          {
            "node": "\u5eab\u5b58 >= \u8a02\u8cfc\u6578\u91cf\uff1f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6263\u6e1b\u5eab\u5b58": {
      "main": [
        [
          {
            "node": "\u767c\u9001\u8a02\u8cfc\u78ba\u8a8d\u4fe1\u7d66\u5ba2\u6236",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5eab\u5b58 >= \u8a02\u8cfc\u6578\u91cf\uff1f": {
      "main": [
        [
          {
            "node": "\u6263\u6e1b\u5eab\u5b58",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[\u5eab\u5b58\u4e0d\u8db3] \u56de\u50b3\u300c\u5546\u54c1\u5df2\u552e\u5b8c\u300d\u932f\u8aa4\u8a0a\u606f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u63a5\u6536\u8a02\u55ae": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u65e9\u4e0a 8 \u9ede\u6aa2\u67e5": {
      "main": [
        [
          {
            "node": "\u67e5\u5269\u9918\u5eab\u5b58",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u67e5\u5269\u9918\u5eab\u5b58": {
      "main": [
        [
          {
            "node": "\u662f\u5426\u4f4e\u65bc\u9810\u8cfc\u4e0a\u9650\u7684 20%",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u662f\u5426\u4f4e\u65bc\u9810\u8cfc\u4e0a\u9650\u7684 20%": {
      "main": [
        [
          {
            "node": "\u901a\u77e5\u7d66\u63a1\u8cfc\u4eba\u54e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6bcf\u5929\u6aa2\u67e5\u53d6\u8ca8\u65e5": {
      "main": [
        [
          {
            "node": "\u53d6\u8ca8\u524d\u4e09\u5929\u7684\u8a02\u55ae",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53d6\u8ca8\u524d\u4e09\u5929\u7684\u8a02\u55ae": {
      "main": [
        [
          {
            "node": "\u63d0\u9192\u5ba2\u6236\u8a18\u5f97\u53d6\u8ca8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6bcf\u9031\u4e00\u7d71\u8a08": {
      "main": [
        [
          {
            "node": "\u4e0a\u9031\u7684\u5e74\u83dc\u92b7\u552e\u7d71\u8a08\u5831\u8868",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u4e0a\u9031\u7684\u5e74\u83dc\u92b7\u552e\u7d71\u8a08\u5831\u8868": {
      "main": [
        [
          {
            "node": "\u5bc4\u7d66\u7ba1\u7406\u5c64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "a1cd0803-d16c-46c9-ba3b-b6db0e142345",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "S0Qxffhoih63UCRh",
  "tags": []
}