whyclxw
2024-06-27 2eff7304df15f463dcd4563c0c62f4531bbef138
电源ACDC
8个文件已修改
90 ■■■■ 已修改文件
pom.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/SinfBinfController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/SinfBinfMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/PowerInf.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/SinfBinf.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/StationInf.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SinfBinfService.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/SinfBinfMapper.xml 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -72,12 +72,22 @@
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.5</version>
        </dependency>
        <!--mybatis 及mybatis-plus-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.1.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>mybatis</artifactId>
                    <groupId>org.mybatis</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
src/main/java/com/whyc/controller/SinfBinfController.java
@@ -16,10 +16,17 @@
    @Autowired
    private SinfBinfService service;
    @ApiOperation("查询左侧机房信息列表")
    @GetMapping("getAllSinfBinf")
    public Response getAllSinfBinf(){
        Response res=service.getAllSinfBinf();
    @ApiOperation("查询左侧电池机房信息列表")
    @GetMapping("getAllSinfBinf1")
    public Response getAllSinfBinf1(){
        Response res=service.getAllSinfBinf1();
        return res;
    }
    @ApiOperation("查询左侧电源机房信息列表")
    @GetMapping("getAllSinfBinf2")
    public Response getAllSinfBinf2(){
        Response res=service.getAllSinfBinf2();
        return res;
    }
}
src/main/java/com/whyc/mapper/SinfBinfMapper.java
@@ -6,6 +6,9 @@
import java.util.List;
public interface SinfBinfMapper extends CustomMapper<SinfBinf>{
    //查询左侧机房信息列表
    List<StationInf> getAllSinfBinf();
    //查询左侧电池机房信息列表
    List<StationInf> getAllSinfBinf1();
    //查询左侧电源机房信息列表
    List<StationInf> getAllSinfBinf2();
}
src/main/java/com/whyc/pojo/PowerInf.java
@@ -26,7 +26,7 @@
    @TableField("power_name")
    @ApiModelProperty("电源名称")
    private Date power_name;
    private String powerName;
    @TableField("mon_num")
    @ApiModelProperty("单体个数")
src/main/java/com/whyc/pojo/SinfBinf.java
@@ -32,4 +32,8 @@
    @TableField("group_index")
    @ApiModelProperty("机房内电池组编号")
    private Integer groupIndex;
    @TableField("stype")
    @ApiModelProperty("机房类型: 1<电池组> 2<电源>")
    private Integer stype;
}
src/main/java/com/whyc/pojo/StationInf.java
@@ -32,4 +32,7 @@
    @TableField(exist = false)
    private List<BattInf> binfList;
    @TableField(exist = false)
    private List<PowerInf> pinfList;
}
src/main/java/com/whyc/service/SinfBinfService.java
@@ -14,14 +14,25 @@
    @Autowired(required = false)
    private SinfBinfMapper mapper;
    /*查询左侧机房信息列表
    /*查询左侧电池机房信息列表
     * @param null 入参
     * @return null
     * @author lxw
     * @date 2024/6/15 9:41
     **/
    public Response getAllSinfBinf() {
        List<StationInf> list=mapper.getAllSinfBinf();
        return new Response().setII(1,list!=null,list,"左侧机房信息");
    public Response getAllSinfBinf1() {
        List<StationInf> list=mapper.getAllSinfBinf1();
        return new Response().setII(1,list!=null,list,"左侧电池机房信息");
    }
    /*查询左侧电源机房信息列表
     * @param null 入参
     * @return null
     * @author lxw
     * @date 2024/6/15 9:41
     **/
    public Response getAllSinfBinf2() {
        List<StationInf> list=mapper.getAllSinfBinf2();
        return new Response().setII(1,list!=null,list,"左侧电源机房信息");
    }
}
src/main/resources/mapper/SinfBinfMapper.xml
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.whyc.mapper.SinfBinfMapper">
    <resultMap id="sinfList" type="stationInf">
    <resultMap id="sinfList1" type="stationInf">
        <id property="sinfId" column="sinf_id"></id>
        <result property="sinfName" column="sinf_name"></result>
        <result property="sinfIp" column="sinf_ip"></result>
        <collection property="binfList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.BattInf" column="{sinfId=sinf_id}" select="selectBinfList">
        </collection>
    </resultMap>
    <select id="getAllSinfBinf" resultMap="sinfList">
         select * from db_batt.station_inf order by sinf_id asc
    <select id="getAllSinfBinf1" resultMap="sinfList1">
         select * from db_batt.station_inf where stype=1 or stype=0 order by sinf_id asc
    </select>
    <select id="selectBinfList" resultType="battInf">
        select batt_inf.* from db_batt.batt_inf,db_batt.sinf_binf
        <where>
@@ -19,4 +19,24 @@
            and sinf_binf.sinf_id=#{sinfId}
        </where>
    </select>
    <resultMap id="sinfList2" type="stationInf">
        <id property="sinfId" column="sinf_id"></id>
        <result property="sinfName" column="sinf_name"></result>
        <result property="sinfIp" column="sinf_ip"></result>
        <collection property="pinfList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.PowerInf" column="{sinfId=sinf_id}" select="selectPinfList">
        </collection>
    </resultMap>
    <select id="getAllSinfBinf2" resultMap="sinfList2">
        select * from db_batt.station_inf where stype=2 or stype=0 order by sinf_id asc
    </select>
    <select id="selectPinfList" resultType="powerInf">
        select power_inf.* from db_batt.power_inf,db_batt.sinf_pinf
        <where>
            power_inf.power_id=sinf_pinf.pinf_id
            and sinf_pinf.sinf_id=#{sinfId}
        </where>
    </select>
</mapper>