فهرست منبع

接口查询空指针

wangzhe 2 سال پیش
والد
کامیت
1d26bf79cf

+ 8 - 0
mybusiness/src/main/java/com/sooka/system/mapper/TUInterfaceinfoMapper.java

@@ -65,6 +65,14 @@ public interface TUInterfaceinfoMapper
     public int updateTUInterfaceinfo(TUInterfaceinfo tUInterfaceinfo);
 
     /**
+     * 查询【库表数据条数】
+     *
+     * @param tUInterfaceinfo 【库表数据条数】
+     * @return 结果
+     */
+    public TUInterfaceinfo selectCountByTableName(TUInterfaceinfo tUInterfaceinfo);
+
+    /**
      * 修改【接口成功条数】
      *
      * @param tUInterfaceinfo 【接口成功条数】

+ 3 - 1
mybusiness/src/main/java/com/sooka/system/service/impl/TUInterfaceinfoServiceImpl.java

@@ -204,10 +204,12 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
                 continue;
             }
             Date dateBegin = new Date();
+            TUInterfaceinfo result = tUInterfaceinfoMapper.selectCountByTableName(tuInterfaceinfo);
             System.out.println(tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + "updating database...");
+            tuInterfaceinfo.setCallsuccnum(result.getCallsuccnum());
             tUInterfaceinfoMapper.updateInterfaceCallsuccnum(tuInterfaceinfo);
             Long interval = new Date().getTime() - dateBegin.getTime();//接口查询总数所用时间
-            System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + interval + " ms");
+            System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + interval + " ms total:[" + result.getCallsuccnum() + "]");
         }
     }
 

+ 5 - 1
mybusiness/src/main/resources/mapper/system/TUInterfaceinfoMapper.xml

@@ -208,8 +208,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+    <select id="selectCountByTableName" parameterType="TUInterfaceinfo" resultMap="TUInterfaceinfoResult">
+        select count(id) callsuccnum from ${tableName}
+    </select>
+
     <update id="updateInterfaceCallsuccnum" parameterType="TUInterfaceinfo">
-        update t_u_interfaceinfo set callsuccnum = (select count(id) from ${tableName}) where id = #{id}
+        update t_u_interfaceinfo set callsuccnum = #{callsuccnum} where id = #{id}
     </update>
 
     <update id="updateDataNum" parameterType="TUInterfaceinfo">