diff --git a/yudao-module-farm/src/main/resources/sql/add_traceability_json_fields.sql b/yudao-module-farm/src/main/resources/sql/add_traceability_json_fields.sql deleted file mode 100644 index 7f4cd3d1..00000000 --- a/yudao-module-farm/src/main/resources/sql/add_traceability_json_fields.sql +++ /dev/null @@ -1,41 +0,0 @@ --- 为 farm_traceability_code 表添加 JSON 字段 --- 用于存储复杂的农事记录和自定义数据 - --- MySQL 版本 -ALTER TABLE farm_traceability_code -ADD COLUMN farming_input_json TEXT COMMENT '农事记录JSON数据(存储复杂的农事记录结构)', -ADD COLUMN custom_data_json TEXT COMMENT '自定义数据JSON(存储自定义字段数据)', -ADD COLUMN measuring_unit INT COMMENT '计量单位', -ADD COLUMN packing_unit INT COMMENT '包装单位', -ADD COLUMN is_show_base BIGINT COMMENT '是否显示基地'; - --- PostgreSQL 版本 --- ALTER TABLE farm_traceability_code --- ADD COLUMN farming_input_json TEXT, --- ADD COLUMN custom_data_json TEXT, --- ADD COLUMN measuring_unit INTEGER, --- ADD COLUMN packing_unit INTEGER, --- ADD COLUMN is_show_base BIGINT; - --- Oracle 版本 --- ALTER TABLE farm_traceability_code --- ADD (farming_input_json CLOB, --- custom_data_json CLOB, --- measuring_unit NUMBER(10), --- packing_unit NUMBER(10), --- is_show_base NUMBER(19)); - --- SQL Server 版本 --- ALTER TABLE farm_traceability_code --- ADD farming_input_json NVARCHAR(MAX), --- custom_data_json NVARCHAR(MAX), --- measuring_unit INT, --- packing_unit INT, --- is_show_base BIGINT; - --- 添加索引以提高查询性能 -CREATE INDEX idx_farm_traceability_code_farming_input_json ON farm_traceability_code(farming_input_json(100)); -CREATE INDEX idx_farm_traceability_code_custom_data_json ON farm_traceability_code(custom_data_json(100)); -CREATE INDEX idx_farm_traceability_code_measuring_unit ON farm_traceability_code(measuring_unit); -CREATE INDEX idx_farm_traceability_code_packing_unit ON farm_traceability_code(packing_unit); -CREATE INDEX idx_farm_traceability_code_is_show_base ON farm_traceability_code(is_show_base); diff --git a/yudao-module-farm/src/main/resources/traceability-code-new-structure.http b/yudao-module-farm/src/main/resources/traceability-code-new-structure.http deleted file mode 100644 index 3d0741ed..00000000 --- a/yudao-module-farm/src/main/resources/traceability-code-new-structure.http +++ /dev/null @@ -1,225 +0,0 @@ -### 创建溯源-溯源码(支持新的复杂JSON结构) -POST http://localhost:8080/admin-api/farm/traceability-code/create -Content-Type: application/json -Authorization: Bearer {{token}} - -{ - "speciesCode": "", - "speciesName": "绿水稻", - "businessId": "027fef60-72c7-4b16-aad7-74bd4e7c492d", - "businessName": "测试", - "businessPhone": "19995432633", - "storeName": "123", - "businessAddress": "123", - "publicityProfile": "123", - "publicityImageList": [ - "http://223.83.152.93:9000/farm/20250826/b569169d762c4c74bcb5b007be492060_1756207500866.png", - "http://223.83.152.93:9000/farm/20250826/b569169d762c4c74bcb5b007be492060_1756207885105.png" - ], - "isShowBusinessName": true, - "isShowBusinessPhone": true, - "isShowStoreName": true, - "isShowBusinessAddress": true, - "isShowPublicityProfile": true, - "isShowPublicityImage": true, - "productId": "64fcede4-247b-437d-93be-b7c9d636e6ce", - "productName": "红薯干", - "baseId": "", - "baseName": "测试基地1", - "isShowBase": true, - "harvestDate": "2025-09-01 00:00:00", - "farmingInputCount": 1, - "farmingInputList": [ - { - "farmingName": "123", - "date": ["2025-08-31", "2025-09-01"], - "inputList": [ - { - "inputsId": "97e9f792-3b84-4132-9350-b08f34641c65", - "assetType": 2, - "dose": 100, - "unit": 6, - "packageUnit": 1, - "diluted": "1.5倍", - "usage": "123", - "inputsName": "药物", - "unitName": null, - "packageUnitName": null - } - ], - "imageList": [] - } - ], - "productImage": "", - "brandAuthentication": ["1", "2", "3", "4"], - "inspectionReport": "", - "inspectionReportList": [], - "collectImages": "", - "collectImagesList": [], - "measuringUnit": "2", - "packingUnit": "2", - "customData": [ - { - "linkName": "123", - "customSection": [ - { - "label": "123", - "type": 1, - "content": "123", - "imageList": [] - }, - { - "label": "456", - "type": 2, - "content": "456", - "imageList": [ - "http://example.com/image1.jpg", - "http://example.com/image2.jpg" - ] - } - ] - }, - { - "linkName": "789", - "customSection": [ - { - "label": "789", - "type": 1, - "content": "789", - "imageList": [] - } - ] - } - ], - "codeOutCount": 1, - "cameraInformation": null, - "packingSpec": "10", - "brandName": "红薯干", - "introduce": "好吃的红薯干哦" -} - -### 更新溯源-溯源码(支持新的复杂JSON结构) -PUT http://localhost:8080/admin-api/farm/traceability-code/update -Content-Type: application/json -Authorization: Bearer {{token}} - -{ - "id": "{{traceabilityCodeId}}", - "speciesCode": "", - "speciesName": "绿水稻", - "businessId": "027fef60-72c7-4b16-aad7-74bd4e7c492d", - "businessName": "测试企业", - "businessPhone": "19995432633", - "storeName": "测试网店", - "businessAddress": "测试地址", - "publicityProfile": "测试企业简介", - "publicityImageList": [ - "http://223.83.152.93:9000/farm/20250826/b569169d762c4c74bcb5b007be492060_1756207500866.png" - ], - "isShowBusinessName": true, - "isShowBusinessPhone": true, - "isShowStoreName": true, - "isShowBusinessAddress": true, - "isShowPublicityProfile": true, - "isShowPublicityImage": true, - "productId": "64fcede4-247b-437d-93be-b7c9d636e6ce", - "productName": "红薯干", - "baseId": "", - "baseName": "测试基地1", - "isShowBase": true, - "harvestDate": "2025-09-01 00:00:00", - "farmingInputCount": 2, - "farmingInputList": [ - { - "farmingName": "施肥", - "date": ["2025-08-31", "2025-09-01"], - "inputList": [ - { - "inputsId": "97e9f792-3b84-4132-9350-b08f34641c65", - "assetType": 2, - "dose": 100, - "unit": 6, - "packageUnit": 1, - "diluted": "1.5倍", - "usage": "叶面喷施", - "inputsName": "药物", - "unitName": "毫升", - "packageUnitName": "瓶" - } - ], - "imageList": [] - }, - { - "farmingName": "浇水", - "date": ["2025-09-02"], - "inputList": [], - "imageList": [] - } - ], - "productImage": "", - "brandAuthentication": ["有机认证", "绿色食品认证", "无公害认证"], - "inspectionReport": "", - "inspectionReportList": ["报告1.pdf", "报告2.pdf"], - "collectImages": "", - "collectImagesList": [], - "measuringUnit": "2", - "packingUnit": "2", - "customData": [ - { - "linkName": "产品特色", - "customSection": [ - { - "label": "产地特色", - "type": 1, - "content": "来自四川优质红薯产区", - "imageList": [] - }, - { - "label": "制作工艺", - "type": 2, - "content": "传统手工制作,无添加", - "imageList": [ - "http://example.com/process1.jpg", - "http://example.com/process2.jpg" - ] - } - ] - }, - { - "linkName": "营养价值", - "customSection": [ - { - "label": "营养成分", - "type": 1, - "content": "富含膳食纤维和维生素", - "imageList": [] - } - ] - } - ], - "codeOutCount": 1, - "cameraInformation": null, - "packingSpec": "10", - "brandName": "红薯干", - "introduce": "好吃的红薯干哦,营养丰富,口感香甜" -} - -### 获取溯源-溯源码详情 -GET http://localhost:8080/admin-api/farm/traceability-code/get?id={{traceabilityCodeId}} -Authorization: Bearer {{token}} - -### 获取溯源-溯源码分页 -GET http://localhost:8080/admin-api/farm/traceability-code/page?pageNo=1&pageSize=10 -Authorization: Bearer {{token}} - -### 扫描溯源码 -GET http://localhost:8080/admin-api/farm/traceability-code/scan?id={{traceabilityCodeId}} -Authorization: Bearer {{token}} - -### 删除溯源-溯源码 -DELETE http://localhost:8080/admin-api/farm/traceability-code/delete?id={{traceabilityCodeId}} -Authorization: Bearer {{token}} - -### 批量删除溯源-溯源码 -DELETE http://localhost:8080/admin-api/farm/traceability-code/delete-list?ids={{traceabilityCodeId1}},{{traceabilityCodeId2}} -Authorization: Bearer {{token}}