mybatis nested class parameter query

xml:

<select id="test" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from ds_award_point t
    where  t.`name`=#{bandPointDO.name}
</select>

mapper:

 List test(TestDO testDO);

@data

public class TestDO { BandPointDO bandPointDO;

}

TestDO testDO=new TestDO();
BandPointDO bandPointDO=new BandPointDO();
bandPointDO.setName("001");
testDO.setBandPointDO(bandPointDO);
mapper.test(testDO)

Of course, you need to judge the entity attribute as empty, and then get the attribute field of the attribute of the class

t.`name`=#{bandPointDO.name}

Guess you like

Origin blog.csdn.net/wuhenzhangxing/article/details/120549465