码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-05-25 17:51:42      阅读:1467      评论:0      收藏:0      [点我收藏+]

标签:XML   class   int   rdo   ati   AC   where   str   select   

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

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

标签:XML   class   int   rdo   ati   AC   where   str   select   

原文地址:https://www.cnblogs.com/zyf-yxm/p/9089918.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!