diff --git a/app/controller/info.md b/app/controller/info.md new file mode 100644 index 0000000..6652712 --- /dev/null +++ b/app/controller/info.md @@ -0,0 +1 @@ +控制器 diff --git a/app/controller/user.ts b/app/controller/user.ts new file mode 100644 index 0000000..6a84ad8 --- /dev/null +++ b/app/controller/user.ts @@ -0,0 +1,11 @@ +import { BaseController } from '../lib/base/controller'; +import routerDecorator from '../lib/router'; +import { Context } from 'egg'; + +@routerDecorator.prefix('/user', [ 'add', 'delete', 'update', 'info', 'list', 'page' ]) +export default class User extends BaseController { + constructor (ctx: Context) { + super(ctx); + this.setEntity(this.ctx.repo.sys.User); + } +} diff --git a/app/entities/info.md b/app/entities/info.md new file mode 100644 index 0000000..b9e5bd2 --- /dev/null +++ b/app/entities/info.md @@ -0,0 +1 @@ +数据模型 diff --git a/app/entities/user.ts b/app/entities/user.ts new file mode 100644 index 0000000..bcfceb8 --- /dev/null +++ b/app/entities/user.ts @@ -0,0 +1,13 @@ +import { BaseEntity } from '../lib/base/entity'; +import { Entity, Column } from 'typeorm'; + +@Entity({ name: 'user' }) +export default class User extends BaseEntity { + // 用户名 + @Column() + name: string; + // 昵称 + @Column() + nickName: string; + +} diff --git a/config/config.local.ts b/config/config.local.ts index fd4beed..722a804 100644 --- a/config/config.local.ts +++ b/config/config.local.ts @@ -13,9 +13,9 @@ export default () => { type: 'mysql', host: '127.0.0.1', port: 3306, - username: '', - password: '', - database: '', + username: 'root', + password: '123123', + database: 'cool-admin', synchronize: true, logging: true, },