mybatis使用@param("xxx")註解傳參和不使用的區別
阿新 • • 發佈:2018-05-25
color class myba rdo rec delete ger con inter
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")註解傳參和不使用的區別