lxw
2023-10-30 a31dec66b5d858e8bfeb98b81c7cab863205906a
中-15-BattResDataMapper.xml;15行
5个文件已修改
44 ■■■■ 已修改文件
src/main/java/com/whyc/mapper/BattResDataMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattResDataService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StandardFeatureCurveService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTablePageInfoService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattResDataMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattResDataMapper.java
@@ -8,7 +8,7 @@
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);
src/main/java/com/whyc/service/BattResDataService.java
@@ -6,6 +6,7 @@
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;
@@ -18,6 +19,9 @@
    @Resource
    private BattResDataMapper mapper;
    @Autowired
    private SubTablePageInfoService subService;
    public BatttestdataInf calcBehindInfo(BatttestdataInf battTestDataInf) {
        //平均截止电压
        Float avgVol = mapper.calcAvgVol(battTestDataInf.getBattGroupId(),battTestDataInf.getTestRecordCount());
@@ -26,7 +30,8 @@
        }
        //最低单体电压和编号
        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());
src/main/java/com/whyc/service/StandardFeatureCurveService.java
@@ -522,12 +522,15 @@
        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);
    }
}
src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -2029,4 +2029,28 @@
                "        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;
    }
}
src/main/resources/mapper/BattResDataMapper.xml
@@ -12,9 +12,9 @@
    <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>