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