ResultSet生成Record字段次序问题

List<Record> boiler = Db.find("SELECT " +

    "A.dev_name AS boilerName, " +

    "A.device_no AS boilerNo, " +

    "A.use_cert_no AS certificateNo, " +

    "A.reg_no AS registralCode, " +

    "C.manu_dev_type AS model, " +

    "D.design_pressure AS designPressure, " +

    "D.work_pressure AS opPressure, " +

    "D.rate_power AS nominalOutput, " +

    "D.medium_out_temp AS nominalTemperature, " +

    "D.work_medium_out_temp AS ouletTemperature, " +

    "B.run_date AS serviceDate, " +

    "E.verify_com AS inspectionUnit, " +

    "E.verify_result AS innerInspectingConclusion, " +

    "E.report_no AS innerInspectingNo, " +

    "E.verify_date_end AS InnerInspectingDate, " +

    "E.verify_date_next AS nextInnerInspectingDate, " +

    "F.com_name AS manufactory, " +

    "D.strc_modal AS structuralForm, " +

    "D.burn_type AS combustionMode, " +

    "D.water_type AS waterTreatment, " +

    "D.oxygen_type AS deoxygenation, " +

    "D.cinder_type AS slagDischarging, " +

    "G.code_name AS useState " +

…………………………

String ls = JFinalJson.getJson().toJson(boiler); renderJson("boilerList",ls);

返回的json的次序不是我sql中缩写的次序,这是什么原因?

我将boiler打印出来,发现生成record时次序就不一样了。有办法和我sql中的字段次序一致吗?

{ouletTemperature: , InnerInspectingDate: , boilerName:, registralCode:13203201002008120001, serviceDate:          , innerInspectingNo:GNY-P-201012-0036, designPressure:0.18, boilerNo: , certificateNo:锅苏BC0127, combustionMode: , deoxygenation: , nominalTemperature:1, nextInnerInspectingDate:2012-12-20, structuralForm: , waterTreatment: , slagDischarging: , opPressure: , model:YY(Q)W-180(15)Y(Q), innerInspectingConclusion:允许运行, useState:拆除, nominalOutput:320, inspectionUnit: , manufactory: }

评论区

JFinal

2017-03-07 22:42

在 configPlugin 中对 ActiveRecordPlugin 进行一下配置即可打完收枪:
arp.setContainerFactory(new OrderedFieldContainerFactory());

younkee

2017-03-10 10:13

@JFinal 搞定收工,非常感谢!

JFinal

2017-03-10 10:56

@younkee 多多支持 jfinal ^_^

热门反馈

扫码入社