# as4kdot-api-node **Repository Path**: as4kdots/as4kdot-api-node ## Basic Information - **Project Name**: as4kdot-api-node - **Description**: node 版数据接口 - **Primary Language**: NodeJS - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-30 - **Last Updated**: 2025-11-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 安装 ORM 框架 ```shell npm install --save sequelize mysql2 ``` ## ORM https://github.com/sequelize/sequelize-auto ```shell npm install sequelize-auto ``` ```shell sequelize-auto -o "./models" -d ss -h 106.15.120.34 -u root -p 3306 -x ba9vc2z16mZmmkc0cc -e mysql ``` ## ORM 文档 https://www.sequelize.cn/core-concepts/model-querying-basics#%E6%8E%92%E5%BA%8F # 模块导入的解析方式 [babel-plugin-module-resolver](https://gitcode.com/tleunen/babel-plugin-module-resolver/overview) ## ORM 中的一个坑 https://www.sequelize.cn/core-concepts/model-querying-basics#%E6%93%8D%E4%BD%9C%E7%AC%A6 某一字段几不包含,也不包含的正确写法 ```shell [Op.and]: [ { stock_name: { [Op.notLike]: '%st%', } }, { stock_name: { [Op.notLike]: '%退%', } } ] ``` - 官方文档中的不完整的示例,对于同样的操作符,下面写法有问题 ``` stock_name: { [Op.notLike]: '%st%', [Op.notLike]: '%退%', } ``` ```js Foo.findAll({ where: { rank: { [Op.or]: { [Op.lt]: 1000, [Op.eq]: null } }, // rank < 1000 OR rank IS NULL { createdAt: { [Op.lt]: new Date(), [Op.gt]: new Date(new Date() - 24 * 60 * 60 * 1000) } }, // createdAt < [timestamp] AND createdAt > [timestamp] { [Op.or]: [ { title: { [Op.like]: 'Boat%' } }, { description: { [Op.like]: '%boat%' } } ] } // title LIKE 'Boat%' OR description LIKE '%boat%' } }); ```