使用import-jdl创建实体

问题描述 投票:0回答:1

我是JHipster的新手,创造了我的第一个项目。

我使用jdl-studio创建.jdl文件,现在尝试使用下面的命令导入它。

jhipster import-jdl initial-schema / initial-schema.jdl --debug

这给了我以下错误,但错误没有给出特定的错误,如关系或创建表命令的错误。

错误:-

    Error: ERROR! Copying template /Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIntTest.java.ejs failed. [TypeError: /Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIntTest.java.ejs:262
    260|     private static final Long <%=defaultValueName %> = <%= defaultValue %>L;
    261|     private static final Long <%=updatedValueName %> = <%= updatedValue %>L;
 >> 262| <%_ } else if (fieldType === 'Float') { _%>
    263| 
    264|     private static final <%=fieldType %> <%=defaultValueName %> = <%= defaultValue %>F;
    265|     private static final <%=fieldType %> <%=updatedValueName %> = <%= updatedValue %>F;

Cannot read property 'replace' of undefined]
    at Environment.error (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/yeoman-environment/lib/environment.js:157:40)
    at module.exports.error (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1516:18)
    at ejs.renderFile (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/utils.js:207:23)
    at tryHandleCache (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/ejs/lib/ejs.js:254:14)
    at Object.exports.renderFile (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/ejs/lib/ejs.js:482:10)
    at Object.renderContent (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/utils.js:203:9)
    at module.exports.template (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base-private.js:672:23)
    at blockTemplate.templates.forEach.templateObj (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1936:42)
    at Array.forEach (<anonymous>)
    at module.exports.writeFilesToDisk (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1898:45)
Emitted 'error' event at:
    at Immediate.setImmediate (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/yeoman-generator/lib/index.js:427:22)
    at processImmediate (timers.js:637:19)

我的.jdl文件在这里。

entity Currency {
    name String, 
    code String, 
    symbol String
}

entity Country {
    name String, 
    code Long, 
    flagImage BLOB
}
relationship OneToOne {
    Country{currency} to Currency
}

entity City{
    name String, 
    code String, 
    flagImage BLOB
}
relationship OneToMany {
    Country{city} to City
}

entity Company {
    name String, 
    code Long, 
    description String, 
    address String, 
    image BLOB
}
relationship OneToMany {
    Company{country} to Country
}


entity Employee {
    firstname String, lastname String, code Long, description String, address String, email String, 
landPhoneNumber String, mobilePhoneNumber String, image BLOB, fileUploadDirectory String
}

relationship ManyToOne {
    Employee{country} to Country,
    Employee{company} to Company
}

entity Role {
    name String, code Long, description String
}
relationship ManyToOne {
Employee{role} to Role
}

entity Appointment {
    name String, code Long, description String, address String, startDate LocalDate, endDate LocalDate
}
relationship OneToOne {
    Employee{employeeApointment} to Appointment
}

entity Group {
    name String, code Long, description String
}

relationship ManyToMany {
Group{employee} to Employee{group}
Employee{group} to Group{employee}
}



entity SubscriptionPack {
    name String, code Long, description String, price Double, renewPrice Double, period Double
}
relationship ManyToOne {
    SubscriptionPack{currenty} to Currency
}

entity EmployeeSubscription {
    subscriptionStart LocalDate, subscriptionEnd LocalDate
}
relationship OneToMany {
    Employee{employeeSubscription} to EmployeeSubscription
}
relationship ManyToOne {
    EmployeeSubscription{subscriptionPack} to SubscriptionPack
}

entity EmployeeSubscriptionInvoice {
    paymentDetailsAtts String
}
relationship OneToOne {
     EmployeeSubscription{employeeSubscriptionInvoice} to EmployeeSubscriptionInvoice
}

entity EmployeeSubscriptionInvoicePayment {
    paymentDetailsAtts String
}
relationship OneToOne {
    EmployeeSubscription{employeeSubscriptionInvoicePayment} to EmployeeSubscriptionInvoicePayment
}

entity EmployeeHolidays {
    name String, description String, startDate LocalDate, endDate LocalDate
}
relationship ManyToOne {
    Employee{employeeHolidays} to EmployeeHolidays
}


entity PublicHolidays {
    name String, description String, startDate LocalDate, endDate LocalDate
}


entity WorkPolicy {
    name String, description String, mondayStartTime LocalDate, mondayEndTime LocalDate, mondayBreakStartTime LocalDate, mondayBreakEndTime LocalDate, tuesdayStartTime LocalDate, tuesdayEndTime LocalDate, tuesdayBreakStartTime LocalDate, tuesdayBreakEndTime LocalDate, wednesdayStartTime LocalDate, wednesdayEndTime LocalDate, wednesdayBreakStartTime LocalDate, wednesdayBreakEndTime LocalDate, thursdayStartTime LocalDate, thursdayEndTime LocalDate, thursdayBreakStartTime LocalDate, thursdayBreakEndTime LocalDate, fridayStartTime LocalDate, fridayEndTime LocalDate, fridayBreakStartTime LocalDate, fridayBreakEndTime LocalDate, saturdayStartTime LocalDate, saturdayEndTime LocalDate, saturdayBreakStartTime LocalDate, saturdayBreakEndTime LocalDate, sundayStartTime LocalDate, sundayEndTime LocalDate, sundayBreakStartTime LocalDate, sundayBreakEndTime LocalDate
}


entity Report {
    name String, description String, createdOn LocalDate
}
relationship OneToMany {
    Employee{employeeReport} to Report
}

entity ReportQuestion {
    description String, createdOn LocalDate, dataType String, value String
}
relationship OneToMany {
    Report{reportQuestion} to ReportQuestion
}

entity ReportQuestionOption {
    description String
}
relationship OneToMany {
    ReportQuestion{reportQuestionOption} to ReportQuestionOption
}


entity EmployeeNotification  {
    byEmail Boolean, onDesktop Boolean, onEveryReport Boolean, onEveryAppointment Boolean, bySMS Boolean 
}
relationship OneToMany {
    Employee{employeeNotification} to EmployeeNotification
}

entity EmployeeDocuments {
    title String, description String, createdOn LocalDate
}
relationship OneToMany {
    Employee{employeeDocuments} to EmployeeDocuments
}

paginate all with pagination
dto * with mapstruct
service all with serviceImpl 
jhipster
1个回答
1
投票

你的JDL是错的,BLOB应拼写为Blob

请参阅官方文档类型:https://www.jhipster.tech/jdl/#types_and_constraints

还可以考虑使用带有JHipster JDL扩展的Visual Studio代码来编辑JDL文件,它会突出显示这样的错误。

© www.soinside.com 2019 - 2024. All rights reserved.