| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.vos.BcDictionaryItemVO; |
| | | import com.panzhihua.common.model.vos.BcDictionaryVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.CopyUtil; |
| | | import com.panzhihua.service_community.dao.BcDictionaryItemDAO; |
| | | import com.panzhihua.service_community.model.dos.BcDictionaryItemDO; |
| | | import com.panzhihua.service_community.service.BcDictionaryService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | public R<List<BcDictionaryVO>> getDictionaryByKey(String key) { |
| | | List<BcDictionaryItemDO> list = baseMapper.getDictionaryByKey(key); |
| | | List<BcDictionaryVO> listVO = new ArrayList<>(); |
| | | for (BcDictionaryItemDO dictionaryItemDO:list){ |
| | | for (BcDictionaryItemDO dictionaryItemDO : list) { |
| | | BcDictionaryVO bcDictionaryVO = new BcDictionaryVO(); |
| | | bcDictionaryVO.setCode(dictionaryItemDO.getMnemonicCode()); |
| | | bcDictionaryVO.setDictName(dictionaryItemDO.getDictItemName()); |
| | |
| | | } |
| | | return R.ok(listVO); |
| | | } |
| | | |
| | | @Override |
| | | public BcDictionaryItemVO getByCode(String dictId, String code) { |
| | | BcDictionaryItemDO dictionaryItemDO = baseMapper.selectOne( |
| | | new QueryWrapper<BcDictionaryItemDO>() |
| | | .eq("dict_id", dictId) |
| | | .eq("dict_value", code) |
| | | ); |
| | | if (dictionaryItemDO != null) { |
| | | return CopyUtil.copyProperties(dictionaryItemDO, BcDictionaryItemVO.class); |
| | | } |
| | | return null; |
| | | } |
| | | } |