1.分别建立实体类classes,grade
2,在实体中添加一个属性;
@TableField(exist = false)
private PfGrade pfGrade;
3.修改classes.xml
<resultMap id="BaseResultMap" type="cn.jeefast.modules.platform.entity.PfClasses">
<id column="cid" property="cid" />
<result column="cname" property="cname" />
<result column="gid" property="gid" />
<association property="pfGrade" javaType="cn.jeefast.modules.platform.entity.PfGrade">
<id property="gid" column="gid"></id>
<result column="gname" property="gname"/>
<result column="sc_id" property="scId"/>
</association>
</resultMap>
<select id="queryPageList" resultMap="BaseResultMap">
select * from pf_classes pn inner join pf_grade on pn.gid = pf_grade.gid
<where>
<if test="gname != null and gname.trim() != ''">
and pn.`cname` like concat('%',#{cname},'%')
</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by pn.${sidx} ${order}
</when>
<otherwise>
order by pn.cid asc
</otherwise>
</choose>
</select>
4.最后在classes.js文件中修改;