顾名思义,association是联合查询。
在使用association中一定要注意几个问题。文笔不好,白话文描述一下。
1:
<association property="fncg_PD_QRY_MANAGE" column="###" select="###" />
fncg_PD_QRY_MANAGE 是哪来的?看红色部分,
public class FNCG_PD_QRY extends BasePO{ private String COD_FN_ENT; private String COD_PD_LINE; private String ID_GRP_PD; private String NUM_TARF; private String ID_IF_TARF_EXTID; private String IND_MAIN_INTL_TARF; private String NAM_TARF; private String COD_ISO_CCY; ………… private FNCG_PD_QRY_MANAGE fncg_PD_QRY_MANAGE; public FNCG_PD_QRY_MANAGE getFncg_PD_QRY_MANAGE() { return fncg_PD_QRY_MANAGE; } public void setFncg_PD_QRY_MANAGE(FNCG_PD_QRY_MANAGE fncg_PD_QRY_MANAGE) { this.fncg_PD_QRY_MANAGE = fncg_PD_QRY_MANAGE; }
2:<association property="fncg_PD_QRY_MANAGE" column="###" select="###" />
column如果传多个参数怎么写?
<association property="fncg_PD_QRY_MANAGE" column="{COD_FN_ENT=COD_FN_ENT,COD_PD_LINE=COD_PD_LINE,ID_GRP_PD=ID_GRP_PD,NUM_TARF=NUM_TARF}" select="sql123" />
那么sql123怎么接收这4个值?
<select id="sql123" parameterType="java.util.Map" resultMap="com.cvicin.products.productManage.fngg.mapper.poRes.FNCG_PD_QRY_MANAGE"> SELECT * FROM FNCG_PD_QRY_MANAGE WHERE COD_FN_ENT = #{COD_FN_ENT} AND COD_PD_LINE = #{COD_PD_LINE} AND ID_GRP_PD = #{ID_GRP_PD} AND NUM_TARF = #{NUM_TARF} </select>
注意:
parameterType一定要是 java.util.Map ,否则会出现什么“there is no setter ### in ###” 我记不太清具体的错误信息了。