李林
2024-03-04 467697f78bf5c953a81a978e5f2e67737de45569
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
package com.yuanchu.mom.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.pojo.StandardMethodList;
import com.yuanchu.mom.service.StandardMethodListService;
import com.yuanchu.mom.mapper.StandardMethodListMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.Map;
 
/**
* @author Administrator
* @description 针对表【standard_method_list(标准树下的标准列表)】的数据库操作Service实现
* @createDate 2024-03-04 13:44:04
*/
@Service
@AllArgsConstructor
public class StandardMethodListServiceImpl extends ServiceImpl<StandardMethodListMapper, StandardMethodList>
    implements StandardMethodListService{
 
    private StandardMethodListMapper standardMethodListMapper;
 
    @Override
    public int addStandardMethodList(Integer standardId, String tree) {
        String[] trees = tree.split(" - ");
        Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId);
        StandardMethodList list = new StandardMethodList();
        list.setCode(map.get("code"));
        list.setName(map.get("name"));
        list.setRemark(map.get("remark"));
        list.setFactory(trees[0]);
        list.setLaboratory(trees[1]);
        list.setSample_type(trees[2]);
        list.setSample(trees[3]);
        try {
            list.setModel(trees[4]);
        }catch (Exception e){}
        return standardMethodListMapper.insert(list);
    }
}