package com.whyc.service; 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.AlarmParam; import com.whyc.dto.Real.AlmDto; import com.whyc.dto.Response; import com.whyc.mapper.PwrdevAlarmParamMapper; import com.whyc.pojo.db_param.BattAlmparam; import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; import com.whyc.util.ActionUtil; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @Service public class PwrdevAlarmParamService { @Autowired(required = false) private PwrdevAlarmParamMapper mapper; //获取电源告警参数 public Response getPwrAlmParam(Integer powerId) { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("power_id",powerId); wrapper.orderByAsc("alm_id"); List list = mapper.selectList(wrapper); return new Response().setII(1,list!=null,list,"获取电源告警参数"); } //修改电源告警参数 public Response setPwrAlmParam(List almparamList) { for (PwrdevAlarmParam param:almparamList) { UpdateWrapper wrapper=new UpdateWrapper(); wrapper.eq("power_id",param.getPowerId()); wrapper.eq("alm_id",param.getAlmId()); mapper.update(param,wrapper); } return new Response().set(1,true,"修改电源告警参数"); } }