@Override
public Manager queryManagerByName(String name) {
Logger.debug("queryManagerByName and name:{}", name);
if (StringUtils.isEmpty(name)) {
Logger.error("queryManagerByName fail due to name is empty....");
return null;
}
return managerMapper.queryManagerByName(name);
}
这里的name明明是个字符串,但是在sql中却是键值对了,而且还能正确运行,完全没毛病,求解释一下。难道mybatis会自动把字符串转成键值对?以参数名作为键,已参数值作为值?
最后,select * 是不是太业余了?换成select 主键 from。。。会不会效率高一点呢?
<select id="queryManagerByName" parameterType="java.util.Map" resultMap="manager">
select * from ls_manager where username = #{name}
</select>
相关分类