liujie
2025-09-02 76bbe4207f2d623f5e893af92022460d6b763734
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmDeviceServiceImpl.java
@@ -1,10 +1,19 @@
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>
@@ -17,4 +26,33 @@
@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;
    }
}