package com.ruoyi.jt.service.impl; import java.util.List; import com.ruoyi.jt.uuid.IdUtils; import io.netty.util.internal.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.jt.mapper.JtDeviceMapper; import com.ruoyi.jt.domain.JtDevice; import com.ruoyi.jt.service.IJtDeviceService; import org.yzh.web.model.entity.DeviceDO; /** * 终端Service业务层处理 * * @author ruoyi * @date 2025-03-21 */ @Service public class JtDeviceServiceImpl implements IJtDeviceService { @Autowired private JtDeviceMapper jtDeviceMapper; /** * 查询终端 * * @param id 终端主键 * @return 终端 */ @Override public JtDevice selectJtDeviceById(Long id) { return jtDeviceMapper.selectJtDeviceById(id); } /** * 查询终端列表 * * @param jtDevice 终端 * @return 终端 */ @Override public List selectJtDeviceList(JtDevice jtDevice) { return jtDeviceMapper.selectJtDeviceList(jtDevice); } /** * 新增终端 * * @param jtDevice 终端 * @return 结果 */ @Override public int insertJtDevice(JtDevice jtDevice) { jtDevice.setId(IdUtils.simpleUUID()); return jtDeviceMapper.insertJtDevice(jtDevice); } /** * 修改终端 * * @param jtDevice 终端 * @return 结果 */ @Override public int updateJtDevice(JtDevice jtDevice) { return jtDeviceMapper.updateJtDevice(jtDevice); } /** * 批量删除终端 * * @param ids 需要删除的终端主键 * @return 结果 */ @Override public int deleteJtDeviceByIds(Long[] ids) { return jtDeviceMapper.deleteJtDeviceByIds(ids); } /** * 删除终端信息 * * @param id 终端主键 * @return 结果 */ @Override public int deleteJtDeviceById(Long id) { return jtDeviceMapper.deleteJtDeviceById(id); } @Override public boolean isExistDevice(DeviceDO device) { if (!(StringUtil.isNullOrEmpty(device.getPlateNo()) || StringUtil.isNullOrEmpty(device.getMobileNo()))) { JtDevice jtDevice = new JtDevice(); jtDevice.setPlateNo(device.getPlateNo()); jtDevice.setClientId(device.getMobileNo()); List list = jtDeviceMapper.selectJtDeviceList(jtDevice); return list.size() > 0; } return false; } }