whycxzp
2023-12-22 6320368558f548b4a3a07228e52d5ebed4818401
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
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.mapper.CKPowerDevBattRtStateMapper;
import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtState;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class CKPowerDevBattRtStateService {
 
    @Resource
    private CKPowerDevBattRtStateMapper mapper;
 
    public CKPowerDevBattRtState get(Integer battIndex) {
        QueryWrapper<CKPowerDevBattRtState> query = Wrappers.query();
        if(battIndex!=null) {
            if(battIndex == -1) { //首页上使用,默认只查组1
                query.eq("batt_index", 0);
            }else{
                query.eq("batt_index", battIndex);
            }
        }
        query.last(" limit 1");
        return mapper.selectOne(query);
    }
}