关于mybatis中一些代码的疑问。

img

img

img

img

img

img


代码截图如上,主要是实现查询体育场地 的功能,association property="groundtypeobj" column="groundtypeobj" select="com.dao.admin.AdminGroundtypeDao.selectGroundtypeByGroundtypeId" / 不是很明白为什么要引用这行代码,最后select的作用是什么。if test="groundtypeobj!= null and groundtypeobj.groundtypeid != 0 "
and ground.groundtypeobj = #{groundtypeobj.groundtypeid}
这行代码的意思也不太明白

这个是单表查询+association引用select方式,目的实现关联查询。
select 中的内容,表示需要执行的sql方法。

<if test="">

属于动态标签,当满足test中的表达式时,if内的语句才执行。

说明groundtype,Ground表中存一对多的关联关系,Ground表的groundtypeobj字段的值引用groundtype表groundtypeId字段的值,如果选择了运动场类型就表现加上这个条件。

selectGroundtypeByGroundtypeId这个是函数名称,表示调用这个函数查询对应类型的操场数据。

这是mybatis的代码注释,它的作用是解释一些关键信息,例如标题、描述、执行的流程等。