| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.vci.ubcs.code.entity.CodeReferConfig; |
| | | import com.vci.ubcs.code.entity.CodeResembleRule; |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.CodeReferConfigMapper; |
| | | import com.vci.ubcs.code.mapper.CodeResembleRuleMapper; |
| | | import com.vci.ubcs.code.service.ICodeResembleRuleService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeResembleRuleVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | |
| | | /** |
| | | * 相似查询规则服务 |
| | |
| | | * @date 2022-04-10 |
| | | */ |
| | | @Service |
| | | public class CodeResembleRuleServiceImpl implements ICodeResembleRuleService { |
| | | public class CodeResembleRuleServiceImpl extends MPJBaseServiceImpl<CodeResembleRuleMapper, CodeResembleRule> implements ICodeResembleRuleService { |
| | | @Override |
| | | public CodeResembleRuleVO getObjectByOid(String codeResembleRuleOid) { |
| | | return null; |
| | | public CodeResembleRuleVO getObjectByOid(String oid) { |
| | | return codeResembleRuleDO2VO(selectByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 主键查询数据对象 |
| | | * @param oid 主键 |
| | | * @return 数据对象 |
| | | * @throws VciBaseException 参数为空,并且数据不存在的时候会抛出异常 |
| | | */ |
| | | private CodeResembleRule selectByOid(String oid) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oid,"主键"); |
| | | CodeResembleRule codeResembleRuleDO = baseMapper.selectById(oid.trim()); |
| | | // CodeResembleRule codeResembleRuleDO = codeResembleRuleMapper.selectByPrimaryKey(oid.trim()); |
| | | if(codeResembleRuleDO == null || StringUtils.isBlank(codeResembleRuleDO.getOid())){ |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | return codeResembleRuleDO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 数据对象转换为显示对象 |
| | | * @param codeResembleRuleDO 数据对象 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 拷贝属性出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public CodeResembleRuleVO codeResembleRuleDO2VO(CodeResembleRule codeResembleRuleDO) throws VciBaseException{ |
| | | CodeResembleRuleVO vo = new CodeResembleRuleVO(); |
| | | if(codeResembleRuleDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeResembleRuleDO,vo); |
| | | //如果有lcstatus的类的话 |
| | | vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); |
| | | |
| | | } |
| | | return vo; |
| | | } |
| | | } |