mybaits Mapping中的知识

来源:互联网 发布:国家电网考试知乎 编辑:程序博客网 时间:2024/06/09 20:14
  <insert id="insertSelective" parameterType="cn.springmvc.model.Info" >    insert into info    <trim prefix="(" suffix=")" suffixOverrides="," >          <!--prefix="(" suffix=")"在前后加上()suffixOverrides=","去掉最后多余的","  -->       <!-- 判断id字段是否为空 -->      <if test="id != null" >                       id,      </if>      <if test="imagerurl != null" >        imagerurl,      </if>      <if test="allclick != null" >        allclick,      </if>      <if test="clicktype != null" >        clicktype,      </if>    </trim>    <trim prefix="values (" suffix=")" suffixOverrides="," >      <if test="id != null" >        #{id,jdbcType=INTEGER},      </if>      <if test="imagerurl != null" >        #{imagerurl,jdbcType=VARCHAR},      </if>      <if test="allclick != null" >        #{allclick,jdbcType=BIT},      </if>      <if test="clicktype != null" >        #{clicktype,jdbcType=INTEGER},      </if>    </trim>  </insert>相当于:insert into info (id ,imagerurl,allclick,clicktype )values (#{id,jdbcType=INTEGER},#{imagerurl,jdbcType=VARCHAR},#{allclick,jdbcType=BIT},#{clicktype,jdbcType=INTEGER})
原创粉丝点击