123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- 'use strict';
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const sequelize = app.model;
- const attributes = {
- categoryId: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: "自增ID",
- field: "category_id"
- },
- categoryName: {
- type: DataTypes.STRING(200),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类名称",
- field: "category_name"
- },
- categoryDesc: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类描述",
- field: "category_desc"
- },
- categoryImage: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类图片",
- field: "category_image"
- },
- pid: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "上级id",
- field: "pid"
- },
- categorySort: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类排序",
- field: "category_sort"
- },
- categoryStatus: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类状态",
- field: "category_status"
- },
- categoryLevel: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "分类等级",
- field: "category_level"
- },
- categoryRecommend: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "是否推荐",
- field: "category_recommend"
- },
- adminId: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "管理员ID",
- field: "admin_id"
- },
- updateTime: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
- primaryKey: false,
- autoIncrement: false,
- comment: "更新时间",
- field: "update_time"
- },
- createTime: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "添加时间",
- field: "create_time"
- }
- };
- const options = {
- tableName: "szj_articles_category",
- comment: "",
- indexes: [{
- name: "category_status",
- unique: false,
- type: "BTREE",
- fields: ["category_status"]
- }]
- };
- const SzjArticlesCategoryModel = sequelize.define("szjArticlesCategoryModel", attributes, options);
- return SzjArticlesCategoryModel;
- };
|