babyfish-ct / jimmer

A revolutionary ORM framework for both java and kotlin.
Apache License 2.0
873 stars 86 forks source link

not generate type for dto when use @Serialized on dto. #789

Open qifan777 opened 4 days ago

qifan777 commented 4 days ago

1. Entity

BaseOrder

@Entity
public interface BaseOrder extends BaseEntity {
    /**
     * 地址详情
     */
    @Serialized
    @Null
    AddressView address();
}

Address

@GenEntity
@Entity
public interface Address extends BaseEntity {

    /**
     * 维度
     */
    double latitude();

    /**
     * 经度
     */
    double longitude();

   /**
     * 省略...
     */
}

2. Dto

  1. write AddressView in address.dto
    input AddressInput {
    #allScalars(Address)
    id
    -province
    -district
    -city
    }
    //AdressView{
    //    #allScalars(Address)
    //}
    specification AddressSpec {
    #allScalars
    associatedIdEq(creator)
    }
  2. copy AddressView from generated source to src
  3. use AddressView in BaseOrder
    @Serialized
    @Null
    AddressView address();

3. Generate Type

`FGDVRU}%U}@7B6GYQ_ROIM

babyfish-ct commented 4 days ago

Add unit test: https://github.com/babyfish-ct/jimmer/blob/main/project/jimmer-client/src/test/kotlin/org/babyfish/jimmer/client/kotlin/ts/GisServiceTest.kt

Like this issuse, a generated file is moved into src manually: https://github.com/babyfish-ct/jimmer/blob/main/project/jimmer-client/src/test/kotlin/org/babyfish/jimmer/client/kotlin/model/GisRegionView.kt

No problem is found