lxw
2023-05-25 f3c27fb78447449a950ba73c5e72ceda64ad8a12
src/main/java/com/whyc/service/PowerInfService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
@@ -12,7 +13,6 @@
import javax.annotation.Resource;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service
public class PowerInfService {
@@ -125,7 +125,31 @@
    }
    //管理员首页:电源信息
    public Response<Map> getPwrdevInfAnalysis(int userId) {
        return new Response().set(1);
    public List<PowerInf> getPwrdevInfAnalysis(int userId) {
        List<PowerInf> list = mapper.getPwrdevInfAnalysis(userId);
        return list;
    }
    public Response updateExceptionCause(PowerInf powerInf) {
        //非空校验
        if(powerInf.getExceptionCause()==null || powerInf.getExceptionCause().isEmpty()){
            return new Response().set(1,false,"异常原因不能为空");
        }
        mapper.updateById(powerInf);
        return new Response().set(1,true,"填写完成");
    }
    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,"取消成功");
    }
    public Response getExceptionCause(int num) {
        QueryWrapper<PowerInf> query = Wrappers.query();
        query.select("StationName","PowerProducer","exception_cause","exception_cause_analysis").eq("num",num);
        PowerInf powerInf = mapper.selectOne(query);
        return new Response().set(1,powerInf);
    }
}