lxw
2023-05-25 f3c27fb78447449a950ba73c5e72ceda64ad8a12
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
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.whyc.dto.Response;
import com.whyc.mapper.PowerAlarmConfigMapper;
import com.whyc.pojo.PwrdevAlarmConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
@Service
public class PowerAlarmConfigService {
 
    @Resource
    private PowerAlarmConfigMapper mapper;
 
 
    public Response getInfo() {
        QueryWrapper<PwrdevAlarmConfig> query = Wrappers.query();
        query.last(" limit 1");
        PwrdevAlarmConfig config = mapper.selectOne(query);
        return new Response().set(1,config);
    }
 
    public Response update(PwrdevAlarmConfig config) {
        UpdateWrapper<PwrdevAlarmConfig> update = Wrappers.update();
        mapper.update(config,null);
        return new Response().setII(1,"更新完成");
    }
}