稻虾产值增加单位

dev
Jing Li 2022-11-16 15:25:52 +08:00
parent 81abd7270d
commit b512516b69
6 changed files with 29 additions and 2 deletions

View File

@ -2,15 +2,15 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Enums\OperationType;
use App\Http\Requestes\RiceShrimpIndustryStoreRequest; use App\Http\Requestes\RiceShrimpIndustryStoreRequest;
use App\Http\Requestes\RiceShrimpIndustryUpdateRequest; use App\Http\Requestes\RiceShrimpIndustryUpdateRequest;
use App\Http\Resources\RiceShrimpIndustryResource; use App\Http\Resources\RiceShrimpIndustryResource;
use App\Models\RiceShrimpIndustry; use App\Models\RiceShrimpIndustry;
use App\Services\OperationLogService;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
use App\Services\OperationLogService;
use App\Enums\OperationType;
class RiceShrimpIndustryController extends Controller class RiceShrimpIndustryController extends Controller
{ {
@ -47,8 +47,11 @@ class RiceShrimpIndustryController extends Controller
'year', 'year',
'quarter', 'quarter',
'area', 'area',
'area_unit',
'product_output', 'product_output',
'product_output_unit',
'product_value', 'product_value',
'product_value_unit',
]) ])
); );
$riceShrimpIndustry->created_by = $user->id; $riceShrimpIndustry->created_by = $user->id;
@ -80,8 +83,11 @@ class RiceShrimpIndustryController extends Controller
'year', 'year',
'quarter', 'quarter',
'area', 'area',
'area_unit',
'product_output', 'product_output',
'product_output_unit',
'product_value', 'product_value',
'product_value_unit',
] as $key) { ] as $key) {
if ($request->filled($key)) { if ($request->filled($key)) {
$riceShrimpIndustry->{$key} = $request->input($key); $riceShrimpIndustry->{$key} = $request->input($key);

View File

@ -18,8 +18,11 @@ class RiceShrimpIndustryStoreRequest extends FormRequest
'year' => ['required', 'int'], 'year' => ['required', 'int'],
'quarter' => ['required', new Quarter()], 'quarter' => ['required', new Quarter()],
'area' => ['required', 'int', 'min:0'], 'area' => ['required', 'int', 'min:0'],
'area_unit' => ['required', 'string'],
'product_output' => ['required', 'int', 'min:0'], 'product_output' => ['required', 'int', 'min:0'],
'product_output_unit' => ['required', 'string'],
'product_value' => ['required', 'int', 'min:0'], 'product_value' => ['required', 'int', 'min:0'],
'product_value_unit' => ['required', 'string'],
]; ];
} }
@ -29,8 +32,11 @@ class RiceShrimpIndustryStoreRequest extends FormRequest
'year' => '年份', 'year' => '年份',
'quarter' => '季度', 'quarter' => '季度',
'area' => '面积', 'area' => '面积',
'area_unit' => '面积单位',
'product_output' => '产量', 'product_output' => '产量',
'product_output_unit' => '产量单位',
'product_value' => '产值', 'product_value' => '产值',
'product_value_unit' => '产值单位',
]; ];
} }
} }

View File

@ -18,8 +18,11 @@ class RiceShrimpIndustryUpdateRequest extends FormRequest
'year' => ['filled', 'int'], 'year' => ['filled', 'int'],
'quarter' => ['filled', new Quarter()], 'quarter' => ['filled', new Quarter()],
'area' => ['filled', 'int', 'min:0'], 'area' => ['filled', 'int', 'min:0'],
'area_unit' => ['filled', 'string'],
'product_output' => ['filled', 'int', 'min:0'], 'product_output' => ['filled', 'int', 'min:0'],
'product_output_unit' => ['filled', 'string'],
'product_value' => ['filled', 'int', 'min:0'], 'product_value' => ['filled', 'int', 'min:0'],
'product_value_unit' => ['filled', 'string'],
]; ];
} }
@ -29,8 +32,11 @@ class RiceShrimpIndustryUpdateRequest extends FormRequest
'year' => '年份', 'year' => '年份',
'quarter' => '季度', 'quarter' => '季度',
'area' => '面积', 'area' => '面积',
'area_unit' => '面积单位',
'product_output' => '产量', 'product_output' => '产量',
'product_output_unit' => '产量单位',
'product_value' => '产值', 'product_value' => '产值',
'product_value_unit' => '产值单位',
]; ];
} }
} }

View File

@ -19,8 +19,11 @@ class RiceShrimpIndustryResource extends JsonResource
'year' => $this->year, 'year' => $this->year,
'quarter' => $this->quarter, 'quarter' => $this->quarter,
'area' => $this->area, 'area' => $this->area,
'area_unit' => $this->area_unit,
'product_output' => $this->product_output, 'product_output' => $this->product_output,
'product_output_unit' => $this->product_output_unit,
'product_value' => $this->product_value, 'product_value' => $this->product_value,
'product_value_unit' => $this->product_value_unit,
'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')), 'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')),
'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')), 'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')),
'created_at' => $this->created_at->unix(), 'created_at' => $this->created_at->unix(),

View File

@ -14,8 +14,11 @@ class RiceShrimpIndustry extends Model
'year', 'year',
'quarter', 'quarter',
'area', 'area',
'area_unit',
'product_output', 'product_output',
'product_output_unit',
'product_value', 'product_value',
'product_value_unit',
'created_by', 'created_by',
'updated_by', 'updated_by',
]; ];

View File

@ -18,8 +18,11 @@ return new class extends Migration
$table->integer('year')->comment('年'); $table->integer('year')->comment('年');
$table->tinyInteger('quarter')->comment('季度'); $table->tinyInteger('quarter')->comment('季度');
$table->unsignedBigInteger('area')->comment('面积'); $table->unsignedBigInteger('area')->comment('面积');
$table->string('area_unit')->comment('面积单位');
$table->unsignedBigInteger('product_output')->comment('产量'); $table->unsignedBigInteger('product_output')->comment('产量');
$table->string('product_output_unit')->comment('产量单位');
$table->unsignedBigInteger('product_value')->comment('产值'); $table->unsignedBigInteger('product_value')->comment('产值');
$table->string('product_value_unit')->comment('产值单位');
$table->unsignedBigInteger('created_by')->comment('创建人ID'); $table->unsignedBigInteger('created_by')->comment('创建人ID');
$table->unsignedBigInteger('updated_by')->comment('修改人ID'); $table->unsignedBigInteger('updated_by')->comment('修改人ID');
$table->timestamps(); $table->timestamps();