2026-06-24 f4bd1f3c89d906131495a0aca5aaf82966378510
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package cn.iocoder.yudao.module.iot.dal.mysql.ota;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record.IotOtaTaskRecordPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskRecordDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
 
import java.util.Collection;
import java.util.List;
import java.util.Set;
 
@Mapper
public interface IotOtaTaskRecordMapper extends BaseMapperX<IotOtaTaskRecordDO> {
 
    default List<IotOtaTaskRecordDO> selectListByFirmwareIdAndTaskId(Long firmwareId, Long taskId) {
        return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
                .eqIfPresent(IotOtaTaskRecordDO::getFirmwareId, firmwareId)
                .eqIfPresent(IotOtaTaskRecordDO::getTaskId, taskId)
                .select(IotOtaTaskRecordDO::getDeviceId, IotOtaTaskRecordDO::getStatus));
    }
 
    default PageResult<IotOtaTaskRecordDO> selectPage(IotOtaTaskRecordPageReqVO pageReqVO) {
        return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
                .eqIfPresent(IotOtaTaskRecordDO::getTaskId, pageReqVO.getTaskId())
                .eqIfPresent(IotOtaTaskRecordDO::getStatus, pageReqVO.getStatus()));
    }
 
    default List<IotOtaTaskRecordDO> selectListByTaskIdAndStatus(Long taskId, Collection<Integer> statuses) {
        return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
               .eq(IotOtaTaskRecordDO::getTaskId, taskId)
               .in(IotOtaTaskRecordDO::getStatus, statuses));
    }
 
    default Long selectCountByTaskIdAndStatus(Long taskId, Collection<Integer> statuses) {
        return selectCount(new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
                .eq(IotOtaTaskRecordDO::getTaskId, taskId)
                .in(IotOtaTaskRecordDO::getStatus, statuses));
    }
 
    default int updateByIdAndStatus(Long id, Integer status,
                                    IotOtaTaskRecordDO updateObj) {
        return update(updateObj, new LambdaUpdateWrapper<IotOtaTaskRecordDO>()
                .eq(IotOtaTaskRecordDO::getId, id)
                .eq(IotOtaTaskRecordDO::getStatus, status));
    }
 
    default int updateByIdAndStatus(Long id, Collection<Integer> whereStatuses,
                                    IotOtaTaskRecordDO updateObj) {
        return update(updateObj, new LambdaUpdateWrapper<IotOtaTaskRecordDO>()
                .eq(IotOtaTaskRecordDO::getId, id)
                .in(IotOtaTaskRecordDO::getStatus, whereStatuses));
    }
 
    default void updateListByIdAndStatus(Collection<Long> ids, Collection<Integer> whereStatuses,
                                         IotOtaTaskRecordDO updateObj) {
        update(updateObj, new LambdaUpdateWrapper<IotOtaTaskRecordDO>()
                .in(IotOtaTaskRecordDO::getId, ids)
                .in(IotOtaTaskRecordDO::getStatus, whereStatuses));
    }
 
    default List<IotOtaTaskRecordDO> selectListByDeviceIdAndStatus(Set<Long> deviceIds, Set<Integer> statuses) {
        return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
                .inIfPresent(IotOtaTaskRecordDO::getDeviceId, deviceIds)
                .inIfPresent(IotOtaTaskRecordDO::getStatus, statuses));
    }
 
    default List<IotOtaTaskRecordDO> selectListByDeviceIdAndStatus(Long deviceId, Set<Integer> statuses) {
        return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>()
                .eqIfPresent(IotOtaTaskRecordDO::getDeviceId, deviceId)
                .inIfPresent(IotOtaTaskRecordDO::getStatus, statuses));
    }
 
    default List<IotOtaTaskRecordDO> selectListByStatus(Integer status) {
        return selectList(IotOtaTaskRecordDO::getStatus, status);
    }
 
}