| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.StandardMethodListMapper; |
| | | import com.yuanchu.mom.mapper.StandardProductListMapper; |
| | | import com.yuanchu.mom.pojo.StandardMethodList; |
| | | import com.yuanchu.mom.pojo.StandardProductList; |
| | | import com.yuanchu.mom.service.StandardMethodListService; |
| | | import com.yuanchu.mom.mapper.StandardMethodListMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | private StandardProductListMapper standardProductListMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addStandardMethodList(Integer standardId, String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId); |
| | |
| | | @Override |
| | | public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | List<StandardMethodList> standardMethodLists = null; |
| | | List<StandardProductList> standardProductLists = null; |
| | | Map<String, List<?>> map = new HashMap<>(); |
| | | String str = ""; |
| | | List<StandardMethodList> standardMethodLists = new ArrayList<>(); |
| | | switch (trees.length){ |
| | | case 5: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],trees[4]); |
| | | standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2]).eq(StandardProductList::getSample, trees[3]).eq(StandardProductList::getModel, trees[4])); |
| | | str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\""; |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str)); |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\"")); |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); |
| | | break; |
| | | case 4: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],null); |
| | | standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2]).eq(StandardProductList::getSample, trees[3])); |
| | | str += "\"" + trees[2] + "\",\"" + trees[3] + "\""; |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str)); |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\"")); |
| | | break; |
| | | case 3: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],null,null); |
| | | standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2])); |
| | | str += "\"" + trees[2] + "\""; |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str)); |
| | | break; |
| | | case 2: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],null,null,null); |
| | | standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1])); |
| | | break; |
| | | case 1: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],null,null,null,null); |
| | | standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0])); |
| | | break; |
| | | default: |
| | | map.put("standardMethodList", null); |
| | | return map; |
| | | } |
| | | Map<String, List<?>> map = new HashMap<>(); |
| | | standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str)); |
| | | map.put("standardMethodList", standardMethodLists); |
| | | map.put("standardProductList", standardProductLists); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree) { |
| | | String[] trees = tree.split(" - "); |
| | | List<StandardMethodList> standardMethodLists = null; |
| | | switch (trees.length){ |
| | | case 5: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],trees[4]); |
| | | break; |
| | | case 4: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],null); |
| | | break; |
| | | case 3: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],null,null); |
| | | break; |
| | | case 2: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],null,null,null); |
| | | break; |
| | | case 1: |
| | | standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],null,null,null,null); |
| | | break; |
| | | } |
| | | Map<String, List<?>> map = new HashMap<>(); |
| | | map.put("standardMethodList", standardMethodLists); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int delStandardMethodByFLSSM(Integer id) { |
| | | standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id)); |
| | | return standardMethodListMapper.deleteById(id); |
| | | } |
| | | @Override |
| | | public List<StandardMethodList> selectStandardMethodEnum() { |
| | | return standardMethodListMapper.selectListEnum(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getStandardMethodId(String code) { |
| | | return baseMapper.getStandardMethodId(code); |
| | | } |
| | | } |
| | | |
| | | |