/*
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
* Redistributions in binary form must reproduce the above copyright
|
* notice, this list of conditions and the following disclaimer in the
|
* documentation and/or other materials provided with the distribution.
|
* Neither the name of the dreamlu.net developer nor the names of its
|
* contributors may be used to endorse or promote products derived from
|
* this software without specific prior written permission.
|
* Author: Chill 庄骞 (smallchill@163.com)
|
*/
|
package com.vci.ubcs.code.service.impl;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.vci.ubcs.code.entity.CodeClstempattrEntity;
|
import com.vci.ubcs.code.mapper.CodeClstempattrMapper;
|
import com.vci.ubcs.code.service.ICodeClstempattrService;
|
import com.vci.ubcs.code.vo.CodeClstempattrVO;
|
|
import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
|
import com.vci.ubcs.starter.web.util.BeanUtilForVCI;
|
import com.vci.ubcs.starter.web.util.VciBaseUtil;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.Collection;
|
import java.util.List;
|
|
/**
|
* 编码库定义-模板属性 服务实现类
|
*
|
* @author yuxc
|
* @since 2023-04-19
|
*/
|
@Service
|
public class CodeClstempattrServiceImpl extends ServiceImpl<CodeClstempattrMapper, CodeClstempattrEntity> implements ICodeClstempattrService {
|
|
@Resource
|
CodeClstempattrMapper codeClstempattrMapper;
|
|
@Override
|
public IPage<CodeClstempattrVO> selectCodeClstempattrPage(IPage<CodeClstempattrVO> page, CodeClstempattrVO CodeClstempattr) {
|
return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr));
|
}
|
|
|
/**
|
* 使用模板的主键获取模板的属性--批量
|
*
|
* @param templateOidCollection 模板的主键
|
* @return 属性的信息
|
*/
|
@Override
|
public List<CodeClstempattrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) {
|
if(CollectionUtils.isEmpty(templateOidCollection)){
|
return new ArrayList<>();
|
}
|
List<CodeClstempattrEntity> attrDOList = new ArrayList<>();
|
VciBaseUtil.switchCollectionForOracleIn(templateOidCollection).stream().forEach(templateOids->{
|
// Map<String,String> conditionMap = new HashMap<>();
|
// conditionMap.put("classifytemplateoid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(templateOids.toArray(new String[0])) + ")");
|
// PageHelper pageHelper = new PageHelper(-1);
|
// pageHelper.addDefaultAsc("orderNum");
|
List<CodeClstempattrEntity> attrDOS = baseMapper.selectByClassifytemplateoid(VciBaseUtil.toInSql(templateOids.toArray(new String[0])));
|
|
if(!CollectionUtils.isEmpty(attrDOS)){
|
attrDOList.addAll(attrDOS);
|
}
|
});
|
return codeClassifyTemplateAttrDO2VOs(attrDOList);
|
}
|
|
/**
|
* 批量数据对象转换为显示对象
|
* @param codeClassifyTemplateAttrDOs 数据对象列表
|
* @return 显示对象
|
*/
|
@Override
|
public List<CodeClstempattrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClstempattrEntity> codeClassifyTemplateAttrDOs){
|
List<CodeClstempattrVO> voList = new ArrayList<CodeClstempattrVO>();
|
if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){
|
for(CodeClstempattrEntity s: codeClassifyTemplateAttrDOs){
|
CodeClstempattrVO vo = codeClassifyTemplateAttrDO2VO(s);
|
if(vo != null){
|
voList.add(vo);
|
}
|
}
|
}
|
return voList;
|
}
|
|
/**
|
* 数据对象转换为显示对象
|
* @param codeClassifyTemplateAttrDO 数据对象
|
* @return 显示对象
|
*/
|
@Override
|
public CodeClstempattrVO codeClassifyTemplateAttrDO2VO(CodeClstempattrEntity codeClassifyTemplateAttrDO){
|
CodeClstempattrVO vo = new CodeClstempattrVO();
|
if(codeClassifyTemplateAttrDO != null){
|
BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo);
|
//如果有lcstatus的类的话
|
vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributedatatype()));
|
}
|
return vo;
|
}
|
}
|