package com.yuanchu.limslaboratory.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.yuanchu.limslaboratory.pojo.SerialNumber; import com.yuanchu.limslaboratory.mapper.SerialNumberMapper; import com.yuanchu.limslaboratory.service.SerialNumberService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.limslaboratory.service.StandardsService; import com.yuanchu.limslaboratory.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; /** *

* 服务实现类 *

* * @author 江苏鵷雏网络科技有限公司 * @since 2023-07-11 */ @Service public class SerialNumberServiceImpl extends ServiceImpl implements SerialNumberService { @Resource private SerialNumberMapper serialNumberMapper; @Autowired private UserService userService; @Autowired private StandardsService standardsService; @Override public Integer addSerialNumberInformation(SerialNumber serialNumber) { Boolean userIsNull = userService.userIsNull(serialNumber.getUserId()); if (userIsNull){ Boolean standardsIsNull = standardsService.standardsIsNull(serialNumber.getStandardsId()); if (!ObjectUtils.isEmpty(standardsIsNull)){ return serialNumberMapper.insert(serialNumber); } } return 0; } @Override public List> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(SerialNumber::getStandardsId, standardsId); wrapper.like(SerialNumber::getId, idOrNameOfSerialNumber); wrapper.or().like(SerialNumber::getName, idOrNameOfSerialNumber); wrapper.select(SerialNumber::getId, SerialNumber::getName); return serialNumberMapper.selectMaps(wrapper); } }