luxiaotao1123
2024-09-09 ea7e27ff897da58be02c14a6f18adbf387a56ee1
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
46
47
package com.zy.acs.manager.manager.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.acs.manager.manager.entity.Bus;
import com.zy.acs.manager.manager.enums.BusStsType;
import com.zy.acs.manager.manager.mapper.BusMapper;
import com.zy.acs.manager.manager.service.BusService;
import com.zy.acs.framework.common.Cools;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service("busService")
public class BusServiceImpl extends ServiceImpl<BusMapper, Bus> implements BusService {
 
    @Override
    public Bus selectByUuid(String uuid) {
        return this.getOne(new LambdaQueryWrapper<Bus>().eq(Bus::getUuid, uuid));
    }
 
    @Override
    public List<Bus> selectBySts(BusStsType busStsType) {
        return this.selectBySts(busStsType, null);
    }
 
    @Override
    public List<Bus> selectInSts(BusStsType... busStsTypes) {
        List<Long> params = new ArrayList<>();
        for (BusStsType busStsType : busStsTypes) {
            params.add(busStsType.val());
        }
        return this.list(new LambdaQueryWrapper<Bus>().in(Bus::getBusSts, params));
    }
 
    @Override
    public List<Bus> selectBySts(BusStsType busStsType, String memo) {
        LambdaQueryWrapper<Bus> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Bus::getBusSts, busStsType.val());
        if (!Cools.isEmpty(memo)) {
            wrapper.eq(Bus::getMemo, memo);
        }
        return this.list(wrapper);
    }
 
}