mybatis使用@param("xxx")注解传参和不使用的区别


public interface SystemParameterMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SystemParameterDO record);

    SystemParameterDO selectByPrimaryKey(Integer id);//不使用注解

    List<SystemParameterDO> selectAll();

    int updateByPrimaryKey(SystemParameterDO record);

    SystemParameterDO getByParamID(@Param("paramID") String paramID);//使用注解
}

跟映射的xml

<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, paramID, paramContent, paramType, memo
    from wh_system_parameter
    where id = #{id,jdbcType=INTEGER}
  </select>

<select id="getByParamID"  resultMap="BaseResultMap">
    select id, paramID, paramContent, paramType, memo
    from wh_system_parameter
    where paramID = #{paramID}
  </select>

区别是:使用注解可以不用加parameterType


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM