'use strict'; /** * B2B 订单分箱商品明细。 * @param {import('egg').Application} app Egg 应用实例。 */ module.exports = app => { const { BIGINT, INTEGER, STRING, DATE } = app.Sequelize; return app.model.define('wms_order_b2b_items', { id: { type: BIGINT(20).UNSIGNED, primaryKey: true, autoIncrement: true, allowNull: false, comment: '主键ID', }, warehouse_id: { type: BIGINT(20).UNSIGNED, allowNull: false, comment: '仓库ID', }, order_id: { type: BIGINT(20).UNSIGNED, allowNull: false, comment: '订单ID', }, order_item_id: { type: BIGINT(20).UNSIGNED, allowNull: false, comment: '订单商品明细ID', }, box_no: { type: STRING(50), allowNull: false, comment: '箱号', }, quantity: { type: INTEGER(11).UNSIGNED, allowNull: false, comment: '该商品在该箱中的数量', }, created_at: { type: DATE, allowNull: false, comment: '创建时间', }, updated_at: { type: DATE, allowNull: false, comment: '更新时间', }, }, { tableName: 'wms_order_b2b_items', comment: 'B2B订单分箱商品明细表', timestamps: false, indexes: [ { name: 'uk_warehouse_order_item_box', unique: true, fields: [ 'warehouse_id', 'order_id', 'order_item_id', 'box_no' ], }, { name: 'idx_warehouse_order', fields: [ 'warehouse_id', 'order_id' ], }, { name: 'idx_order_item', fields: [ 'order_item_id' ], }, ], }); };