为什么不写parameterType也可以运行成功?写别的类型可不会报错照常执行
command.xml:
<select id="queryCommandListByPage" resultMap="CommandResult" >
select <include refid="columns"/> from command a left join command_content b
on a.id=b.command_id
<where>
<if test="command.name != null and !"".equals(command.name.trim())">
and a.name=#{command.name}
</if>
<if test="command.description != null and !"".equals(command.description.trim())">
and a.description like '%' #{command.description} '%'
</if>
</where>
<if test="flag==1">
group by aid
</if>
order by id
</select>
<sql id="columns">
a.id aid,a.name,a.description,b.content,b.id,b.command_id
</sql>
接口:
/**
* 拦截器实现分页
*/
public List<command> queryCommandListByPage(Map<String,Object>parameter);
貌似mybatis能够识别吧,但返回值类型不能不写,因为mybatis需要将获得结果封装到相应的类中,查询的字段与类的属性需要一致(不一致的需要显示的配置)