Spring boot+mybatis Multi-link query, duplicate foreign key

Source: Internet
Author: User

<resultmapId= "Recmap"Type= "Com.winter.entity.work.RecruitEntity">
<idColumn= "rec_id"Property= "RecId"/>
<resultColumn= "Rec_name"Property= "Recname"/>
<resultColumn= "Rec_number"Property= "Recnumber"/>
<resultColumn= "education_id"Property= "Educationid"/>
<resultColumn= "Rec_year"Property= "Recyear"/>
<resultColumn= "Rec_describe"Property= "Recdescribe"/>
<resultColumn= "Acceptance_of_disability"Property= "Acceptanceofdisability"/>
<resultColumn= "Contacts"Property= "Contacts"/>
<resultColumn= "Contacts_number"Property= "Contactsnumber"/>
<resultColumn= "Contacts_email"Property= "Contactsemail"/>
<resultColumn= "Pec_time"Property= "Pectime"/>
<resultColumn= "Detailed_address"Property= "Detailedaddress"/>
<associationProperty= "Positionentity"Javatype= "Com.winter.entity.work.PositionEntity">
<idColumn= "pos_id"Property= "Posid"/>
<resultColumn= "Pos_name"Property= "Posname"/>
</association>
<associationProperty= "Salaryentity"Javatype= "Com.winter.entity.work.SalaryEntity">
<idColumn= "sal_id"Property= "Salid"/>
<resultColumn= "Sal_name"Property= "Salname"/>
</association>
<associationColumn= "Rec_province"Property= "Recprovince"Javatype= "Com.winter.entity.RegionEntity">
<idColumn= "reg_id"Property= "Regid"/>
<resultColumn= "Reg_name"Property= "Regname"/>
<resultColumn= "pid"Property= "pid"/>
</association>
<associationColumn= "Rec__city"Property= "Reccity"Javatype= "Com.winter.entity.RegionEntity">
<idColumn= "reg_id"Property= "Regid"/>
<resultColumn= "Reg_name"Property= "Regname"/>
<resultColumn= "pid"Property= "pid"/>
<resultColumn= "Rec_type"Property= "RecType"/>
</association>
<associationColumn= "Rec_town"Property= "Rectown"Javatype= "Com.winter.entity.RegionEntity">
<idColumn= "reg_id"Property= "Regid"/>
<resultColumn= "Reg_name"Property= "Regname"/>
</association>
<association property= "companyentity" javatype= "com.winter.entity.work.CompanyEntity" >
<id column= "com_id" property= "Comid"/>
<result column= "Com_name" property= "Comname"/>
</association>
<collection property= "resumeentities" oftype= "com.winter.entity.work.ResumeEntity" >
<id column= "res_id" property= "ResId"/>
<result column= "Res_name" property= "Resname"/>
</collection>
<collection property= "treatmententities" oftype= "com.winter.entity.work.TreatmentEntity" >
<id column= "tre_id" property= "Treid"/>
<result column= "Tre_name" property= "Trename"/>
</collection>
</resultMap>

<selectId= "Queryrecall"Resultmap= "Recmap"ParameterType= "Com.winter.util.ConditionUtil">
Select
Rec.*,
POS.POS_ID,
Pos.pos_name,
SAL.SAL_ID,
Sal.sal_name,
REG1.REG_ID,
Reg1.reg_name,
REG2.REG_ID,
Reg2.reg_name,
REG3.REG_ID,
Reg3.reg_name,
COM.COM_ID,
Com.com_name,
RES.RES_ID,
Res.title,
TRE.TRE_ID,
Tre.tre_name
From Cw_recruit Rec
Left OUTER join Cw_position as pos on pos.pos_id = rec.pos_id
Left outer joins Cw_salary as sal on sal.sal_id = rec.sal_id
Left outer joins Cw_region as REG1 on reg1.reg_id = rec.rec_province
Left outer joins Cw_region as REG2 on reg2.reg_id = rec.rec_city
Left outer joins Cw_region as reg3 on reg3.reg_id = Rec.rec_town
Left outer join Cw_company as COM on com.com_id = rec.com_id
Left outer join Cw_recres as RRS on rrs.rec_id = rec.rec_id
Left OUTER join Cw_resume as res on res.res_id = rrs.res_id
Left OUTER join Cw_rectre as RCS on rcs.rec_id = rec.rec_id
Left outer joins Cw_treatment as tre on tre.tre_id = rcs.tre_id
Limit #{begin}, #{pagesize}
</select>
The results are as follows:
recruitentity{
Recid=1,
Recname= ' Anme ',
Positionentity=positionentity{...},
Resumeentities=[],
Salaryentity=salaryentity{...},
Treatmententities=[treatmententity{...}],
recprovince=regionentity{regid=2, pid=0, Regname= ' Wen Town '},
reccity=regionentity{regid=2, pid=0, Regname= ' Wen Town '},
rectown=regionentity{regid=2, pid=0, Regname= ' Wen Town '},
}
Three duplicate data, but SQL statements in the database run no problem, I do not know who can answer one or two??

Spring boot+mybatis Multi-link query, duplicate foreign key

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.