From ec407e8676f6245d88da3d9f729ad545ae3218c0 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 18 七月 2023 15:20:03 +0800 Subject: [PATCH] 代码提交 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java | 83 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 81 insertions(+), 2 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java index 08bbbf8..62f4143 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyValueServiceImpl.java @@ -1,6 +1,7 @@ package com.vci.ubcs.code.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -24,7 +25,9 @@ import com.vci.ubcs.starter.web.util.VciBaseUtil; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -63,7 +66,6 @@ */ @Override public List<Tree> treeCodeClassifyValue(TreeQueryObject treeQueryObject) throws VciBaseException { - // List<CodeClassifyValueDO> doList =selectCodeClassifyValueDOByTree(treeQueryObject); List<CodeClassifyValue> doList = selectCodeClassifyValueDO4Tree(treeQueryObject); List<CodeClassifyValueVO> voList = CodeClassifyValueWrapper.build().listVO(doList); TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME); @@ -282,7 +284,7 @@ */ @Override @Transactional(rollbackFor = Exception.class) - public R batchSave4Order(List<CodeClassifyValueDTO> dtoList, String codeclassifysecoid) { + public R batchSave4Order(List<CodeClassifyValueDTO> dtoList, String codeclassifysecoid) throws VciBaseException{ VciBaseUtil.alertNotNull(codeclassifysecoid,"鍒嗙被鐮佹涓婚敭"); List<CodeClassifyValue> valueDOList = codeClassifyValueMapper.selectList(Wrappers.<CodeClassifyValue>query() .lambda().eq(CodeClassifyValue::getCodeClassifySecOid,codeclassifysecoid) @@ -302,6 +304,9 @@ }); } }); + if(updateList.isEmpty()){ + return R.fail("璇ユ搷浣滄湁璇�愬緟鎿嶄綔闆嗗悎涓虹┖銆戙��"); + } boolean resBoolean = this.updateBatchById(updateList); return R.status(resBoolean); } @@ -349,4 +354,78 @@ return codeClassifyValueMapper.selectList(wrapper); } + /** + * 浣跨敤鐮佹鐨勪富閿幏鍙栧垎绫荤殑鐮佸�煎唴瀹� + * + * @param classifySecOid 鐮佹鐨勪富閿� + * @param parentClassifyValueOid 涓婄骇鍒嗙被鐨勪富閿� + * @return 鍒嗙被鐮佸�肩殑鍐呭 + */ + @Override + public List<CodeClassifyValueVO> listCodeClassifyValueBySecOid(String classifySecOid, String parentClassifyValueOid) { + if(StringUtils.isBlank(classifySecOid)){ + return new ArrayList<>(); + } + CodeBasicSec secDO = codeBasicSecService.getById(classifySecOid); + if(secDO == null || StringUtils.isBlank(secDO.getOid())){ + throw new VciBaseException("鐮佹鐨勫唴瀹瑰湪绯荤粺涓笉瀛樺湪"); + } + if(StringUtils.isNotBlank(secDO.getParentClassifySecOid()) && StringUtils.isBlank(parentClassifyValueOid)){ + return new ArrayList<>(); + //鍥犱负鏈変笂绾у垎绫荤殑鏃跺�欙紝蹇呴』鍏堥�夋嫨涓婄骇鍒嗙被鐨勫唴瀹� + } +// Map<String,String> conditionMap = new HashMap<>(); +// conditionMap.put("codeClassifySecOid",classifySecOid); +// if(StringUtils.isNotBlank(parentClassifyValueOid)){ +// conditionMap.put("parentClassifyValueOid",parentClassifyValueOid); +// } +// PageHelper pageHelper = new PageHelper(-1); +// pageHelper.addDefaultAsc("ordernum"); + QueryWrapper<CodeClassifyValue> wrapper = new QueryWrapper<>(); + wrapper.eq("codeClassifySecOid",classifySecOid); + if(StringUtils.isNotBlank(parentClassifyValueOid)){ + wrapper.in("parentClassifyValueOid",VciBaseUtil.str2List(parentClassifyValueOid)); + } + wrapper.orderByAsc("ordernum"); + + List<CodeClassifyValue> valueDOList = codeClassifyValueMapper.selectList(wrapper); + return codeClassifyValueDO2VOs(valueDOList); + } + + /** + * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDOs 鏁版嵁瀵硅薄鍒楄〃 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父 + */ + @Override + public List<CodeClassifyValueVO> codeClassifyValueDO2VOs(Collection<CodeClassifyValue> codeClassifyValueDOs) throws VciBaseException{ + List<CodeClassifyValueVO> voList = new ArrayList<CodeClassifyValueVO>(); + if(!CollectionUtils.isEmpty(codeClassifyValueDOs)){ + for(CodeClassifyValue s: codeClassifyValueDOs){ + CodeClassifyValueVO vo = codeClassifyValueDO2VO(s); + if(vo != null){ + voList.add(vo); + } + } + } + return voList; + } + + /** + * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� + * @param codeClassifyValueDO 鏁版嵁瀵硅薄 + * @return 鏄剧ず瀵硅薄 + * @throws VciBaseException 鎷疯礉灞炴�у嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父 + */ + @Override + public CodeClassifyValueVO codeClassifyValueDO2VO(CodeClassifyValue codeClassifyValueDO) throws VciBaseException{ + CodeClassifyValueVO vo = new CodeClassifyValueVO(); + if(codeClassifyValueDO != null){ + BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyValueDO,vo); + //濡傛灉鏈塴cstatus鐨勭被鐨勮瘽 + + } + return vo; + } } -- Gitblit v1.9.3