MyBatis配置文件Mapper增删改查标准写法(包含jdbcType配置)




  
    
    
    
    
  
  
    id, username, gender, age
  
  
  
    delete from my_user
    where id = #{id,jdbcType=INTEGER}
  
  
    insert into my_user (id, username, gender, 
      age)
    values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, 
      #{age,jdbcType=INTEGER})
  
  
    insert into my_user
    
      
        id,
      
      
        username,
      
      
        gender,
      
      
        age,
      
    
    
      
        #{id,jdbcType=INTEGER},
      
      
        #{username,jdbcType=VARCHAR},
      
      
        #{gender,jdbcType=VARCHAR},
      
      
        #{age,jdbcType=INTEGER},
      
    
  
  
    update my_user
    
      
        username = #{username,jdbcType=VARCHAR},
      
      
        gender = #{gender,jdbcType=VARCHAR},
      
      
        age = #{age,jdbcType=INTEGER},
      
    
    where id = #{id,jdbcType=INTEGER}
  
  
    update my_user
    set username = #{username,jdbcType=VARCHAR},
      gender = #{gender,jdbcType=VARCHAR},
      age = #{age,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  

你可能感兴趣的:(MyBatis配置文件Mapper增删改查标准写法(包含jdbcType配置))