diff --git a/app/Http/Controllers/RiceShrimpIndustryController.php b/app/Http/Controllers/RiceShrimpIndustryController.php index 9a8f1e3..2e1b2d9 100644 --- a/app/Http/Controllers/RiceShrimpIndustryController.php +++ b/app/Http/Controllers/RiceShrimpIndustryController.php @@ -2,15 +2,15 @@ namespace App\Http\Controllers; +use App\Enums\OperationType; use App\Http\Requestes\RiceShrimpIndustryStoreRequest; use App\Http\Requestes\RiceShrimpIndustryUpdateRequest; use App\Http\Resources\RiceShrimpIndustryResource; use App\Models\RiceShrimpIndustry; +use App\Services\OperationLogService; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; -use App\Services\OperationLogService; -use App\Enums\OperationType; class RiceShrimpIndustryController extends Controller { @@ -47,8 +47,11 @@ class RiceShrimpIndustryController extends Controller 'year', 'quarter', 'area', + 'area_unit', 'product_output', + 'product_output_unit', 'product_value', + 'product_value_unit', ]) ); $riceShrimpIndustry->created_by = $user->id; @@ -80,8 +83,11 @@ class RiceShrimpIndustryController extends Controller 'year', 'quarter', 'area', + 'area_unit', 'product_output', + 'product_output_unit', 'product_value', + 'product_value_unit', ] as $key) { if ($request->filled($key)) { $riceShrimpIndustry->{$key} = $request->input($key); diff --git a/app/Http/Requestes/RiceShrimpIndustryStoreRequest.php b/app/Http/Requestes/RiceShrimpIndustryStoreRequest.php index 1126de7..7550d44 100644 --- a/app/Http/Requestes/RiceShrimpIndustryStoreRequest.php +++ b/app/Http/Requestes/RiceShrimpIndustryStoreRequest.php @@ -18,8 +18,11 @@ class RiceShrimpIndustryStoreRequest extends FormRequest 'year' => ['required', 'int'], 'quarter' => ['required', new Quarter()], 'area' => ['required', 'int', 'min:0'], + 'area_unit' => ['required', 'string'], 'product_output' => ['required', 'int', 'min:0'], + 'product_output_unit' => ['required', 'string'], 'product_value' => ['required', 'int', 'min:0'], + 'product_value_unit' => ['required', 'string'], ]; } @@ -29,8 +32,11 @@ class RiceShrimpIndustryStoreRequest extends FormRequest 'year' => '年份', 'quarter' => '季度', 'area' => '面积', + 'area_unit' => '面积单位', 'product_output' => '产量', + 'product_output_unit' => '产量单位', 'product_value' => '产值', + 'product_value_unit' => '产值单位', ]; } } diff --git a/app/Http/Requestes/RiceShrimpIndustryUpdateRequest.php b/app/Http/Requestes/RiceShrimpIndustryUpdateRequest.php index 65e072a..5ffe614 100644 --- a/app/Http/Requestes/RiceShrimpIndustryUpdateRequest.php +++ b/app/Http/Requestes/RiceShrimpIndustryUpdateRequest.php @@ -18,8 +18,11 @@ class RiceShrimpIndustryUpdateRequest extends FormRequest 'year' => ['filled', 'int'], 'quarter' => ['filled', new Quarter()], 'area' => ['filled', 'int', 'min:0'], + 'area_unit' => ['filled', 'string'], 'product_output' => ['filled', 'int', 'min:0'], + 'product_output_unit' => ['filled', 'string'], 'product_value' => ['filled', 'int', 'min:0'], + 'product_value_unit' => ['filled', 'string'], ]; } @@ -29,8 +32,11 @@ class RiceShrimpIndustryUpdateRequest extends FormRequest 'year' => '年份', 'quarter' => '季度', 'area' => '面积', + 'area_unit' => '面积单位', 'product_output' => '产量', + 'product_output_unit' => '产量单位', 'product_value' => '产值', + 'product_value_unit' => '产值单位', ]; } } diff --git a/app/Http/Resources/RiceShrimpIndustryResource.php b/app/Http/Resources/RiceShrimpIndustryResource.php index 1d1422f..801f8ed 100644 --- a/app/Http/Resources/RiceShrimpIndustryResource.php +++ b/app/Http/Resources/RiceShrimpIndustryResource.php @@ -19,8 +19,11 @@ class RiceShrimpIndustryResource extends JsonResource 'year' => $this->year, 'quarter' => $this->quarter, 'area' => $this->area, + 'area_unit' => $this->area_unit, 'product_output' => $this->product_output, + 'product_output_unit' => $this->product_output_unit, 'product_value' => $this->product_value, + 'product_value_unit' => $this->product_value_unit, 'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')), 'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')), 'created_at' => $this->created_at->unix(), diff --git a/app/Models/RiceShrimpIndustry.php b/app/Models/RiceShrimpIndustry.php index 85661c2..ca2ce91 100644 --- a/app/Models/RiceShrimpIndustry.php +++ b/app/Models/RiceShrimpIndustry.php @@ -14,8 +14,11 @@ class RiceShrimpIndustry extends Model 'year', 'quarter', 'area', + 'area_unit', 'product_output', + 'product_output_unit', 'product_value', + 'product_value_unit', 'created_by', 'updated_by', ]; diff --git a/database/migrations/2022_11_01_151242_create_rice_shrimp_industries_table.php b/database/migrations/2022_11_01_151242_create_rice_shrimp_industries_table.php index d117771..ddd432b 100644 --- a/database/migrations/2022_11_01_151242_create_rice_shrimp_industries_table.php +++ b/database/migrations/2022_11_01_151242_create_rice_shrimp_industries_table.php @@ -18,8 +18,11 @@ return new class extends Migration $table->integer('year')->comment('年'); $table->tinyInteger('quarter')->comment('季度'); $table->unsignedBigInteger('area')->comment('面积'); + $table->string('area_unit')->comment('面积单位'); $table->unsignedBigInteger('product_output')->comment('产量'); + $table->string('product_output_unit')->comment('产量单位'); $table->unsignedBigInteger('product_value')->comment('产值'); + $table->string('product_value_unit')->comment('产值单位'); $table->unsignedBigInteger('created_by')->comment('创建人ID'); $table->unsignedBigInteger('updated_by')->comment('修改人ID'); $table->timestamps();