package com.yuanchu.mom.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.yuanchu.mom.pojo.Device; import com.yuanchu.mom.mapper.DeviceMapper; import com.yuanchu.mom.pojo.dto.DeviceDto; import com.yuanchu.mom.service.DeviceService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** *

* 服务实现类 *

* * @author 江苏鵷雏网络科技有限公司 * @since 2023-07-31 */ @Service public class DeviceServiceImpl extends ServiceImpl implements DeviceService { @Resource private DeviceMapper deviceMapper; //查询设备维护-->左侧列表设备组展示 @Override public List> deviceTwoTree(Integer type, String search_class) { return deviceMapper.deviceTwoTree(type, search_class); } //查询设备维护-->右侧列表展示该设备组下的所有设备 @Override public List> selectTreeDevice(Integer type, String father, Integer deviceStatus, String message) { return deviceMapper.selectTreeDevice(type, father, deviceStatus, message); } //新增仪器设备 @Override public Integer addDevice(DeviceDto deviceDto) { Device device = new Device(); BeanUtils.copyProperties(deviceDto, device); deviceMapper.insert(device); return device.getId(); } //根据分组查询设备名 @Override public List> getDeviceNameByGroup(String deviceGroup) { return deviceMapper.getDeviceNameByGroup(deviceGroup); } //查询所有设备编号和设备名称 @Override public List> selectDeviceIdAndName() { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.select(Device::getId, Device::getName, Device::getCode); return deviceMapper.selectMaps(wrapper); } //删除 @Override public void delDeviceById(Integer id) { Device device = new Device(); device.setId(id); device.setState(0); deviceMapper.updateById(device); } //批量删除 @Override public void delAllDevice(String ids) { deviceMapper.delAllDevice(ids); } //原材料检验-->选择设备 @Override public List> chooseDevice() { return deviceMapper.chooseDevice(); } }