| | |
| | | package cn.lihu.jh.module.ecg.service.devmanage; |
| | | |
| | | import cn.lihu.jh.module.system.api.dict.DictDataApi; |
| | | import cn.lihu.jh.module.system.api.dict.dto.DictDataRespDTO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | |
| | | import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DevModelMapper; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; |
| | |
| | | |
| | | @Resource |
| | | private DevModelMapper devModelMapper; |
| | | |
| | | @Resource |
| | | private DictDataApi dictDataApi; |
| | | |
| | | @Override |
| | | public Integer createDevModel(DevModelSaveReqVO createReqVO) { |
| | |
| | | return devModelMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<OptionVO> getBrandOptions(String devCategory) { |
| | | List<String> list = devModelMapper.getBrandByCategory(devCategory); |
| | | |
| | | List<DictDataRespDTO> dictDataRespDTOList = dictDataApi.getDictDataList("ecg_dev_brand"); |
| | | Map<String, String> map = dictDataRespDTOList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel)); |
| | | |
| | | List<OptionVO> optionVOList = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | | OptionVO optionVO = new OptionVO(); |
| | | optionVO.setLabel( map.get(item) ); |
| | | optionVO.setValue( item ); |
| | | optionVOList.add( optionVO ); |
| | | }); |
| | | return optionVOList; |
| | | } |
| | | |
| | | @Override |
| | | public List<OptionVO> getBrandModelOptions(String devCategory, String devBrand) { |
| | | List<String> list = devModelMapper.getModelByCategoryBrand(devCategory, devBrand); |
| | | List<OptionVO> optionVOList = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | | OptionVO optionVO = new OptionVO(); |
| | | optionVO.setLabel( item ); |
| | | optionVO.setValue( item ); |
| | | optionVOList.add( optionVO ); |
| | | }); |
| | | return optionVOList; |
| | | } |
| | | |
| | | } |