中-15-BattResDataMapper.xml;15行
| | |
| | | public interface BattResDataMapper extends CustomMapper<BattResData> { |
| | | Float calcAvgVol(Integer battGroupId, Integer testRecordCount); |
| | | |
| | | BattResData getMinInfo(Integer battGroupId, Integer testRecordCount); |
| | | //BattResData getMinInfo(Integer battGroupId, Integer testRecordCount); |
| | | |
| | | void deleteByTestRecordCount(Integer battGroupId, Integer testRecordCount); |
| | | |
| | |
| | | import com.whyc.pojo.BattResData; |
| | | import com.whyc.pojo.BattResDataInf; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private BattResDataMapper mapper; |
| | | |
| | | @Autowired |
| | | private SubTablePageInfoService subService; |
| | | |
| | | public BatttestdataInf calcBehindInfo(BatttestdataInf battTestDataInf) { |
| | | //平均截止电压 |
| | | Float avgVol = mapper.calcAvgVol(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount()); |
| | |
| | | } |
| | | |
| | | //最低单体电压和编号 |
| | | BattResData resDataInf = mapper.getMinInfo(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount()); |
| | | //BattResData resDataInf = mapper.getMinInfo(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount()); |
| | | BattResData resDataInf = subService.getMinInfo(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount()); |
| | | if(resDataInf !=null) { |
| | | battTestDataInf.setMinMonvol(BigDecimal.valueOf(resDataInf.getMonVol()).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue()); |
| | | battTestDataInf.setMinMonnum(resDataInf.getMonNum()); |
| | |
| | | Date date5=ThreadLocalUtil.parse("2023-08-01 11:19:20",1); |
| | | Date date6=ThreadLocalUtil.parse("2023-08-03 04:42:35",1); |
| | | /*10List list=subService.getListByStationId(date5,date6,"42010011","tb_battalarm_data_history_2023_08");*/ |
| | | /*12 |
| | | ElePrice ele=new ElePrice(); |
| | | ele.setTmpId(1015); |
| | | ele.setTmpStarttime(date5); |
| | | ele.setTmpStoptime(date6); |
| | | ele.setElePrice(20f); |
| | | subService.addElePrice(ele); |
| | | return new Response().setII(1,true,ele,null); |
| | | subService.addElePrice(ele);*/ |
| | | /*15*/ |
| | | BattResData br=subService.getMinInfo(1000005,1); |
| | | return new Response().setII(1,true,br,null); |
| | | } |
| | | } |
| | |
| | | " values( "+elePrice.getTmpId()+",'"+ThreadLocalUtil.format(elePrice.getTmpStarttime(),4)+"','"+ThreadLocalUtil.format(elePrice.getTmpStoptime(),4)+"',"+elePrice.getElePrice()+")"; |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | //15-BattResDataMapper.xml;15行 |
| | | public BattResData getMinInfo(Integer battGroupId, Integer testRecordCount){ |
| | | String sql=" select mon_num ,mon_vol from db_batt_testdata.tb_battresdata_"+battGroupId+" " + |
| | | " where mon_vol=(select min(mon_vol) from db_batt_testdata.tb_battresdata_"+battGroupId+" where test_record_count="+testRecordCount+" ) limit 1"; |
| | | List<BattResData> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattResData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattResData bh=new BattResData(); |
| | | bh.setMonNum(rs.getInt("mon_num")); |
| | | bh.setMonVol(rs.getFloat("mon_vol")); |
| | | list.add(bh); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | BattResData bres=null; |
| | | if(list!=null&&list.size()>0){ |
| | | bres=list.get(0); |
| | | } |
| | | return bres; |
| | | |
| | | } |
| | | } |
| | |
| | | <select id="calcAvgVol" resultType="java.lang.Float"> |
| | | select avg(binary mon_vol) from db_batt_testdata.tb_battresdata_${battGroupId} where test_record_count= #{testRecordCount} |
| | | </select> |
| | | <select id="getMinInfo" resultType="com.whyc.pojo.BattResData"> |
| | | <!--<select id="getMinInfo" resultType="com.whyc.pojo.BattResData"> |
| | | select mon_num ,mon_vol from db_batt_testdata.tb_battresdata_${battGroupId} where mon_vol=(select min(mon_vol) from db_batt_testdata.tb_battresdata_${battGroupId} where test_record_count= #{testRecordCount} ) limit 1 |
| | | </select> |
| | | </select>--> |
| | | <select id="getResInfoByBattGroupId" resultType="com.whyc.pojo.BattResData"> |
| | | select * from db_batt_testdata.tb_battresdata_${battGroupId} order by test_starttime desc |
| | | </select> |