EOS Low-Code Platform 8 EOS Low-Code Platform 8
产品简介
安装部署
应用开发
专题场景实战案例
低代码(Low-Code)开发参考手册
高开开发参考手册
流程开发参考手册
AFCenter 使用指南
Governor 使用指南
FAQ
  • map类型的result

# Map类型的Result

Result Map也可以方便地为一个Map(如HashMap或TreeMap)对象赋值。Map对象与DataObject同样的方式映射,只是使用name属性值作为Map的键值,用它来索引相应的数据库字段值,而不是像DataObject一样给属性赋值。例如,如果用户要将Product对象的数据装入Map,可以参照下面的语句:

<resultMap id="get-product-result" class="java.util.HashMap">
  <result property="id" column="PRD_ID"/>
  <result property="code" column="PRD_CODE"/>
  <result property="description" column="PRD_DESCRIPTION"/>
  <result property="suggestedPrice" column="PRD_SUGGESTED_PRICE"/>
</resultMap>

上面的例子会创建一个HashMap的实例并用Product的数据赋值。Property的name属性值(即"id")作为HashMap的键值,而列值则作为HashMap中相应的值。