package com.whyc.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.whyc.dto.Real.AlmDto; import com.whyc.dto.Response; import com.whyc.mapper.BattAlmparamMapper; import com.whyc.pojo.db_param.BattAlmparam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class BattAlmparamService { @Autowired(required = false) private BattAlmparamMapper mapper; //获取电池告警参数 public Response getBattAlmParam(Integer battgroupId) { QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("battgroup_id",battgroupId); wrapper.orderByAsc("alm_id"); List list = mapper.selectList(wrapper); return new Response().setII(1,list!=null,list,"获取电池告警参数"); } //修改电池告警参数 public Response setBattAlmParam(List almparamList) { for (BattAlmparam param:almparamList) { UpdateWrapper wrapper=new UpdateWrapper(); wrapper.eq("battgroup_id",param.getBattgroupId()); wrapper.eq("alm_id",param.getAlmId()); mapper.update(param,wrapper); } return new Response().set(1,true,"修改电池告警参数"); } }