houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
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
package com.iailab.module.device.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iailab.framework.common.service.impl.CrudServiceImpl;
import com.iailab.module.device.dao.DeviceRunStateDao;
import com.iailab.module.device.dto.DeviceRunStateDTO;
import com.iailab.module.device.entity.DeviceRunStateEntity;
import com.iailab.module.device.service.DeviceRunStateService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
 
import java.util.Map;
 
/**
 * 设备运行状态表
 *
 * @author lirm ${email}
 * @since 1.0.0 2024-05-22
 */
@Service
public class DeviceRunStateServiceImpl extends CrudServiceImpl<DeviceRunStateDao, DeviceRunStateEntity, DeviceRunStateDTO> implements DeviceRunStateService {
 
    @Override
    public QueryWrapper<DeviceRunStateEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
 
        QueryWrapper<DeviceRunStateEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
 
        return wrapper;
    }
 
 
    @Override
    public void insertRunState(Map<String, Integer> tMap) {
        int id = baseDao.getId();
        if(id == 0){
            baseDao.insertRunState(tMap);
        }else{
            tMap.put("id",id);
            baseDao.updateRunState(tMap);
        }
    }
}