whyclxw
2024-09-09 5c1f15e385ea165ac151290f32d0a8b8e23270e2
测试管理根据设备id获取充放电记录
4个文件已修改
29 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/BatttestdataInfController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/BatttestdataInfController.java
@@ -33,4 +33,9 @@
    public Map<String, Object> getDevTinfByWeek(@RequestParam Integer uid){
        return service.getDevTinfByWeek(uid);
    }
    @ApiOperation(value = "获取设备的充放电记录")
    @GetMapping("getTinfById")
    public Response getTinfById(@RequestParam Integer devId){
        return service.getTinfById(devId);
    }
}
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -16,4 +16,7 @@
    //近一周(mysql中不会算上今天)
    List<BatttestdataInf> getDevTinfByWeek(@Param("uid")int userId,@Param("type")int type);
    //获取充放电数据
    List<BatttestdataInf> getTinfById( @Param("type")int type, @Param("devId")Integer devId);
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -4,6 +4,8 @@
import com.whyc.mapper.BatttestdataInfMapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import com.whyc.pojo.db_lithium_ram_db.DevInf;
import com.whyc.pojo.db_user.UserInf;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -134,4 +136,14 @@
        map.put("actm",actmdataMap);
        return map;
    }
   //获取设备的充放电记录
    public Response getTinfById(Integer devId) {
        Map<String,Object> map=new HashMap<>();
        //获取充放电数据
        List<BatttestdataInf> listDis=mapper.getTinfById(3,devId);
        List<BatttestdataInf> listChr=mapper.getTinfById(2,devId);
        map.put("dis",listDis);
        map.put("chr",listChr);
        return new Response().setII(1,true,map,"获取设备的充放电记录");
    }
}
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -75,4 +75,13 @@
            )
        </where>
    </select>
    <select id="getTinfById" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf">
        select *
        from db_batt_testdata.tb_batttestdata_inf
        <where>
        and test_type=#{type}
        and dev_id=#{devId}
        </where>
        order by test_starttime asc
    </select>
</mapper>