¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | |
| | | import com.vci.ubcs.code.dto.CodeClassifyTemplateButtonDTO; |
| | | import com.vci.ubcs.code.entity.*; |
| | | import com.vci.ubcs.code.enumpack.CodeButtonUseEnum; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyTemplateButtonMapper; |
| | | import com.vci.ubcs.code.service.ICodeButtonService; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateButtonService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateButtonVO; |
| | | import com.vci.ubcs.code.wrapper.CodeTempbuttonWrapper; |
| | | 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.util.UBCSCondition; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | import com.vci.ubcs.starter.web.util.BeanUtil; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cglib.beans.BeanMap; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.FrameWorkLangCodeConstant.*; |
| | | |
| | | /** |
| | | * ç¼ç åºå®ä¹-æ¨¡æ¿æé®æ©å± æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-04-20 |
| | | */ |
| | | @Service |
| | | public class CodeClassifyTemplateButtonServiceImpl extends ServiceImpl<CodeClassifyTemplateButtonMapper, CodeClassifyTemplateButton> implements ICodeClassifyTemplateButtonService { |
| | | |
| | | /** |
| | | * æ°æ®æä½å± |
| | | */ |
| | | @Autowired |
| | | private CodeClassifyTemplateButtonMapper codeClassifyTemplateButtonMapper; |
| | | |
| | | /** |
| | | * æé®çæå¡ |
| | | */ |
| | | @Autowired |
| | | private ICodeButtonService buttonService; |
| | | |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Autowired |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºé模æ¿å
å«çæé® |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public IPage<CodeClassifyTemplateButtonVO> gridCodeClassifyTemplateButton(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException { |
| | | Query query = new Query(); |
| | | if (pageHelper == null) { |
| | | query.setSize(-1); |
| | | }else { |
| | | query.setSize(pageHelper.getLimit()); |
| | | query.setCurrent(pageHelper.getPage()); |
| | | } |
| | | query.setDescs("createTime"); |
| | | if(StringUtils.isBlank(conditionMap.getOrDefault("classifyTemplateOid",null))){ |
| | | return new Page<>(); |
| | | } |
| | | |
| | | IPage<CodeClassifyTemplateButton> doList = codeClassifyTemplateButtonMapper.selectPage(Condition.getPage(query),getMPJLambdaWrapper(conditionMap)); |
| | | IPage<CodeClassifyTemplateButtonVO> voList = new Page<>(); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | voList = CodeTempbuttonWrapper.build().pageVO(doList); |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateButtonDOs æ°æ®å¯¹è±¡å表 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateButtonVO> codeClassifyTemplateButtonDO2VOs(Collection<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOs) throws VciBaseException{ |
| | | return codeClassifyTemplateButtonDO2VOs(codeClassifyTemplateButtonDOs,false); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateButtonDOs æ°æ®å¯¹è±¡å表 |
| | | * @param hasButtonVO æ¯å¦å
嫿é®çä¿¡æ¯ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateButtonVO> codeClassifyTemplateButtonDO2VOs(Collection<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOs, boolean hasButtonVO) throws VciBaseException{ |
| | | List<CodeClassifyTemplateButtonVO> voList = new ArrayList<CodeClassifyTemplateButtonVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateButtonDOs)){ |
| | | for(CodeClassifyTemplateButton s: codeClassifyTemplateButtonDOs){ |
| | | CodeClassifyTemplateButtonVO vo = codeClassifyTemplateButtonDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | if(hasButtonVO && !CollectionUtils.isEmpty(voList)){ |
| | | //è·åæé®çæ¾ç¤ºå¯¹è±¡ |
| | | List<CodeButtonVO> buttonVOList = new ArrayList<>(); |
| | | VciBaseUtil.switchCollectionForOracleIn(voList.stream().map(CodeClassifyTemplateButtonVO::getClassifyButtonOid).collect(Collectors.toList())).stream().forEach(buttonOids->{ |
| | | buttonVOList.addAll(buttonService.listCodeButtonByOids(buttonOids)); |
| | | }); |
| | | Map<String, CodeButtonVO> buttonVOMap = Optional.ofNullable(buttonVOList).orElseGet(() -> new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | voList.stream().forEach(vo->{ |
| | | vo.setButtonVO(buttonVOMap.getOrDefault(vo.getClassifyButtonOid(),null)); |
| | | }); |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateButtonDO æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ·è´å±æ§åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateButtonVO codeClassifyTemplateButtonDO2VO(CodeClassifyTemplateButton codeClassifyTemplateButtonDO) throws VciBaseException{ |
| | | CodeClassifyTemplateButtonVO vo = new CodeClassifyTemplateButtonVO(); |
| | | if(codeClassifyTemplateButtonDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateButtonDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setButtonUseText(CodeButtonUseEnum.getTextByValue(codeClassifyTemplateButtonDO.getButtonUse())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CodeClassifyTemplateButtonVO> selectCodeTempbuttonPage(IPage<CodeClassifyTemplateButtonVO> page, CodeClassifyTemplateButtonVO CodeTempbutton) { |
| | | return page.setRecords(baseMapper.selectCodeTempbuttonPage(page, CodeTempbutton)); |
| | | } |
| | | |
| | | /** |
| | | * å¢å 主é¢åºé模æ¿å
å«çæé® |
| | | * @param codeClassifyTemplateButtonDTO 主é¢åºé模æ¿å
å«çæé®æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¯ä¸é¡¹ï¼å¿
è¾é¡¹ä¸éè¿æ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CodeClassifyTemplateButtonVO addSave(CodeClassifyTemplateButtonDTO codeClassifyTemplateButtonDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateButtonDTO,"éè¦æ·»å çæ°æ®å¯¹è±¡",codeClassifyTemplateButtonDTO.getClassifyTemplateOid(),"模æ¿ç主é®"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClassifyTemplateButton codeClassifyTemplateButtonDO = new CodeClassifyTemplateButton(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateButtonDTO,codeClassifyTemplateButtonDO); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyTemplateButtonDO, MdmBtmTypeConstant.CODE_TEMPLATE_BUTTON); |
| | | if(codeClassifyTemplateButtonDO.getOrderNum()== null){ |
| | | //æ¥è¯¢å
¨é¨ |
| | | Long count = codeClassifyTemplateButtonMapper.selectCount(Wrappers.<CodeClassifyTemplateButton>query() |
| | | .lambda().eq(CodeClassifyTemplateButton::getClassifyTemplateOid,codeClassifyTemplateButtonDTO.getClassifyTemplateOid()) |
| | | ); |
| | | if(count == null){ |
| | | count = 0L; |
| | | } |
| | | codeClassifyTemplateButtonDO.setOrderNum(Long.valueOf(count + 1L).intValue()); |
| | | } |
| | | boolean resInsertClsTempButton = codeClassifyTemplateButtonMapper.insert(codeClassifyTemplateButtonDO) > 0; |
| | | return resInsertClsTempButton ? codeClassifyTemplateButtonDO2VO(codeClassifyTemplateButtonDO):null; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºé模æ¿å
å«çæé® |
| | | * @param codeClassifyTemplateButtonDTO 主é¢åºé模æ¿å
å«çæé®æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¯ä¸é¡¹ï¼å¿
è¾é¡¹ä¸éè¿æ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public CodeClassifyTemplateButtonVO editSave(CodeClassifyTemplateButtonDTO codeClassifyTemplateButtonDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateButtonDTO,"æ°æ®å¯¹è±¡",codeClassifyTemplateButtonDTO.getOid(),"主é¢åºé模æ¿å
å«çæé®ä¸»é®"); |
| | | //å°DTO转æ¢ä¸ºDO |
| | | CodeClassifyTemplateButton codeClassifyTemplateButtonDO = selectByOid(codeClassifyTemplateButtonDTO.getOid()); |
| | | revisionModelUtil.copyFromDTOIgnore(codeClassifyTemplateButtonDTO,codeClassifyTemplateButtonDO); |
| | | DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeClassifyTemplateButtonDO); |
| | | boolean resUpdateClsTempButton = codeClassifyTemplateButtonMapper.updateById(codeClassifyTemplateButtonDO) > 0; |
| | | return resUpdateClsTempButton ? codeClassifyTemplateButtonDO2VO(codeClassifyTemplateButtonDO):null; |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºé模æ¿å
å«çæé® |
| | | * @param codeClassifyTemplateButtonDTO 主é¢åºé模æ¿å
å«çæé®æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼è¢«å¼ç¨æ¶æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteCodeClassifyTemplateButton(CodeClassifyTemplateButtonDTO codeClassifyTemplateButtonDTO) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(codeClassifyTemplateButtonDTO,"主é¢åºé模æ¿å
å«çæé®æ°æ®å¯¹è±¡",codeClassifyTemplateButtonDTO.getOid(),"主é¢åºé模æ¿å
å«çæé®ç主é®"); |
| | | CodeClassifyTemplateButton codeClassifyTemplateButtonDO = selectByOid(codeClassifyTemplateButtonDTO.getOid()); |
| | | R baseResult = checkIsCanDeleteForDO(codeClassifyTemplateButtonDTO,codeClassifyTemplateButtonDO); |
| | | if(baseResult.isSuccess()) { |
| | | }else{ |
| | | return baseResult; |
| | | } |
| | | //æ§è¡å é¤æä½ |
| | | boolean b = codeClassifyTemplateButtonMapper.deleteById(codeClassifyTemplateButtonDO.getOid()) > 0; |
| | | return R.status(b); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | * @param codeClassifyTemplateButtonDTO æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @param codeClassifyTemplateButtonDO æ°æ®åºä¸çæ°æ®å¯¹è±¡ |
| | | * @return success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | private R checkIsCanDeleteForDO(CodeClassifyTemplateButtonDTO codeClassifyTemplateButtonDTO, CodeClassifyTemplateButton codeClassifyTemplateButtonDO) { |
| | | CodeClassifyTemplateButton tsDO = new CodeClassifyTemplateButton(); |
| | | BeanUtil.convert(codeClassifyTemplateButtonDTO,tsDO); |
| | | if (!checkTs(tsDO,codeClassifyTemplateButtonDO)) { |
| | | return R.fail(TS_NOT_PROCESS); |
| | | } |
| | | if(!checkIsLinked(codeClassifyTemplateButtonDO.getOid())) { |
| | | return R.success("success"); |
| | | }else{ |
| | | return R.fail(DATA_LINKED_NOT_DELETE); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥ts |
| | | * @param tempDO |
| | | * @param codeClassifyTemplateButtonDO |
| | | * @return |
| | | */ |
| | | private boolean checkTs(CodeClassifyTemplateButton tempDO,CodeClassifyTemplateButton codeClassifyTemplateButtonDO){ |
| | | Date dbTs = codeClassifyTemplateButtonDO.getTs(); |
| | | Date currentTs = tempDO.getTs(); |
| | | if(currentTs == null ? dbTs == null:currentTs.compareTo(dbTs)==0){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * è·åè¿è¡¨æ¥è¯¢æ¡ä»¶å¯¹è±¡ |
| | | * @param conditionMap |
| | | * @return |
| | | */ |
| | | private MPJLambdaWrapper<CodeClassifyTemplateButton> getMPJLambdaWrapper(Map<String,String> conditionMap){ |
| | | CodeClassifyTemplateButton codeClassifyTemplateButton = new CodeClassifyTemplateButton(); |
| | | BeanMap beanMap = BeanMap.create(codeClassifyTemplateButton); |
| | | beanMap.putAll(conditionMap); |
| | | MPJLambdaWrapper<CodeClassifyTemplateButton> mpjLambdaWrapper = UBCSCondition.getMPJLambdaWrapper(codeClassifyTemplateButton) |
| | | .selectAll(CodeClassifyTemplateButton.class) |
| | | .selectAs(CodeButton::getName, CodeClassifyTemplateButton::getClassifyButtonOidName) |
| | | .selectAs(CodeButton::getId, CodeClassifyTemplateButton::getClassifyButtonId) |
| | | .leftJoin(CodeButton.class, CodeButton::getOid, CodeClassifyTemplateButton::getClassifyButtonOid); |
| | | return mpjLambdaWrapper; |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºé模æ¿å
å«çæé® |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºé模æ¿å
å«çæé®æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸å卿¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateButtonVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyTemplateButtonDO2VO(selectByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºé模æ¿å
å«çæé® |
| | | * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºé模æ¿å
å«çæé®æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ¥è¯¢åºç°å¼å¸¸æ¶ä¼æåº |
| | | */ |
| | | @Override |
| | | public Collection<CodeClassifyTemplateButtonVO> listCodeClassifyTemplateButtonByOids(Collection<String> oidCollections) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); |
| | | List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = listCodeClassifyTemplateButtonDOByOidCollections(oidCollections); |
| | | return codeClassifyTemplateButtonDO2VOs(codeClassifyTemplateButtonDOList); |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºé模æ¿å
å«çæé®å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºé模æ¿å
å«çæé®æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public IPage<CodeClassifyTemplateButtonVO> refDataGridCodeClassifyTemplateButton(Map<String, String> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | if(conditionMap == null){ |
| | | conditionMap = new HashMap<String, String>(); |
| | | } |
| | | return gridCodeClassifyTemplateButton(conditionMap, pageHelper); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oidCollections 主é®çéå |
| | | * @return æ°æ®å¯¹è±¡å表 |
| | | */ |
| | | private List<CodeClassifyTemplateButton> listCodeClassifyTemplateButtonDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeClassifyTemplateButton> codeClassifyTemplateButtonDOList = new ArrayList<CodeClassifyTemplateButton>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeClassifyTemplateButton> tempDOList = codeClassifyTemplateButtonMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeClassifyTemplateButtonDOList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeClassifyTemplateButtonDOList; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦è¢«å¼ç¨ |
| | | * @param oid ä¸»é® |
| | | * @throws VciBaseException 被å¼ç¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private boolean checkIsLinked(String oid) throws VciBaseException{ |
| | | //TODO æ·»å éè¦æ ¡éªå¼ç¨çå°æ¹ |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼å¹¶ä¸æ°æ®ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | private CodeClassifyTemplateButton selectByOid(String oid) throws VciBaseException{ |
| | | VciBaseUtil.alertNotNull(oid,"主é®"); |
| | | HashMap<String, String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("oid",oid); |
| | | MPJLambdaWrapper<CodeClassifyTemplateButton> mpjLambdaWrapper = getMPJLambdaWrapper(conditionMap); |
| | | CodeClassifyTemplateButton codeClassifyTemplateButtonDO = codeClassifyTemplateButtonMapper.selectOne(mpjLambdaWrapper); |
| | | if(codeClassifyTemplateButtonDO == null || StringUtils.isBlank(codeClassifyTemplateButtonDO.getOid())){ |
| | | throw new VciBaseException(DATA_OID_NOT_EXIST); |
| | | } |
| | | return codeClassifyTemplateButtonDO; |
| | | } |
| | | |
| | | /** |
| | | * 模æ¿å é¤çæ¶å触å |
| | | * |
| | | * @param classifyTemplateOid 模æ¿çä¸»é® |
| | | * @return åå½±åçæ°æ®è¡ |
| | | */ |
| | | @Override |
| | | public int codeTemplateDeleteTrigger(String classifyTemplateOid) { |
| | | int updateCount = 0; |
| | | if(StringUtils.isNotBlank(classifyTemplateOid)){ |
| | | Map<String,Object> conditionMap = new HashMap<>(); |
| | | conditionMap.put("classifyTemplateOid",classifyTemplateOid); |
| | | List<CodeClassifyTemplateButton> codeTempbuttonEntities = baseMapper.selectByMap(conditionMap); |
| | | if(!CollectionUtils.isEmpty(codeTempbuttonEntities)){ |
| | | updateCount += baseMapper.deleteBatchIds(codeTempbuttonEntities.stream() |
| | | .map(CodeClassifyTemplateButton::getOid).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | return updateCount; |
| | | } |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¨¡æ¿ä¸»é®è·åæ©å±çæé® |
| | | * |
| | | * @param templateOid 模æ¿çä¸»é® |
| | | * @param hasButtonVO æ¯å¦å
嫿é®çæ¾ç¤ºä¿¡æ¯ |
| | | * @return æé®çç¸å
³çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateButtonVO> listButtonByTemplateOid(String templateOid, boolean hasButtonVO) { |
| | | if(StringUtils.isBlank(templateOid)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | // Map<String,String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("classifyTemplateOid",templateOid); |
| | | // PageHelper pageHelper = new PageHelper(-1); |
| | | // pageHelper.addDefaultAsc("orderNum"); |
| | | QueryWrapper<CodeClassifyTemplateButton> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("classifyTemplateOid",templateOid); |
| | | wrapper.orderByAsc("orderNum"); |
| | | List<CodeClassifyTemplateButton> templateButtonDOS = codeClassifyTemplateButtonMapper.selectList(wrapper); |
| | | return codeClassifyTemplateButtonDO2VOs(templateButtonDOS,hasButtonVO); |
| | | } |
| | | |
| | | } |