فهرست منبع

变更新增方式,返回主键id

chengpan 2 سال پیش
والد
کامیت
fee44ca00f
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      ruoyi-system/src/main/resources/mapper/opt/CompanyInfoMapper.xml

+ 5 - 0
ruoyi-system/src/main/resources/mapper/opt/CompanyInfoMapper.xml

@@ -44,6 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertCompanyInfo" parameterType="CompanyInfo" useGeneratedKeys="true" keyProperty="companyId">
+        <selectKey keyProperty="companyId" order="BEFORE" resultType="java.lang.Long" >
+            SELECT LAST_INSERT_ID();
+        </selectKey>
         insert into t_company_info
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="companyNm != null">company_nm,</if>
@@ -58,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            company_id
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyNm != null">#{companyNm},</if>
@@ -72,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            #{companyId}
          </trim>
     </insert>