存储过程@field := @field

本文探讨了一段MySQL代码中使用LPAD函数与变量赋值(@:=)的方法,展示了如何通过存储过程为查询结果自动添加前导零,并讨论了变量在每次查询时递增的应用场景。
SET @con_code=0;
SELECT (LPAD((@con_code := @con_code+1),4,'0')) id from user;

 

存储过程不会。今天看到一个代码不懂 := 是啥玩意。

 

测试得知 大概是每查出一条几率就将变量@con_code的值+1赋给当前记录

 

id

0001

0002

0003

0004

0005

0006

 

标记一下 待查详细解释

/* * Copyright (c) 2025, TP-Link Global Inc. All rights reserved. */ package com.tplink.cdd.demo.mongo.po; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.index.CompoundIndex; import org.springframework.data.mongodb.core.index.CompoundIndexes; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.core.mapping.Sharded; /** * @author zhaobingqian * @version 1.0 * @since 2025/3/11 */ @Data @Document("smart_data_frame") @CompoundIndexes({ @CompoundIndex(name = "index_user_dev_channel_time", def = "{'user_id':1, 'dev_id':1, 'channel':1, 'time': 1}"), }) @Sharded(shardKey = "user_id") public class SmartDataFramePO { @Id private String id; @Field(name = "user_id") private String userId; @Field(name = "dev_id") private String devId; @Field(name = "channel") private Short channel; @Field(name = "timestamp") private Long timestamp; @Field(name = "object_id") private Integer objectId; @Field(name = "type") private Integer type; @Field(name = "shape") private Byte shape; @Field(name = "box_tlx") private Integer boxTlX; @Field(name = "box_tly") private Integer boxTlY; @Field(name = "box_w") private Integer boxW; @Field(name = "box_h") private Integer boxH; @Field(name = "confidence") private Byte confidence; @Field(name = "fg_ratio") private Byte fgRatio; @Field(name = "is_fake") private Byte isFake; @Field(name = "is_normal") private Byte isNormal; @Field(name = "point_3dvalid") private Byte point3dValid; @Field(name = "point_3dx") private Short point3dX; @Field(name = "point_3dy") private Short point3dY; @Field(name = "point_3dz") private Short point3dZ; } 根据这个写个指令
03-22
帮我写一个修改方法,通过id修改,然后会修改三个值,deviceStatus一定会修改,lastRunTime不为null时修改,lastStopTime不为null时修改。使用mybatis-plus,写SQL时使用兰姆达表达式:package com.ceprei.rcm.entity; import com.baomidou.mybatisplus.annotation.*; import com.ceprei.rcm.model.bizassetstructuretree.AssetType; import lombok.Data; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import com.alibaba.fastjson.annotation.JSONField; /** 存储设备基础信息 @版本: V5.2.0 @版权: Copyright @ 2025 引迈信息技术有限公司版权所有 @作者: 引迈信息技术有限公司 @日期: 2025-07-01 */ @Data @TableName(“biz_base_device”) public class BizBaseDeviceEntity implements Asset{ @TableId(value =“id” ,type = IdType.AUTO ) @JSONField(name = “id”) private Integer id; @TableField(value = “device_name” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “deviceName”) private String deviceName; @TableField(value = “kks” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “kks”) private String kks; @TableField(value = “device_type” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “deviceType”) private String deviceType; @TableField(value = “device_level” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “deviceLevel”) private String deviceLevel; @TableField(value = “device_major” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “deviceMajor”) private String deviceMajor; @TableField(value = “device_status” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “deviceStatus”) private Integer deviceStatus; @TableField(value = “manufacturer” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “manufacturer”) private String manufacturer; @TableField(value = “specifications” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “specifications”) private String specifications; @TableField(value = “made_time” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “madeTime”) private String madeTime; @TableField(value = “install_time” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “installTime”) private String installTime; @TableField(value = “last_run_time” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “lastRunTime”) private String lastRunTime; @TableField(value = “last_stop_time” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “lastStopTime”) private String lastStopTime; @TableField(value = “last_maintenance_time” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “lastMaintenanceTime”) private String lastMaintenanceTime; @TableField(value = “mtbf” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “mtbf”) private Double mtbf; @TableField(value = “func_description” , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = “funcDescription”) private String funcDescription; @TableField(“sys_id”) @JSONField(name = “sysId”) private Integer sysId; @TableField(“purchase_time”) @JSONField(name = “purchaseTime”) private String purchaseTime; @TableField(“asset_number”) @JSONField(name = “assetNumber”) private String assetNumber; @TableField(“purchase_channels”) @JSONField(name = “purchaseChannels”) private String purchaseChannels; @TableField(fill = FieldFill.INSERT, value = “created_at”) @JSONField(name = “createdAt”) private Date createdAt; @TableField(fill = FieldFill.INSERT_UPDATE, value = “updated_at”) @JSONField(name = “updatedAt”) private Date updatedAt; @TableField(“deleted_at”) @JSONField(name = “deletedAt”) private Date deletedAt; @TableField(value = “f_tenant_id”,fill = FieldFill.INSERT_UPDATE) @JSONField(name = “tenantId”) private String tenantId; @TableField(“f_flow_id”) @JSONField(name = “flowId”) private String flowId; @TableField(“f_flow_task_id”) @JSONField(name = “flowTaskId”) private String flowTaskId; @TableField(“EVALUATION_SCORE”) @JSONField(name = “evaluationScore”) private Integer evaluationScore; @TableField(“RISK_LEVEL”) @JSONField(name = “riskLevel”) private Integer riskLevel; // 联表参数 @TableField(exist = false) @JSONField(name = “sysName”) private String sysName; @TableField(exist = false) @JSONField(name = “unitName”) private String unitName; @TableField(exist = false) @JSONField(name = “unitId”) private Integer unitId; @TableField(exist = false) @JSONField(name = “deviceTypeName”) private String deviceTypeName; @TableField(exist = false) @JSONField(name = “deviceMajorName”) private String deviceMajorName; @TableField(exist = false) @JSONField(name = “deviceLevelName”) private String deviceLevelName; @TableField(exist = false) @JSONField(name = “deviceStatusName”) private String deviceStatusName; @TableField(exist = false) @JSONField(name = “Param1”) private String Param1; @TableField(exist = false) @JSONField(name = “Param2”) private String Param2; @TableField(exist = false) @JSONField(name = “Param3”) private String Param3; @TableField(exist = false) @JSONField(name = “Param4”) private String Param4; @TableField(exist = false) @JSONField(name = “Param5”) private String Param5; @TableField(exist = false) @JSONField(name = “strategyId”) private String strategyId; @TableField(exist = false) @JSONField(name = “strategyName”) private String strategyName; @TableField(exist = false) @JSONField(name = “runTime”) private String runTime; @TableField(exist = false) @JSONField(name = “sid”) private String sid; @TableField(exist = false) @JSONField(name = “sidName”) private String sidName; @TableField(exist = false) @JSONField(name = “fmeaId”) private String fmeaId; // 可视化大屏需要的设备专业的数量或者机组下设备的数量 @TableField(exist = false) @JSONField(name = “visNum”) private Long visNum; // 可视化大屏需要的rcm名称 @TableField(exist = false) @JSONField(name = “rcmName”) private String rcmName; // 可视化大屏需要的rcm名称 @TableField(exist = false) @JSONField(name = “deviceR”) private Integer deviceR; @Override public Integer getParentId() { return this.getSysId(); } @Override public AssetType getType() { return AssetType.DEVICE; } /** @return / @Override public String getTableName() { return getKks(); } /* @return */ @Override public String getAssetName() { return getDeviceName(); } /** 将 yyyy-MM-dd 格式字符串转时间戳 @param dateStr 输入日期字符串(格式必须为 yyyy-MM-dd) @return 时间戳字符串(毫秒),输入无效时返回null */ public String convertToTimestamp(String dateStr) { if (dateStr == null || dateStr.trim().isEmpty()) { return null; } SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”); sdf.setLenient(false); // 禁止自动纠错 try { Date date = sdf.parse(dateStr); return String.valueOf(date.getTime()); } catch (Exception e) { return null; // 捕获所有格式错误 } } }
最新发布
11-07
现在我想统一给double类型的变量设置小数点。是不是只需要在实体类的get方法上保证小数点后三位就行。不用管其他地方的运算:@Data @TableName("BIZ_UNIT_PERFORMANCE_DATA") public class BizUnitPerformanceDataEntity { @TableId(value ="ID" ) @JSONField(name = "id") private String id; @TableField(value = "UNIT_NAME" ) @JSONField(name = "unitName") private String unitName; @TableField(value = "INDICATOR_NAME" ) @JSONField(name = "indicatorName") private String indicatorName; @TableField(value = "YEAR_VALUE" ) @JSONField(name = "yearValue") private Integer yearValue; @TableField(value = "MONTH_VALUE" ) @JSONField(name = "monthValue") private Integer monthValue; @TableField(value = "DATA_TYPE") @JSONField(name = "dataType") private Integer dataType; @TableField(value = "EQ_AVAIL_MONTH" ) @JSONField(name = "eqAvailMonth") private Double eqAvailMonth; @TableField(value = "EQ_AVAIL_CUM" ) @JSONField(name = "eqAvailCum") private Double eqAvailCum; @TableField(value = "CAL_HRS_MONTH" ) @JSONField(name = "calHrsMonth") private Double calHrsMonth; @TableField(value = "CAL_HRS_CUM" ) @JSONField(name = "calHrsCum") private Double calHrsCum; @TableField(value = "OP_HRS_MONTH" ) @JSONField(name = "opHrsMonth") private Double opHrsMonth; @TableField(value = "OP_HRS_CUM" ) @JSONField(name = "opHrsCum") private Double opHrsCum; @TableField(value = "SB_HRS_MONTH" ) @JSONField(name = "sbHrsMonth") private Double sbHrsMonth; @TableField(value = "SB_HRS_CUM" ) @JSONField(name = "sbHrsCum") private Double sbHrsCum; @TableField(value = "MT_HRS_MONTH" ) @JSONField(name = "mtHrsMonth") private Double mtHrsMonth; @TableField(value = "MT_HRS_CUM" ) @JSONField(name = "mtHrsCum") private Double mtHrsCum; @TableField(value = "FO_HRS_MONTH" ) @JSONField(name = "foHrsMonth") private Double foHrsMonth; @TableField(value = "FO_HRS_CUM" ) @JSONField(name = "foHrsCum") private Double foHrsCum; @TableField(value = "DER_HRS_MONTH" ) @JSONField(name = "derHrsMonth") private Double derHrsMonth; @TableField(value = "DER_HRS_CUM" ) @JSONField(name = "derHrsCum") private Double derHrsCum; @TableField(fill = FieldFill.INSERT, value = "CREATED_AT") @JSONField(name = "createdAt") private Date createdAt; @TableField(fill = FieldFill.INSERT_UPDATE, value = "UPDATED_AT") @JSONField(name = "updatedAt") private Date updatedAt; @TableField("DELETED_AT") @JSONField(name = "deletedAt") private Date deletedAt; @TableField(value = "F_TENANT_ID",fill = FieldFill.INSERT_UPDATE) @JSONField(name = "tenantId") private String tenantId; @TableField("F_FLOW_ID") @JSONField(name = "flowId") private String flowId; @TableField("F_FLOW_TASK_ID") @JSONField(name = "flowTaskId") private String flowTaskId; }
09-17
List<Integer> list = new ArrayList<>();这里面放着设备id集合: @Data @TableName("biz_base_device") public class BizBaseDeviceEntity implements Asset{ @TableId(value ="id" ,type = IdType.AUTO ) @JSONField(name = "id") private Integer id; @TableField(value = "device_name" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceName") private String deviceName; @TableField(value = "kks" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "kks") private String kks; @TableField(value = "device_type" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceType") private String deviceType; @TableField(value = "device_level" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceLevel") private String deviceLevel; @TableField(value = "device_major" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceMajor") private String deviceMajor; @TableField(value = "device_status" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceStatus") private Integer deviceStatus; @TableField(value = "manufacturer" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "manufacturer") private String manufacturer; @TableField(value = "specifications" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "specifications") private String specifications; @TableField(value = "made_time" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "madeTime") private String madeTime; @TableField(value = "install_time" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "installTime") private String installTime; @TableField(value = "last_run_time" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "lastRunTime") private String lastRunTime; @TableField(value = "last_stop_time" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "lastStopTime") private String lastStopTime; @TableField(value = "last_maintenance_time" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "lastMaintenanceTime") private String lastMaintenanceTime; @TableField(value = "mtbf" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "mtbf") private Double mtbf; @TableField(value = "func_description" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "funcDescription") private String funcDescription; @TableField("sys_id") @JSONField(name = "sysId") private Integer sysId; @TableField("purchase_time") @JSONField(name = "purchaseTime") private String purchaseTime; @TableField("asset_number") @JSONField(name = "assetNumber") private String assetNumber; @TableField("purchase_channels") @JSONField(name = "purchaseChannels") private String purchaseChannels; @TableField(fill = FieldFill.INSERT, value = "created_at") @JSONField(name = "createdAt") private Date createdAt; @TableField(fill = FieldFill.INSERT_UPDATE, value = "updated_at") @JSONField(name = "updatedAt") private Date updatedAt; @TableField("deleted_at") @JSONField(name = "deletedAt") private Date deletedAt; @TableField(value = "f_tenant_id",fill = FieldFill.INSERT_UPDATE) @JSONField(name = "tenantId") private String tenantId; @TableField("f_flow_id") @JSONField(name = "flowId") private String flowId; @TableField("f_flow_task_id") @JSONField(name = "flowTaskId") private String flowTaskId; @TableField("EVALUATION_SCORE") @JSONField(name = "evaluationScore") private String evaluationScore; @TableField("RISK_LEVEL") @JSONField(name = "riskLevel") private String riskLevel; // 联表参数 @TableField(exist = false) @JSONField(name = "sysName") private String sysName; @TableField(exist = false) @JSONField(name = "unitName") private String unitName; @TableField(exist = false) @JSONField(name = "deviceTypeName") private String deviceTypeName; @TableField(exist = false) @JSONField(name = "deviceMajorName") private String deviceMajorName; @TableField(exist = false) @JSONField(name = "deviceLevelName") private String deviceLevelName; @TableField(exist = false) @JSONField(name = "deviceStatusName") private String deviceStatusName; @TableField(exist = false) @JSONField(name = "Param1") private String Param1; @TableField(exist = false) @JSONField(name = "Param2") private String Param2; @TableField(exist = false) @JSONField(name = "Param3") private String Param3; @TableField(exist = false) @JSONField(name = "Param4") private String Param4; @TableField(exist = false) @JSONField(name = "Param5") private String Param5; @Override public Integer getParentId() { return this.getSysId(); } @Override public AssetType getType() { return AssetType.DEVICE; } /** * @return */ @Override public String getTableName() { return getKks(); } /** * 将 yyyy-MM-dd 格式字符串转时间戳 * @param dateStr 输入日期字符串(格式必须为 yyyy-MM-dd) * @return 时间戳字符串(毫秒),输入无效时返回null */ public String convertToTimestamp(String dateStr) { if (dateStr == null || dateStr.trim().isEmpty()) { return null; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); sdf.setLenient(false); // 禁止自动纠错 try { Date date = sdf.parse(dateStr); return String.valueOf(date.getTime()); } catch (Exception e) { return null; // 捕获所有格式错误 } } } 。下面是设备与检修策略映射表: @Data @TableName("BIZ_DEVICE_STRATEGY") public class BizDeviceStrategyEntity { @TableId(value ="ID" ) @JSONField(name = "id") private String id; @TableField(value = "DEVICE_ID" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "deviceId") private Integer deviceId; @TableField(value = "STRATEGY_ID" , updateStrategy = FieldStrategy.IGNORED) @JSONField(name = "strategyId") private String strategyId; @TableField(value = "F_TENANT_ID",fill = FieldFill.INSERT_UPDATE) @JSONField(name = "tenantId") private String tenantId; @TableField("F_FLOW_ID") @JSONField(name = "flowId") private String flowId; @TableField("F_FLOW_TASK_ID") @JSONField(name = "flowTaskId") private String flowTaskId; } 下面是检修策略表: @Data @TableName("BIZ_REPAIR_STRATEGY") public class BizRepairStrategyEntity { @TableId(value ="ID" ) @JSONField(name = "id") private String id; @TableField(value = "SID" ) @JSONField(name = "sid") private Integer sid; @TableField(value = "FAULT_MODE_ID" ) @JSONField(name = "faultModeId") private Integer faultModeId; @TableField(value = "FAULT_REASON_ID" ) @JSONField(name = "faultReasonId") private Integer faultReasonId; @TableField(value = "STRATEGY" ) @JSONField(name = "strategy") private String strategy; @TableField(value = "OVERHAUL_CONTENT" ) @JSONField(name = "overhaulContent") private String overhaulContent; @TableField(value = "OVERHAUL_CYCLE" ) @JSONField(name = "overhaulCycle") private String overhaulCycle; @TableField(value = "OVERHAUL_CYCLE_UNIT" ) @JSONField(name = "overhaulCycleUnit") private Integer overhaulCycleUnit; @TableField(value = "REQUIREMENT" ) @JSONField(name = "requirement") private String requirement; @TableField(fill = FieldFill.INSERT,value = "CREATED_AT" ) @JSONField(name = "createdAt") private Date createdAt; @TableField(fill = FieldFill.INSERT_UPDATE, value="UPDATED_AT") @JSONField(name = "updatedAt") private Date updatedAt; @TableField("DELETED_AT") @JSONField(name = "deletedAt") private Date deletedAt; @TableField(value = "F_TENANT_ID",fill = FieldFill.INSERT_UPDATE) @JSONField(name = "tenantId") private String tenantId; @TableField("F_FLOW_ID") @JSONField(name = "flowId") private String flowId; @TableField("F_FLOW_TASK_ID") @JSONField(name = "flowTaskId") private String flowTaskId; // 联表参数 // 故障模式名称 @TableField(exist = false) @JSONField(name = "faultModeName") private String faultModeName; // 故障模式原因 @TableField(exist = false) @JSONField(name = "faultReasonName") private String faultReasonName; // 节点名称sid @TableField(exist = false) @JSONField(name = "sidName") private String sidName; // 检修策略名称 @TableField(exist = false) @JSONField(name = "strategyName") private String strategyName; } 现在是这样,我有一个设备id列表,我需要查询设备全部数据外,还需要通过映射表来查询检修策略表的数据,可以先只查一个strategy
09-30
我需要你写一个方法,你有足够时间来思考与编写。首先,我有一个这样的表存储在数据库: /** * 机组运行性能数据宽表 * * @版本: V5.2.0 * @版权: Copyright @ 2025 工业和信息化部电子第五研究所 * @作者: 工业和信息化部电子第五研究所 * @日期: 2025-09-12 */ @Data @TableName("BIZ_UNIT_PERFORMANCE_DATA") public class BizUnitPerformanceDataEntity { @TableId(value ="ID" ) @JSONField(name = "id") private String id; @TableField(value = "UNIT_NAME" ) @JSONField(name = "unitName") private String unitName; @TableField(value = "INDICATOR_NAME" ) @JSONField(name = "indicatorName") private String indicatorName; @TableField(value = "YEAR_VALUE" ) @JSONField(name = "yearValue") private Integer yearValue; @TableField(value = "MONTH_VALUE" ) @JSONField(name = "monthValue") private Integer monthValue; @TableField(value = "DATA_TYPE") @JSONField(name = "dataType") private Integer dataType; @TableField(value = "EQ_AVAIL_MONTH" ) @JSONField(name = "eqAvailMonth") private Double eqAvailMonth; @TableField(value = "EQ_AVAIL_CUM" ) @JSONField(name = "eqAvailCum") private Double eqAvailCum; @TableField(value = "CAL_HRS_MONTH" ) @JSONField(name = "calHrsMonth") private Double calHrsMonth; @TableField(value = "CAL_HRS_CUM" ) @JSONField(name = "calHrsCum") private Double calHrsCum; @TableField(value = "OP_HRS_MONTH" ) @JSONField(name = "opHrsMonth") private Double opHrsMonth; @TableField(value = "OP_HRS_CUM" ) @JSONField(name = "opHrsCum") private Double opHrsCum; @TableField(value = "SB_HRS_MONTH" ) @JSONField(name = "sbHrsMonth") private Double sbHrsMonth; @TableField(value = "SB_HRS_CUM" ) @JSONField(name = "sbHrsCum") private Double sbHrsCum; @TableField(value = "MT_HRS_MONTH" ) @JSONField(name = "mtHrsMonth") private Double mtHrsMonth; @TableField(value = "MT_HRS_CUM" ) @JSONField(name = "mtHrsCum") private Double mtHrsCum; @TableField(value = "FO_HRS_MONTH" ) @JSONField(name = "foHrsMonth") private Double foHrsMonth; @TableField(value = "FO_HRS_CUM" ) @JSONField(name = "foHrsCum") private Double foHrsCum; @TableField(value = "DER_HRS_MONTH" ) @JSONField(name = "derHrsMonth") private Double derHrsMonth; @TableField(value = "DER_HRS_CUM" ) @JSONField(name = "derHrsCum") private Double derHrsCum; @TableField(fill = FieldFill.INSERT, value = "CREATED_AT") @JSONField(name = "createdAt") private Date createdAt; @TableField(fill = FieldFill.INSERT_UPDATE, value = "UPDATED_AT") @JSONField(name = "updatedAt") private Date updatedAt; @TableField("DELETED_AT") @JSONField(name = "deletedAt") private Date deletedAt; @TableField(value = "F_TENANT_ID",fill = FieldFill.INSERT_UPDATE) @JSONField(name = "tenantId") private String tenantId; @TableField("F_FLOW_ID") @JSONField(name = "flowId") private String flowId; @TableField("F_FLOW_TASK_ID") @JSONField(name = "flowTaskId") private String flowTaskId; } 。这个表一条数据表示一个月的相关值。但是,我展示给前端的不是这样子的,前端结构会是这样: /* * { "unitName": "1号机组", "yearValue": 2025, "dataType": 0, "indicatorName":"系数" "eqAvail": { "title": "系数", "allCount": 100, "monthValue": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "cumValue": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "childList": [ { "title": "日历", "allCount": 1, "monthValue": [], "cumValue": [] }, { "title": "运行", "allCount": 1, "monthValue": [], "cumValue": [] } .... ] } } { 机组名称:1号机组, 年份:2025, 系数标题:系数 表类型:0(0预估1实际), 系数:{ 标题:系数 总数:100, 月度:[1,2,3,4,5,6,7,8,9,10,11,12], 累计:[1,2,3,4,5,6,7,8,9,10,11,12], childrend:[ {标题:日历, 总数:1, 月度:[], 累计:[]}, {标题:运行, 总数:1, 月度:[], 累计:[]}, {标题:停备, 总数:1, 月度:[], 累计:[]}, {标题:检修, 总数:1, 月度:[], 累计:[]}, {标题:非停, 总数:1, 月度:[], 累计:[]}, {标题:降出力, 总数:1, 月度:[], 累计:[]}, ] } } * * */ @Data public class BizUnitPerformanceDataVO { @Schema(description = "机组名称") @JsonProperty("unitName") @JSONField(name = "unitName") private String unitName; @Schema(description = "系数标题(255字符限制,允许空值)") @JsonProperty("indicatorName") @JSONField(name = "indicatorName") private String indicatorName; @Schema(description = "年份") @JsonProperty("yearValue") @JSONField(name = "yearValue") private Integer yearValue; @Schema(description = "数据类型(0预估/1实际)") @JsonProperty("dataType") @JSONField(name = "dataType") private Integer dataType; @Schema(description = "等效可用系数") @JsonProperty("eqAvail") @JSONField(name = "eqAvail") private IndicatorInfo eqAvail; } @Data public class IndicatorInfo { @Schema(description = "ID合集") @JsonProperty("id") @JSONField(name = "id") private List<String> id; @Schema(description = "标题") @JsonProperty("title") @JSONField(name = "title") private String title; @Schema(description = "总数") @JsonProperty("allCount") @JSONField(name = "allCount") private Double allCount; @Schema(description = "月份值") @JsonProperty("monthValue") @JSONField(name = "monthValue") private List<Double> monthValue; @Schema(description = "累计值") @JsonProperty("cumValue") @JSONField(name = "cumValue") private List<Double> cumValue; @Schema(description = "子项列表(日历、运行、停备等)") @JsonProperty("childList") @JSONField(name = "childList") private List<IndicatorInfo> childList; } 现在就是,你帮我写一个转换方法,将所有数据一一对应。编写之前先告诉我你的转换逻辑,编写完成后举出一个示例,并给出结果。我好判断是否一致。
09-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值