XiaoRuby
2023-07-17 0042c9bee29a876a754e4d542bfba956822e7844
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-11
 */
@Service
public class StandardsServiceImpl extends ServiceImpl<StandardsMapper, Standards> 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<Map<String, Object>>  listStandardsInformation(String IdOrNameOfStandards) {
        return standardsMapper.listStandardsInformation(IdOrNameOfStandards);
    }
 
    @Override
    public Boolean standardsIsNull(String Id) {
        LambdaQueryWrapper<Standards> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Standards::getId, Id);
        Standards standardsIsNull = standardsMapper.selectOne(wrapper);
        return !ObjectUtils.isEmpty(standardsIsNull);
    }
}