liujie
5 天以前 4068eb1f7c50b37d816934b822116f45af182b0e
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
package com.ruoyi.system.service.impl;
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.TCrmDeviceMapper;
import com.ruoyi.system.model.TCrmDevice;
import com.ruoyi.system.model.TCrmDevice;
import com.ruoyi.system.model.TCrmPosition;
import com.ruoyi.system.query.TCrmDeviceQuery;
import com.ruoyi.system.service.TCrmDeviceService;
import com.ruoyi.system.vo.TCrmDeviceVO;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * <p>
 * crm设备管理 服务实现类
 * </p>
 *
 * @author xiaochen
 * @since 2025-08-20
 */
@Service
public class TCrmDeviceServiceImpl extends ServiceImpl<TCrmDeviceMapper, TCrmDevice> implements TCrmDeviceService {
 
    @Override
    public boolean isExit(TCrmDevice dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TCrmDevice.class).ne(TCrmDevice::getId, dto.getId()).eq(TCrmDevice::getDeviceCode, dto.getDeviceCode())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TCrmDevice.class).eq(TCrmDevice::getDeviceCode, dto.getDeviceCode())) > 0;
        }
    }
 
    @Override
    public boolean isBind(TCrmDevice dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TCrmDevice.class).ne(TCrmDevice::getId, dto.getId()).eq(TCrmDevice::getClinicId, dto.getClinicId())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TCrmDevice.class).eq(TCrmDevice::getClinicId, dto.getClinicId())) > 0;
        }
    }
 
    @Override
    public PageInfo<TCrmDeviceVO> pageList(TCrmDeviceQuery query) {
        PageInfo<TCrmDeviceVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TCrmDeviceVO> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords(list);
        return pageInfo;
    }
}