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

* 服务实现类 *

* * @author 江苏鵷雏网络科技有限公司 * @since 2023-07-11 */ @Service public class StandardsServiceImpl extends ServiceImpl implements StandardsService { @Resource private StandardsMapper standardsMapper; @Autowired private UserService userService; @Override public Integer addStandardsInformation(Standards standards) { Boolean userIsNull = userService.userIsNull(standards.getUserId()); if (userIsNull){ return standardsMapper.insert(standards); } return 0; } @Override public List> listStandardsInformation(String IdOrNameOfStandards) { return standardsMapper.listStandardsInformation(IdOrNameOfStandards); } @Override public Boolean standardsIsNull(String Id) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(Standards::getId, Id); Standards standardsIsNull = standardsMapper.selectOne(wrapper); return !ObjectUtils.isEmpty(standardsIsNull); } }