import { Entity , PrimaryGeneratedColumn , Column , OneToMany , ManyToOne } from 'typeorm' ; import { PictureGroup } from './picture-group.entity' ; @ Entity ( 'picture' ) export class Picture { @ PrimaryGeneratedColumn ( { comment : '自增主键' , } ) id : number ; @ Column ( { comment : '图片地址' } ) name : string ; @ Column ( { comment : '图片跳转链接' , nullable : true } ) Url : string ; @ Column ( { comment : '图片名称,' , nullable : true } ) title : string ; @ Column ( { comment : '排序' , nullable : true } ) sequence : number ; @ ManyToOne ( type => PictureGroup , pictureGroup => pictureGroup . pictures , { onDelete : 'CASCADE' } ) pictureGroup : PictureGroup ; }