mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2025-12-30 14:00:16 +00:00
111
This commit is contained in:
parent
2a501ed8e9
commit
ac8b7c62fc
@ -1,10 +1,10 @@
|
||||
import { App, Configuration } from '@midwayjs/decorator';
|
||||
import { ILifeCycle, IMidwayContainer } from '@midwayjs/core';
|
||||
import * as orm from '@midwayjs/orm';
|
||||
import * as cool from '@midwayjs/cool-core';
|
||||
import { listModule } from '@midwayjs/decorator';
|
||||
import { Application } from 'egg';
|
||||
import * as moment from 'moment';
|
||||
import * as cool from '@midwayjs/cool-core';
|
||||
|
||||
@Configuration({
|
||||
imports: [
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { BaseController } from '@midwayjs/cool-core';
|
||||
import { Controller, Get, Query, Provide } from '@midwayjs/decorator';
|
||||
import { User } from '../model/user';
|
||||
import { Repository } from 'typeorm';
|
||||
import { InjectEntityModel } from '@midwayjs/orm';
|
||||
import { BaseController } from '@midwayjs/cool-core';
|
||||
|
||||
@Provide()
|
||||
@Controller('/test')
|
||||
export class HomeController extends BaseController {
|
||||
export class HomeController extends BaseController{
|
||||
|
||||
@InjectEntityModel(User)
|
||||
userModel: Repository<User>
|
||||
@ -15,4 +15,10 @@ export class HomeController extends BaseController {
|
||||
return this.userModel;
|
||||
}
|
||||
|
||||
// 根据ID 获得单条信息
|
||||
@Get("/info")
|
||||
async info(@Query() id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
import { EntityModel } from '@midwayjs/orm';
|
||||
import { Column, Index } from 'typeorm';
|
||||
import { BaseModel } from '@midwayjs/cool-core';
|
||||
|
||||
/**
|
||||
* 系统角色
|
||||
*/
|
||||
@EntityModel('sys_role')
|
||||
export class SysRole extends BaseModel{
|
||||
// 名称
|
||||
@Column()
|
||||
userId: string;
|
||||
// 名称
|
||||
@Index({ unique: true })
|
||||
@Column()
|
||||
name: string;
|
||||
// 角色标签
|
||||
@Index({ unique: true })
|
||||
@Column({ nullable: true, length: 50 })
|
||||
label: string;
|
||||
// 备注
|
||||
@Column({ nullable: true })
|
||||
remark: string;
|
||||
}
|
||||
@ -1,10 +1,9 @@
|
||||
import { BaseModel } from '@midwayjs/cool-core';
|
||||
import { EntityModel } from '@midwayjs/orm';
|
||||
import { PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { Column } from 'typeorm';
|
||||
|
||||
@EntityModel('user')
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn({ name: "id" })
|
||||
id: number;
|
||||
export class User extends BaseModel{
|
||||
|
||||
@Column({ name: "name" })
|
||||
name: string;
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import { Provide } from '@midwayjs/decorator';
|
||||
import { IUserOptions } from '../interface';
|
||||
import { BaseService } from '@midwayjs/cool-core'
|
||||
|
||||
@Provide()
|
||||
export class UserService extends BaseService {
|
||||
export class UserService {
|
||||
|
||||
async getUser(options: IUserOptions) {
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user