Quellcode durchsuchen

租户编辑报错修改

xgb vor 2 Wochen
Ursprung
Commit
1bf90d0a11

+ 0 - 19
fs-admin/src/main/java/com/fs/config/FullQualifiedBeanNameGenerator.java

@@ -1,19 +0,0 @@
-package com.fs.config;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.context.annotation.AnnotationBeanNameGenerator;
-
-/**
- * 使用全限定类名作为bean名称,避免不同包下同名类的bean冲突
- */
-public class FullQualifiedBeanNameGenerator extends AnnotationBeanNameGenerator {
-
-    @Override
-    protected String buildDefaultBeanName(BeanDefinition definition) {
-        String beanClassName = definition.getBeanClassName();
-        if (beanClassName != null) {
-            return beanClassName;
-        }
-        return super.buildDefaultBeanName(definition);
-    }
-}

+ 0 - 30
fs-admin/src/main/java/com/fs/config/OverridingBeanNameGenerator.java

@@ -1,30 +0,0 @@
-package com.fs.config;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.context.annotation.AnnotationBeanNameGenerator;
-
-/**
- * 自定义BeanName生成器:对冲突的bean使用全限定名,其他保持默认行为
- * 解决fs-framework和fs-service中同名类的冲突问题
- */
-public class OverridingBeanNameGenerator extends AnnotationBeanNameGenerator {
-
-    @Override
-    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
-        // 先按默认逻辑生成名称
-        String beanName = super.generateBeanName(definition, registry);
-        
-        // 如果已存在同名bean但来自不同类,使用全限定名避免冲突
-        if (registry.containsBeanDefinition(beanName)) {
-            BeanDefinition existingDef = registry.getBeanDefinition(beanName);
-            String existingClass = existingDef.getBeanClassName();
-            String newClass = definition.getBeanClassName();
-            if (existingClass != null && newClass != null && !existingClass.equals(newClass)) {
-                // 冲突:使用全限定类名作为bean名称
-                return newClass;
-            }
-        }
-        return beanName;
-    }
-}

+ 6 - 1
fs-service/src/main/java/com/fs/tenant/service/impl/TenantInfoServiceImpl.java

@@ -139,7 +139,12 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
 
 
             tenantInfo.setDbUrl(TenantUtils.buildJdbcUrl(tenantInfo.getDbIp(),tenantInfo.getDbPort(), tenantInfo.getDbName()));
             tenantInfo.setDbUrl(TenantUtils.buildJdbcUrl(tenantInfo.getDbIp(),tenantInfo.getDbPort(), tenantInfo.getDbName()));
             tenantInfo.setCreateTime(DateUtils.getNowDate());
             tenantInfo.setCreateTime(DateUtils.getNowDate());
-            tenantInfo.setStatus(2);
+            if (tenantInfo.getStatus() == null) {
+                tenantInfo.setStatus(1);
+            }
+            if (tenantInfo.getBalance() == null) {
+                tenantInfo.setBalance(BigDecimal.ZERO);
+            }
             int result = baseMapper.insertTenantInfo(tenantInfo);
             int result = baseMapper.insertTenantInfo(tenantInfo);
             refreshTenantInfoCodeCache(tenantInfo);
             refreshTenantInfoCodeCache(tenantInfo);
 
 

+ 4 - 3
fs-service/src/main/resources/mapper/tenant/TenantInfoMapper.xml

@@ -54,7 +54,7 @@
 
 
     <select id="selectTenantInfoById" resultMap="TenantInfoResult">
     <select id="selectTenantInfoById" resultMap="TenantInfoResult">
         <include refid="selectTenantInfoVo"/>
         <include refid="selectTenantInfoVo"/>
-        where id = #{id}
+        where t.id = #{id}
     </select>
     </select>
     <select id="tenantList" resultType="com.fs.tenant.vo.TenantInfoShowVo">
     <select id="tenantList" resultType="com.fs.tenant.vo.TenantInfoShowVo">
         select id, tenant_code, tenant_name from tenant_info
         select id, tenant_code, tenant_name from tenant_info
@@ -503,8 +503,8 @@
     <update id="updateTenantInfo">
     <update id="updateTenantInfo">
         update tenant_info
         update tenant_info
         <trim prefix="SET" suffixOverrides=",">
         <trim prefix="SET" suffixOverrides=",">
-            <if test="tenantCode != null and tenantCode != ''">tenant_code = #{tenantCode},</if>
-            <if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
+            <if test="tenantCode != null">tenant_code = #{tenantCode},</if>
+            <if test="tenantName != null">tenant_name = #{tenantName},</if>
             <if test="status != null">status = #{status},</if>
             <if test="status != null">status = #{status},</if>
             <if test="expireTime != null">expire_time = #{expireTime},</if>
             <if test="expireTime != null">expire_time = #{expireTime},</if>
             <if test="dbUrl != null">db_url = #{dbUrl},</if>
             <if test="dbUrl != null">db_url = #{dbUrl},</if>
@@ -516,6 +516,7 @@
             <if test="contactName != null">contact_name = #{contactName},</if>
             <if test="contactName != null">contact_name = #{contactName},</if>
             <if test="companyNum != null">company_num = #{companyNum},</if>
             <if test="companyNum != null">company_num = #{companyNum},</if>
             <if test="accountNum != null">account_num = #{accountNum},</if>
             <if test="accountNum != null">account_num = #{accountNum},</if>
+            <if test="balance != null">balance = #{balance},</if>
         </trim>
         </trim>
         where id = #{id}
         where id = #{id}
     </update>
     </update>