ExtJs 解决多对一映射问题

来源:互联网 发布:netty 聊天室架构源码 编辑:程序博客网 时间:2024/06/05 07:01
在后台HeartingStation与HeartingSource是多对一的关系
HeartingStation 类中的配置
@Column(name = "hsId")private Integer hsId; // 这个是必须配置的 以前做其他项目的时候我都不配值@ManyToOne@JoinColumn(name = "hsId",insertable = false, updatable = false)private HeatingSourceBean heatingSourceBean;//  int Checked 
在查询HeatingStation 的时候 已经将 HeatingSource 查出来了数据结构是这样的
[    {        "id": 1,        "name": "なになになに",        "hsId": 1,        "comment": "なになに",        "heatingSourceBean": {            "id": 1,            "name": "なになになに",            "comment": "なになに"        }    }]
ExtJs 中的filed配置
{    fieldLabel : "所属热源",    store: heatingSourceStore,    id:'com',    xtype: 'combo',    displayField:'name', //显示的字段    valueField:'id', //提交的值    name:'hsId',     editable : false,    allowBlank : false,    labelAlign : "right"},
原创粉丝点击