Browse Source

修复插入拿不到自增id问题

ye 8 months ago
parent
commit
fbf2e1e710

+ 38 - 34
resources/mybatis/mapper/dmn/DnmDomainInformationMapper.xml

@@ -28,42 +28,46 @@
     </resultMap>
 
     <insert id="insertDomainInformation" parameterType="cn.com.countrygarden.bi.main.model.dmn.DnmDomainInformation">
+        <!-- 注意这里的改动 拿到自增的id -->
+        <selectKey keyProperty="id" resultType="java.lang.Integer" order="AFTER">
+            SELECT LAST_INSERT_ID()
+        </selectKey>
         INSERT INTO dnm_domain_information (domain_name,
-                                            domain_coupon_number,
-                                            owner,
-                                            audit_status,
-                                            application_time,
-                                            agency_id,
-                                            renewal_id,
-                                            renewal_time,
-                                            renewal_amount,
-                                            business_model,
-                                            department_used,
-                                            registrar,
-                                            registration_time,
-                                            account_id,
-                                            auditor,
-                                            defalg,
-                                            draft_status_type_id,
-                                            cost_information_id)
+        domain_coupon_number,
+        owner,
+        audit_status,
+        application_time,
+        agency_id,
+        renewal_id,
+        renewal_time,
+        renewal_amount,
+        business_model,
+        department_used,
+        registrar,
+        registration_time,
+        account_id,
+        auditor,
+        defalg,
+        draft_status_type_id,
+        cost_information_id)
         VALUES (#{domainName},
-                #{domainCouponNumber},
-                #{owner},
-                #{auditStatus},
-                #{applicationTime},
-                #{agencyId},
-                #{renewalId},
-                #{renewalTime},
-                #{renewalAmount},
-                #{businessModel},
-                #{departmentUsed},
-                #{registrar},
-                #{registrationTime},
-                #{accountId},
-                #{auditor},
-                #{defalg},
-                #{draftStatusTypeId},
-                #{costInformationId})
+        #{domainCouponNumber},
+        #{owner},
+        #{auditStatus},
+        #{applicationTime},
+        #{agencyId},
+        #{renewalId},
+        #{renewalTime},
+        #{renewalAmount},
+        #{businessModel},
+        #{departmentUsed},
+        #{registrar},
+        #{registrationTime},
+        #{accountId},
+        #{auditor},
+        #{defalg},
+        #{draftStatusTypeId},
+        #{costInformationId})
     </insert>
 
     <update id="updateDnmDomainInformation">

+ 1 - 0
src/cn/com/countrygarden/bi/main/service/dmn/impl/DnmDomainInformationServiceImpl.java

@@ -73,6 +73,7 @@ public class DnmDomainInformationServiceImpl implements DnmDomainInformationServ
 
 //        修改域名信息
         dnmDomainInformationMapper.insertDomainInformation(domainInformation);
+            //        处理空指针问题 optional优化
         int domainInformationId = domainInformation.getId();
         List<CostInformation> costList = dnmDomainInformationAndCost.getCostList();
         for (CostInformation cost : costList) {

File diff suppressed because it is too large
+ 0 - 0
src/cn/com/countrygarden/bi/main/service/twerp/hm/impl/TbSysUserServiceImpl.java


Some files were not shown because too many files changed in this diff