springMVC+mybatits中mapper配置文件使用

阅读更多

1.配置文件resultMap


		
		
		
		
		
		
		
		
		
		
	

 2.set与if标签嵌套

  
    update artificial_inquiry_quoted_prices  
      
          
            company_id=#{companyId,jdbcType=INTEGER},  
          
          
            price=#{price,jdbcType=DOUBLE},  
          
          
            remarks=#{remarks,jdbcType=DOUBLE},  
          
          
            discount=#{discount,jdbcType=DOUBLE},  
          
          
            status=#{status,jdbcType=VARCHAR},  
          
          
            artificial_inquiry_reply_id=#{reply.id,jdbcType=VARCHAR},  
          
          
            created_at=#{createdAt,jdbcType=VARCHAR},  
          
          
            updated_at=#{updatedAt,jdbcType=VARCHAR},  
          
          
            inquiry_track_time=#{TrackTime,jdbcType=VARCHAR},  
          
          
            content=#{content,jdbcType=VARCHAR},  
          
          
            user_id=#{userId,jdbcType=VARCHAR},  
          
          
            artificial_inquiry_bill_id=#{bill.id,jdbcType=VARCHAR},  
          
          
            materials_remark=#{materialsRemark,jdbcType=VARCHAR},  
          
      
    where id=#{id}  
 

 3.批量查询

 

 4. 批量增加

  
        insert into  
        artificial_inquiry_replies(material_name,specification,amount,unit,artificial_inquiry_bill_id,user_id,status,created_at,updated_at,  
            note,inquiry_user_id,no_pass_reason,other_note,is_front,brand,answer_time,materials_type)  
        values  
          
            (  
                #{reply.materialName},#{reply.specification},#{reply.amount},  
                #{reply.unit},#{reply.bill.id},#{reply.userId},#{reply.status},  
                #{reply.createdAt},#{reply.updatedAt},#{reply.note},#{reply.inquiryUserId},  
                #{reply.noPassReason},#{reply.otherNote},#{reply.front},#{reply.brand},  
                #{reply.answerTime},#{reply.materialsType}  
            )  
          
    

 5.  批量删除

    
        delete from artificial_inquiry_replies where id in  
          
            #{item}  
          
     

 

你可能感兴趣的:(resultMap,set与If嵌套,批量查询,批量删除,批量增加)