mybatis中的dao层接口是否可以重载。。。。。

是不可以重载的。。。

在dao层中的接口:

public interface BaseMapper<T> {

int deleteByPrimaryKey(Long id);


xml中的配置
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select id, document_id, operateuser, destorytime, reason, remark,sn
from t_destory
where id = #{id,jdbcType=BIGINT}
</select>




通过以上两个对比可知:
  dao层中接口的方法名与xml中的标签id值是一致的,所以一旦出现方法重载之后就可会出现相同的方法名,xml中的id也是重名的了,一运行系统就会报错,,,,
  所以mybaits中的dao层接口是不能进行方法重载的。。。。
 

猜你喜欢

转载自www.cnblogs.com/wgyi140724-/p/10736575.html