只要添加以下这句话:
测试数据如下:
{ "title":"hello test 2021-07-14", "description":"hello ,this is first post test", "originalPrice":5998.9, "discountPercent":0.9, "coupons":null, "points":220, "TouristRoutePictures":[{ "url":"../../assets/images/test1.jpg" }, { "url":"../../assets/images/test2.jpg" }] }
测试结果如下:
代码解释:为啥只要添加一行上面的代码,就能同时创建父子资源?
原因在于AUTOMAP,所以要熟练掌握AUTOMAP,(为啥要保持模型中的子资源与DTO中子资源名字一样,也是AUTOMAP的要求?)