¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.metadata.IPage; |
| | | 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.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.entity.CodeClstemplateEntity; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyTemplateAttrMapper; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.code.wrapper.CodeClstempattrWrapper; |
| | | import com.vci.ubcs.common.utils.PageDO2PageVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.util.Map2MPLLambdaUtil; |
| | | import com.vci.ubcs.starter.util.MybatisParameterUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.PageHelper; |
| | | 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.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 主é¢åºåç±»çæ¨¡æ¿å±æ§æå¡ |
| | | * @author ludc |
| | | * @date 2023/5/5 |
| | | */ |
| | | @Service |
| | | public class CodeClassifyTemplateAttrServiceImpl extends ServiceImpl<CodeClassifyTemplateAttrMapper, CodeClassifyTemplateAttr> implements ICodeClassifyTemplateAttrService { |
| | | |
| | | /** |
| | | * æ°æ®æä½å± |
| | | */ |
| | | @Resource |
| | | private CodeClassifyTemplateAttrMapper codeClassifyTemplateAttrMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ææç主é¢åºåç±»çæ¨¡æ¿å±æ§ |
| | | * @param mpjLambdaWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public IPage<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(MPJLambdaWrapper<CodeClassifyTemplateAttr> mpjLambdaWrapper , PageHelper pageHelper) throws VciBaseException { |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | if(mpjLambdaWrapper == null){ |
| | | return new Page<>(); |
| | | } |
| | | Query query = new Query(); |
| | | if (pageHelper == null) { |
| | | pageHelper = new PageHelper(-1); |
| | | query.setSize(-1); |
| | | }else { |
| | | query.setCurrent(pageHelper.getPage()); |
| | | query.setSize(pageHelper.getLimit()); |
| | | } |
| | | //pageHelper.addDefaultAsc("ordernum"); |
| | | query.setAscs("ordernum"); |
| | | //è¿å¿æ¯ä¸ªè¿è¡¨æ¥è¯¢ |
| | | IPage<CodeClassifyTemplateAttr> doList = codeClassifyTemplateAttrMapper.selectPage(Condition.getPage(query), mpjLambdaWrapper); |
| | | IPage<CodeClassifyTemplateAttrVO> voList = new Page<>(); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | voList.setRecords(CodeClstempattrWrapper.build().listVO(doList.getRecords())); |
| | | PageDO2PageVO.pageDO2PageVO(doList,voList); |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public IPage<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(Map<String, Object> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | if(conditionMap == null){ |
| | | conditionMap = new HashMap<String, Object>(); |
| | | } |
| | | return gridCodeClassifyTemplateAttr(Map2MPLLambdaUtil.getMPJLambdaWrapper(conditionMap, CodeClassifyTemplateAttr.class),pageHelper); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CodeClassifyTemplateAttrVO> selectCodeClstempattrPage(IPage<CodeClassifyTemplateAttrVO> page, CodeClassifyTemplateAttrVO CodeClstempattr) { |
| | | return page.setRecords(baseMapper.selectCodeClstempattrPage(page, CodeClstempattr)); |
| | | } |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¨¡æ¿ç主é®è·å模æ¿ç屿§--æ¹é |
| | | * |
| | | * @param templateOidCollection 模æ¿çä¸»é® |
| | | * @return 屿§çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateAttrVO> listCodeClassifyTemplateAttrByTemplateOids(Collection<String> templateOidCollection) { |
| | | if(CollectionUtils.isEmpty(templateOidCollection)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CodeClassifyTemplateAttr> 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<CodeClassifyTemplateAttr> attrDOS = baseMapper.selectByClassifytemplateoid(VciBaseUtil.toInSql(templateOids.toArray(new String[0]))); |
| | | |
| | | if(!CollectionUtils.isEmpty(attrDOS)){ |
| | | attrDOList.addAll(attrDOS); |
| | | } |
| | | }); |
| | | return codeClassifyTemplateAttrDO2VOs(attrDOList); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDOs æ°æ®å¯¹è±¡å表 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºæè
ä¸åå¨çæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrDO2VOs(Collection<CodeClassifyTemplateAttr> codeClassifyTemplateAttrDOs) throws VciBaseException{ |
| | | List<CodeClassifyTemplateAttrVO> voList = new ArrayList<CodeClassifyTemplateAttrVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifyTemplateAttrDOs)){ |
| | | for(CodeClassifyTemplateAttr s: codeClassifyTemplateAttrDOs){ |
| | | CodeClassifyTemplateAttrVO vo = codeClassifyTemplateAttrDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifyTemplateAttrDO æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException æ·è´å±æ§åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyTemplateAttrVO codeClassifyTemplateAttrDO2VO(CodeClassifyTemplateAttr codeClassifyTemplateAttrDO) throws VciBaseException{ |
| | | CodeClassifyTemplateAttrVO vo = new CodeClassifyTemplateAttrVO(); |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributeDataType())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | |
| | | } |