<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                需要兩張表:客戶表(主表),聯系人表(從表),一個客戶對應多個聯系人 ***** ### 1.`Customer `實體類 package net.youworker.onetomany.domain; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import javax.persistence.*; import java.util.HashSet; import java.util.Set; /** * @author: hcf * @qq: 46914685 * @email: 46914685@qq.com * @date: 2020-01-07 10:37 */ @Entity @DynamicUpdate(value = false) @DynamicInsert(value = false) @Table(name = "cst_customer") public class Customer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "cust_id", columnDefinition = "bigint(20) unsigned") private Long custId; // 客戶名稱 @Column(name = "cust_name", nullable = false, columnDefinition = "varchar(100) default '' comment '客戶名稱' ") private String custName = ""; // 客戶來源 @Column(name = "cust_source", nullable = false, columnDefinition = "varchar(100) default '' comment '客戶來源' ") private String custSource = ""; //客戶級別 @Column(name = "cust_level", nullable = false, columnDefinition = "varchar(100) default '' comment '客戶級別' ") private String custLevel = ""; //客戶所屬行業 @Column(name = "cust_industry", nullable = false, columnDefinition = "varchar(100) default '' comment '客戶所屬行業' ") private String custIndustry = ""; // 客戶的聯系方式 @Column(name = "cust_phone", nullable = false, columnDefinition = "varchar(12) default '' comment '客戶的聯系方式' ") private String custPhone = ""; // 客戶地址 @Column(name = "cust_address", nullable = false, columnDefinition = "varchar(100) default '' comment '客戶地址' ") private String custAddress = ""; /** * 配置客戶和聯系人之間的關系(一對多關系) * <p> * 使用注解的形式配置多表關系 * 1.聲明關系 * * @OneToMany:配置一對關系 targetEntity:對方對象的字節碼對象 * 2.配置外鍵(中間表) * @JoinColumn:配置外鍵 name:外鍵字段名稱 * referencedColumnName:參照的是主表的主鍵字段名稱 * <p> * 在客戶實體類上(一的一方)添加了外鍵配置,所以對客戶而言,也具備了維護外鍵的作用 */ // @OneToMany(targetEntity = LinkMan.class) // @JoinColumn(name = "lkm_cust_id",referencedColumnName = "cust_id") /** * 放棄外鍵維護權 * mappedBy:對方配置關系的屬性名稱 * cascade:級聯配置(可以配置到主從表的映射關系的注解上) * CascadeType.ALL 所有 * MERGE 更新 * PERSIST 保存 * REMOVE 刪除 */ @OneToMany(mappedBy = "customer", cascade = CascadeType.ALL) private Set<LinkMan> linkMans = new HashSet<>(); public Long getCustId() { return custId; } public void setCustId(Long custId) { this.custId = custId; } public String getCustName() { return custName; } public void setCustName(String custName) { this.custName = custName; } public String getCustSource() { return custSource; } public void setCustSource(String custSource) { this.custSource = custSource; } public String getCustLevel() { return custLevel; } public void setCustLevel(String custLevel) { this.custLevel = custLevel; } public String getCustIndustry() { return custIndustry; } public void setCustIndustry(String custIndustry) { this.custIndustry = custIndustry; } public String getCustPhone() { return custPhone; } public void setCustPhone(String custPhone) { this.custPhone = custPhone; } public String getCustAddress() { return custAddress; } public void setCustAddress(String custAddress) { this.custAddress = custAddress; } public Set<LinkMan> getLinkMans() { return linkMans; } public void setLinkMans(Set<LinkMan> linkMans) { this.linkMans = linkMans; } } ~~~ ***** ### 二.`LinkMan`實體類 ~~~ package net.youworker.onetomany.domain; import lombok.Data; import javax.persistence.*; /** * @author: hcf * @qq: 46914685 * @email: 46914685@qq.com * @date: 2020-01-08 9:58 */ @Entity @Table(name = "cst_linkman") @Data public class LinkMan { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "lkm_id", columnDefinition = "bigint(20) unsigned") private Long lkmId; //聯系人姓名 @Column(name = "lkm_name", nullable = false, columnDefinition = "varchar(100) default '' comment '聯系人姓名' ") private String lkmName = ""; //聯系人性別 @Column(name = "lkm_gender", nullable = false, columnDefinition = "varchar(100) default '' comment '聯系人性別' ") private String lkmGender = ""; //聯系人辦公電話 @Column(name = "lkm_phone", nullable = false, columnDefinition = "varchar(100) default '' comment '聯系人辦公電話' ") private String lkmPhone = ""; //聯系人手機 @Column(name = "lkm_mobile", nullable = false, columnDefinition = "varchar(11) default '' comment '聯系人手機' ") private String lkmMobile = ""; //聯系人郵箱 @Column(name = "lkm_email", nullable = false, columnDefinition = "varchar(100) default '' comment '聯系人郵箱' ") private String lkmEmail = ""; //聯系人職位 @Column(name = "lkm_position", nullable = false, columnDefinition = "varchar(100) default '' comment '聯系人職位' ") private String lkmPosition = ""; //聯系人備注 @Column(name = "lkm_memo", nullable = false, columnDefinition = "text comment '聯系人備注' ") private String lkmMemo = ""; // @Column(name = "lkm_cust_id") // private Long lkmCustId=0l; /** * 配置聯系人到客戶的多對一關系 * 使用注解的形式配置多對一關系 * 1.配置表關系 * * @ManyToOne:配置一對多關系 targetEntity:對方對象的字節碼對象 * 2.配置外鍵(中間表) * @JoinColumn:配置外鍵 name:外鍵字段名稱 * referencedColumnName:參照的主表的主鍵字段名稱 */ @ManyToOne(targetEntity = Customer.class) @JoinColumn(name = "lkm_cust_id", columnDefinition = "bigint(10) unsigned not null default 0 comment '所屬客戶id'", referencedColumnName = "cust_id") private Customer customer; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看