lxw
2023-06-01 7a22433eae5550d49f8de54bdc77ab29a79fd59a
powerInf/getPwrInf
4个文件已修改
64 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/PowerInfController.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/PowerInfMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PowerInfService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/PowerInfMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/PowerInfController.java
@@ -1,7 +1,5 @@
package com.whyc.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.factory.BattinfGroupFactory;
import com.whyc.pojo.Battinf;
@@ -13,18 +11,12 @@
import com.whyc.service.PowerInfService;
import com.whyc.service.StationInfService;
import com.whyc.util.ActionUtil;
import com.whyc.util.CommonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.PipedWriter;
import java.util.List;
@RequestMapping("powerInf")
@RestController
@@ -189,16 +181,23 @@
        return service.updateExceptionCause(powerInf);
    }
    @ApiOperation(value = "取消异常原因",notes = "传入字段 num")
    @ApiOperation(value = "取消异常原因", notes = "传入字段 num")
    @PutMapping("cancelExceptionCause")
    public Response updateCancelExceptionCause(@RequestParam int num){
    public Response updateCancelExceptionCause(@RequestParam int num) {
        return service.updateCancelExceptionCause(num);
    }
    @ApiOperation(value = "查询异常原因",notes = "传入字段 num")
    @ApiOperation(value = "查询异常原因", notes = "传入字段 num")
    @GetMapping("exceptionCause")
    public Response getExceptionCause(@RequestParam int num){
    public Response getExceptionCause(@RequestParam int num) {
        return service.getExceptionCause(num);
    }
    @GetMapping("getPwrInf")
    @ApiOperation(value = "获取用户管理的机房")
    public Response getPwrInf() {
        UserInf userInf = (UserInf) ActionUtil.getUser();
        return service.getPwrInf(userInf.getUId());
    }
}
src/main/java/com/whyc/mapper/PowerInfMapper.java
@@ -21,14 +21,16 @@
    List<PowerInf> getExistStations(@Param("stationName1") String stationName1,@Param("stationName2")String stationName2,@Param("stationName5")String stationName5);
   // List<PowerInf> getPowerDevicesPage(@Param("uId")Long uId, @Param("powerInf") PowerInf powerInf);
    // List<PowerInf> getPowerDevicesPage(@Param("uId")Long uId, @Param("powerInf") PowerInf powerInf);
    List<PowerInf> getPowerDevicesPage(@Param("uId")Long uId, @Param("stationId") String stationId, @Param("stationName1") String stationName1, @Param("stationName2") String stationName2, @Param("stationName5") String stationName5);
    List<PowerInf> getPowerDevicesPage(@Param("uId") Long uId, @Param("stationId") String stationId, @Param("stationName1") String stationName1, @Param("stationName2") String stationName2, @Param("stationName5") String stationName5);
    List<PowerInf> getStations(@Param("uId")Long uId,@Param("stationName5")String stationName5);
    List<PowerInf> getStations(@Param("uId") Long uId, @Param("stationName5") String stationName5);
    int getNum(int userId);
    List<PowerInf> getPwrdevInfAnalysis(int userId);
    List<PowerInf> getPwrInf(Long userId);
}
src/main/java/com/whyc/service/PowerInfService.java
@@ -141,15 +141,20 @@
    public Response updateCancelExceptionCause(int num) {
        UpdateWrapper<PowerInf> update = Wrappers.update();
        update.set("exception_cause",null).set("exception_cause_analysis",null).eq("num",num);
        mapper.update(null,update);
        return new Response().setII(1,"取消成功");
        update.set("exception_cause", null).set("exception_cause_analysis", null).eq("num", num);
        mapper.update(null, update);
        return new Response().setII(1, "取消成功");
    }
    public Response getExceptionCause(int num) {
        QueryWrapper<PowerInf> query = Wrappers.query();
        query.select("StationName","PowerProducer","exception_cause","exception_cause_analysis").eq("num",num);
        query.select("StationName", "PowerProducer", "exception_cause", "exception_cause_analysis").eq("num", num);
        PowerInf powerInf = mapper.selectOne(query);
        return new Response().set(1,powerInf);
        return new Response().set(1, powerInf);
    }
    public Response getPwrInf(Long userId) {
        List<PowerInf> list = mapper.getPwrInf(userId);
        return new Response().set(1, list, "查询成功");
    }
}
src/main/resources/mapper/PowerInfMapper.xml
@@ -212,6 +212,24 @@
                              and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
                              and db_user.tb_user_inf.uid = #{userId})
    </select>
    <select id="getPwrInf" resultType="com.whyc.pojo.PowerInf">
        select distinct StationId,stationName1,stationName2,StationName3,stationName5 from db_pwrdev_inf.tb_pwrdev_inf p
        <where>
            <if test="uId!=null and uId!=0">
                and StationId in ( select distinct inf.StationId from
                (select StationId from db_battinf.tb_battinf union select StationId from db_pwrdev_inf.tb_pwrdev_inf )
                inf,
                db_user.tb_user_battgroup_baojigroup_battgroup,
                db_user.tb_user_battgroup_baojigroup_usr,
                db_user.tb_user_inf
                where db_user.tb_user_battgroup_baojigroup_battgroup.StationId=inf.StationId
                and
                db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
                and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid
                and db_user.tb_user_inf.uid=#{uId} )
            </if>
        </where>
    </select>
</mapper>