123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- 'use strict';
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const sequelize = app.model;
- const attributes = {
- adminId: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: true,
- autoIncrement: true,
- comment: "管理员ID",
- field: "admin_id"
- },
- username: {
- type: DataTypes.STRING(20),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "username"
- },
- password: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "password"
- },
- roleId: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "role_id"
- },
- adminStatus: {
- type: DataTypes.INTEGER(1).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "admin_status"
- },
- loginIp: {
- type: DataTypes.STRING(15),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "login_ip"
- },
- loginTime: {
- type: DataTypes.DATE,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "login_time"
- },
- loginCount: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "登录次数",
- field: "login_count"
- },
- adminToken: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "admin_token"
- },
- adminCode: {
- type: DataTypes.CHAR(6),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "admin_code"
- },
- otherAuth: {
- type: DataTypes.STRING(255),
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "other_auth"
- },
- actionUser: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: "操作user_id",
- field: "action_user"
- },
- 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_admin_user",
- comment: "",
- indexes: [{
- name: "role_id",
- unique: false,
- type: "BTREE",
- fields: ["role_id"]
- }, {
- name: "username",
- unique: false,
- type: "BTREE",
- fields: ["username"]
- }]
- };
- const SzjAdminUserModel = sequelize.define("szjAdminUserModel", attributes, options);
- return SzjAdminUserModel;
- };
|