| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.constant.MdmBtmTypeConstant; |
| | | |
| | | import com.vci.ubcs.code.dto.CodeFixedValueDTO; |
| | | import com.vci.ubcs.code.entity.CodeFixedValue; |
| | | import com.vci.ubcs.code.mapper.CodeFixedValueMapper; |
| | |
| | | import com.vci.ubcs.code.wrapper.CodeFixedValueWrapper; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据codeFixedSecOid查询码值 |
| | | * @param codeFixedSecOids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CodeFixedValue> listFixedValueByCodeFixedSecOid(List<String> codeFixedSecOids){ |
| | | if(codeFixedSecOids.isEmpty()){ |
| | | return new ArrayList<CodeFixedValue>(); |
| | | } |
| | | /*List<CodeFixedValue> codeFixedValues = codeFixedValueMapper.selectList( |
| | | Wrappers.<CodeFixedValue>query().lambda() |
| | | .in(CodeFixedValue::getCodeFixedSecOid, codeFixedSecOids) |
| | | );*/ |
| | | List<CodeFixedValue> codeFixedValues = codeFixedValueMapper.selectByPageByCodeFixedSecOid(codeFixedSecOids, new Page<>(1, -1)); |
| | | return codeFixedValues; |
| | | } |
| | | |
| | | /** |
| | | * 根据关联固定码段主键删除码值 |
| | | * @param codeFixedSecOid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Boolean deleteFixedValueBySecOid(String codeFixedSecOid) { |
| | | LambdaQueryWrapper<CodeFixedValue> wrapper = Wrappers.<CodeFixedValue>query() |
| | | .lambda().eq(CodeFixedValue::getCodeFixedSecOid, codeFixedSecOid); |
| | | return codeFixedValueMapper.delete(wrapper)>0; |
| | | } |
| | | |
| | | /** |
| | | * 增加固定码段的码值 |
| | | * @param codeFixedValueDTO 固定码段的码值数据传输对象 |
| | | * @return 执行结果 |
| | |
| | | CodeFixedValue codeFixedValueDO = new CodeFixedValue(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeFixedValueDTO,codeFixedValueDO); |
| | | //填充一些默认值 |
| | | codeFixedValueDO.setOid(VciBaseUtil.getPk()); |
| | | codeFixedValueDO.setRevisionOid(VciBaseUtil.getPk()); |
| | | codeFixedValueDO.setNameOid(VciBaseUtil.getPk()); |
| | | codeFixedValueDO.setBtmname(MdmBtmTypeConstant.CODE_FIXED_VALUE); |
| | | codeFixedValueDO.setCreateTime(new Date()); |
| | | codeFixedValueDO.setCreator(AuthUtil.getUserId().toString()); |
| | | codeFixedValueDO.setLastModifier(AuthUtil.getUserId().toString()); |
| | | codeFixedValueDO.setLastModifyTime(new Date()); |
| | | codeFixedValueDO.setTs(new Date()); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeFixedValueDO, MdmBtmTypeConstant.CODE_FIXED_VALUE); |
| | | Long count = this.codeFixedValueMapper.selectCount(Wrappers.<CodeFixedValue>query() |
| | | .lambda().eq(CodeFixedValue::getCodeFixedSecOid, codeFixedValueDO.getCodeFixedSecOid()) |
| | | )+1L; |
| | |
| | | CodeFixedValue codeFixedValueDO = selectByOid(codeFixedValueDTO.getOid()); |
| | | revisionModelUtil.copyFromDTOIgnore(codeFixedValueDTO,codeFixedValueDO); |
| | | //填充一些默认值 |
| | | codeFixedValueDO.setLastModifier(AuthUtil.getUserId().toString()); |
| | | codeFixedValueDO.setLastModifyTime(new Date()); |
| | | codeFixedValueDO.setTs(new Date()); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeFixedValueDO); |
| | | boolean resBoolean = codeFixedValueMapper.updateById(codeFixedValueDO) > 0; |
| | | return resBoolean; |
| | | } |
| | |
| | | List<CodeFixedValue> doList = codeFixedValueMapper.selectList(Wrappers.<CodeFixedValue>query() |
| | | .lambda().eq(CodeFixedValue::getCodeFixedSecOid,codefixedsecoid) |
| | | ); |
| | | if(doList.isEmpty()){ |
| | | return false; |
| | | } |
| | | boolean resBoolean = codeFixedValueMapper.deleteBatchIds(doList.stream().map(CodeFixedValue::getOid).collect(Collectors.toList())) > 0; |
| | | return resBoolean; |
| | | } |
| | | |
| | | |
| | | } |