NutzCN Logo
问答 两个表多个对段的对应关系问题
发布于 2450天前 作者 wx_2qdej6bq3uup10lk4o79 1222 次浏览 复制 上一个帖子 下一个帖子
标签:

@Table("wine_qcys_dict")
public class Dict extends BasePojo {

@Id
@Comment("主键")
protected long id;

@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("类别名称")
protected String leibiemingcheng;

@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("类别代码")
protected String leibiedaima;

@Name
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("编码")
protected String bianma;

@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("名称")
protected String mingcheng;

@Column
@ColDefine(type = ColType.VARCHAR, width = 255)
@Comment("描述")
protected String miaoshu;

@Table("wine_qcys_gzlyunfei")
public class GZLYunfei extends BasePojo {
@Id
@Comment("主键")
protected long id;

    @Name
    @Comment("部门编码")
    protected String danweicode;

    @Column
    @Comment("预留  最小归属为日  所属批次  8位格式  20170501")
    protected String monthstr;

    @Column
    @Comment("所属月度")
    protected int month;

    @Column
    @Comment("所属年度")
    protected int niandu;

    @Column
    @Comment("报审序号")
    protected String baoshenxuhao;

    @Column
    @Comment("合同单位(车辆所属单位)")
    protected String hetongdanwei;



    @Column
    @Comment("车辆类型 来源于 字典表)")
    protected String cheliangleixing;

    @One(target=Dict.class,field="cheliangleixing")
    public Dict dict;


    public Dict getDict() {
       return dict;
    }

    public void setDict(Dict dict) {
       this.dict = dict;
    }

    @Column
    @Comment("车号")
    protected String chehao;

    @Column
    @Comment("车型 来源于 字典表)")
    protected String chexing;



    @Column
    @Comment("费用区间开始时间")
    protected Date feiyongstartdate;

    @Column
    @Comment("费用区间结束时间")
    protected Date feiyongenddate;

    @Column
    @Comment("单价类型 来源于 字典表)")
    protected String danjialeixing;

    @Column
    @Comment("单价")
    @ColDefine(type=ColType.FLOAT, width=38, precision=10, notNull=true)
    protected double danjia;

    @Column
    @Comment("数量")
    @ColDefine(type=ColType.FLOAT, width=38, precision=10, notNull=true)
    protected double shuliang;

    @Column
    @Comment("   吨位类型(拉油、配属) 来源于字典表")
    protected String dunweileixing;

上面的代码里面的wine_qcys_gzlyunfei表里面的几个这段对应wine_qcys_dict里面的几个字段,这种对应关系怎么取关联关系,是不是wine_qcys_gzlyunfei表里每个关联的字段都需要用 @One声明一个新类?高手解答一下!

3 回复

仅关联需要用到的

有对应关系的都需要用,每个都要关联?这种能用多对多关联不?

在于你的数据是一对一还是多对多,不过对应关系都是单个字段

添加回复
请先登陆
回到顶部