中-//32-BattTestDataStopMapper.xml;26行
| | |
| | | //查询最近一笔放电记录 |
| | | List<BattTestDataStop> getTestDataStop(Integer battGroupId, Date testStarttime); |
| | | |
| | | List<BattTestDataStop> getList(int battGroupId,int testRecordCount); |
| | | //List<BattTestDataStop> getList(int battGroupId,int testRecordCount); |
| | | |
| | | Float calcAvgVol(Integer battGroupId, Integer testRecordCount); |
| | | } |
| | |
| | | import com.whyc.mapper.BattTestDataStopMapper; |
| | | import com.whyc.pojo.BattTestDataStop; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private BattTestDataStopMapper mapper; |
| | | |
| | | @Autowired |
| | | private SubTablePageInfoService subService; |
| | | |
| | | /**计算落后信息 |
| | | * @param battTestDataInf*/ |
| | | public BatttestdataInf calcBehindInfo(BatttestdataInf battTestDataInf) { |
| | | //筛选落后单体,计算总电压 |
| | | List<BattTestDataStop> stopList = mapper.getList(battTestDataInf.getBattGroupId(), battTestDataInf.getTestRecordCount()); |
| | | //List<BattTestDataStop> stopList = mapper.getList(battTestDataInf.getBattGroupId(), battTestDataInf.getTestRecordCount()); |
| | | List<BattTestDataStop> stopList = subService.getList(battTestDataInf.getBattGroupId(), battTestDataInf.getTestRecordCount()); |
| | | double realCap = 0;//实际容量 |
| | | double STDAH = 0;//标存容量 |
| | | int hourRate = 0;//小时率 |
| | |
| | | List list=subService.getList("tb_eleprice_1002");*/ |
| | | /*24 |
| | | int tableNum= subService.judgeTable_realdata("1000003_2020_12");*/ |
| | | /*29*/ |
| | | /*29 |
| | | BattRealdata realdata = new BattRealdata(); |
| | | realdata.setTableName("1000018_2023_09"); |
| | | realdata.setRecrodTime(date5); |
| | |
| | | realdata.setRoteN(7); |
| | | //List list=subService.searchMaxNum2(realdata); |
| | | //int maxNum=subService.searchMaxNum(realdata); |
| | | List list=subService.serchByCondition2(realdata); |
| | | List list=subService.serchByCondition2(realdata);*/ |
| | | /*32*/ |
| | | List list= subService.getList(1000011,1); |
| | | return new Response().setII(1,true,list,null); |
| | | } |
| | | } |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //32-BattTestDataStopMapper.xml;26行 |
| | | public List<BattTestDataStop> getList(int battGroupId,int testRecordCount){ |
| | | String sql="SELECT DISTINCT battGroupId, test_curr, test_cap, mon_num, mon_vol " + |
| | | " FROM " + |
| | | " db_batt_testdata.tb_batttestdatastop_"+battGroupId+" " + |
| | | " WHERE " + |
| | | " test_record_count = "+testRecordCount+" " + |
| | | " AND data_available = 1"; |
| | | List<BattTestDataStop> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattTestDataStop> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattTestDataStop ph=new BattTestDataStop(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | <select id="checkTable" resultType="java.lang.String"> |
| | | select TABLE_NAME from information_schema.TABLES t where t.TABLE_SCHEMA like "${dbName}" and t.TABLE_NAME like "${tableName}" limit 1 |
| | | select TABLE_NAME from information_schema.TABLES t where t.TABLE_SCHEMA like CONCAT('%',#{dbName},'%') and t.TABLE_NAME like CONCAT('%',#{tableName},'%') limit 1 |
| | | </select> |
| | | <!--<select id="calcAvgVol" resultType="java.lang.Float"> |
| | | select avg(binary mon_vol) from db_batt_testdata.tb_battresdata_${battGroupId} where test_record_count= #{testRecordCount} |
| | |
| | | where db_batt_testdata.tb_batttestdatastop_${battGroupId}.test_starttime=#{testStarttime} |
| | | and db_batt_testdata.tb_batttestdatastop_${battGroupId}.data_available=1 |
| | | </select> |
| | | <select id="getList" resultType="com.whyc.pojo.BattTestDataStop"> |
| | | <!--<select id="getList" resultType="com.whyc.pojo.BattTestDataStop"> |
| | | SELECT DISTINCT |
| | | battGroupId, test_curr, test_cap, mon_num, mon_vol |
| | | FROM |
| | |
| | | WHERE |
| | | test_record_count = #{testRecordCount} |
| | | AND data_available = 1 |
| | | </select> |
| | | </select>--> |
| | | <select id="calcAvgVol" resultType="java.lang.Float"> |
| | | SELECT |
| | | AVG(BINARY mon_vol) AS mon_avg |