whycxzp
2025-06-11 920d98bebfc6625d277ca603ae8e9e9cbf31d11f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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(AlmDto almDto) {
        PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize());
        List<PwrdevAlarmParam> list = mapper.getPwrAlmParam(almDto);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"获取电源告警参数");
    }
    //修改电源告警参数
    public Response setPwrAlmParam(List<PwrdevAlarmParam> 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,"修改电源告警参数");
    }
}