zoukankan      html  css  js  c++  java
  • Mybatis中的if,else,获取新增id

    <insert id="insertServiceEquip" parameterType="Map">
    <selectKey resultType="int" keyProperty="seq" order="BEFORE">

    《获取新增id》
    select
    SEQ_EQUIPSERVICE.NEXTVAL as seq from dual
    </selectKey>
    INSERT INTO EQUIP_SERVICE
    <trim prefix="(" suffix=")" suffixOverrides=",">

    《这个choose下的when,otherwise就是if,else了》

    <choose>

    <when test="serviceAreaId !=null">
    <if test="serviceAreaId != null">SEQ,</if>
    </when>
    <otherwise>
    <if test="seq != null">SEQ, </if>
    </otherwise>
    </choose>
    <if test="equipId != null">EQUIP_ID,</if>
    <if test="buildId != null">BUILD_ID,</if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
    <choose>
    <when test="serviceAreaId !=null">
    <if test="serviceAreaId != null">#{serviceAreaId},</if>
    </when>
    <otherwise>
    <if test="seq != null">#{seq}, </if>
    </otherwise>
    </choose>
    <if test="equipId != null"> #{equipId}, </if>
    <if test="buildId != null"> #{buildId}, </if>
    </trim>
    </insert>

  • 相关阅读:
    云计算安全概述
    快照技术
    存储可靠性技术之--备份
    存储可靠性技术之 --RAID
    存储方式
    存储技术
    CentOS安装setup
    CentOS7安装iptables防火墙
    CentOS 7.0下使用yum安装MySQL
    The APR based Apache Tomcat Native library
  • 原文地址:https://www.cnblogs.com/52czm/p/7049201.html
Copyright © 2011-2022 走看看