Mybatis table join query _ MySQL

Source: Internet
Author: User
The mybatis table join query is used as the join query for three tables.

Sub-table in which cfm_requirement_vendor_date is cfm_requirement_vendor

The cfm_requirement_vendor is a subtable of cfm_requirement.

1. mybatis ing file definition

       
 
  
  
      
    
   
   
   
    
   
  
    
 SELECTr. id, r. requirement_id, v. id as requirement_vendor_id, v. vendor_id, d. id as requirement_vendor_date_id, FROMcfm_requirement rJOIN cfm_requirement_vendor v ON r. id = v. cfm_requirement_idAND v. del_flag = 0 join cfm_requirement_vendor_date d on v. id = d. cfm_requirement_vendor_id and d. del_flag = 0 WHEREr. requirement_id =#{ requirementId} and r. del_flag = 0

II. java class definition

1. mapper. java

List SelectNestedByRequirementId (int requirementId );

2. persistence object

public class NestedRequirement extends Requirement {    private List
 
   requirementVendorList;public List
  
    getRequirementVendorList() {return requirementVendorList;}public void setRequirementVendorList(List
   
     requirementVendorList) {this.requirementVendorList = requirementVendorList;}      }
   
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.