| | |
| | | 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; |
| | |
| | | |
| | | /** |
| | | * 查询所有的主题库分类的模板属性 |
| | | * @param lambdaQueryWrapper 查询条件 |
| | | * @param mpjLambdaWrapper 查询条件 |
| | | * @param pageHelper 分页和排序 |
| | | * @return 执行结果 |
| | | * @throws VciBaseException 查询条件和分页出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(LambdaQueryWrapper<CodeClassifyTemplateAttr> lambdaQueryWrapper , PageHelper pageHelper) throws VciBaseException { |
| | | DataGrid<CodeClassifyTemplateAttrVO> dataGrid=new DataGrid<>(); |
| | | public IPage<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(MPJLambdaWrapper<CodeClassifyTemplateAttr> mpjLambdaWrapper , PageHelper pageHelper) throws VciBaseException { |
| | | //没有传递参数,就不执行查询逻辑 |
| | | if(lambdaQueryWrapper == null){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | if(mpjLambdaWrapper == null){ |
| | | return new Page<>(); |
| | | } |
| | | Query query = new Query(); |
| | | if (pageHelper == null) { |
| | |
| | | } |
| | | //pageHelper.addDefaultAsc("ordernum"); |
| | | query.setAscs("ordernum"); |
| | | |
| | | IPage<CodeClassifyTemplateAttr> doList = codeClassifyTemplateAttrMapper.selectPage(Condition.getPage(query), lambdaQueryWrapper); |
| | | //这儿是个连表查询 |
| | | IPage<CodeClassifyTemplateAttr> doList = codeClassifyTemplateAttrMapper.selectPage(Condition.getPage(query), mpjLambdaWrapper); |
| | | IPage<CodeClassifyTemplateAttrVO> voList = new Page<>(); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | dataGrid.setData(codeClassifyTemplateAttrDO2VOs(doList.getRecords())); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeClassifyTemplateAttrMapper.selectCount(lambdaQueryWrapper)))); |
| | | voList.setRecords(CodeClstempattrWrapper.build().listVO(doList.getRecords())); |
| | | PageDO2PageVO.pageDO2PageVO(doList,voList); |
| | | } |
| | | return dataGrid; |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws VciBaseException 查询条件和分页出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(Map<String, Object> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | public IPage<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(Map<String, Object> conditionMap, PageHelper pageHelper) throws VciBaseException{ |
| | | if(conditionMap == null){ |
| | | conditionMap = new HashMap<String, Object>(); |
| | | } |
| | | return gridCodeClassifyTemplateAttr(Condition.getQueryWrapper(conditionMap,CodeClassifyTemplateAttr.class).lambda(),pageHelper); |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(codeClassifyTemplateAttrDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassifyTemplateAttrDO,vo); |
| | | //如果有lcstatus的类的话 |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributedatatype())); |
| | | vo.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(vo.getAttributeDataType())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | |
| | | } |