Quellcode durchsuchen

资产添加新字段(净权益,开发商,完成年份,总建筑面积,联系人,物业,建筑类型描述)

kely vor 1 Jahr
Ursprung
Commit
2b93854e65

+ 11 - 0
app/Http/Resources/API/AssetResource.php

@@ -34,11 +34,22 @@ class AssetResource extends JsonResource
             'requirement_total' => $this->total_requirements_count,
             'requirement_total' => $this->total_requirements_count,
             'plan_total' => $this->total_plans_count,
             'plan_total' => $this->total_plans_count,
             'created_at'=> $this->created_at,
             'created_at'=> $this->created_at,
+            'equity_interest'=>$this->equity_interest,
+            'developer' =>$this->developer,
+            'date_completed' =>$this->date_completed,
+            'total_floor_area' => $this->total_floor_area,
+            'contact_person'=>$this->contact_person,
+            'contact_phone'=>$this->contact_phone,
+            'contact_email'=>$this->contact_email,
+            'property'=> $this->property,
+            'building_type_description'=>$this->building_type_description,
             'children' =>  $this->when($this->children->isNotEmpty(), function () {
             'children' =>  $this->when($this->children->isNotEmpty(), function () {
                 return $this->children->map(function ($child) {
                 return $this->children->map(function ($child) {
                     return new AssetResource($child, $this->level);
                     return new AssetResource($child, $this->level);
                 })->all();
                 })->all();
             }),
             }),
+
+
         ];
         ];
     }
     }
 }
 }

+ 1 - 0
app/Models/Asset.php

@@ -21,6 +21,7 @@ class Asset extends Model
         "name", "code", "description", "company_id", "status", "created_by",
         "name", "code", "description", "company_id", "status", "created_by",
         "owner", "address", "group_id", "geo_address_code", "acl",
         "owner", "address", "group_id", "geo_address_code", "acl",
         "whitelist", "latitude", "longitude","parent_id", "path",
         "whitelist", "latitude", "longitude","parent_id", "path",
+        "equity_interest","developer","date_completed","total_floor_area","contact_person","contact_phone","contact_email","property","building_type_description"
     ];
     ];
 
 
     protected static function booted(): void
     protected static function booted(): void

+ 38 - 0
database/migrations/2024_03_13_112420_add_columns_to_assets.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('assets', function (Blueprint $table) {
+            //
+            $table->string('equity_interest')->comment('净权益')->nullable();
+            $table->string('developer')->comment('开发商')->nullable();
+            $table->integer('date_completed')->comment('资产完成年份(纯年份)')->nullable();
+            $table->string('total_floor_area')->comment('总建筑面积')->nullable();
+            $table->string('contact_person')->comment('联系人')->nullable();
+            $table->string('contact_phone')->comment('联系人电话')->nullable();
+            $table->string('contact_email')->comment('联系人邮箱')->nullable();
+            $table->string('property')->comment('物业')->nullable();
+            $table->text('building_type_description')->comment('建筑类型描述')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('assets', function (Blueprint $table) {
+            //
+            $table->dropColumn(['equity_interest','developer','date_completed','total_floor_area','contact_person','contact_phone','contact_email','property','building_type_description']);
+        });
+    }
+};