¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | 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.starter.exception.VciBaseException; |
| | | 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 lambdaQueryWrapper æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return æ§è¡ç»æ |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public DataGrid<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(LambdaQueryWrapper<CodeClassifyTemplateAttr> lambdaQueryWrapper , PageHelper pageHelper) throws VciBaseException { |
| | | DataGrid<CodeClassifyTemplateAttrVO> dataGrid=new DataGrid<>(); |
| | | //没æä¼ éåæ°ï¼å°±ä¸æ§è¡æ¥è¯¢é»è¾ |
| | | if(lambdaQueryWrapper == null){ |
| | | dataGrid.setData(new ArrayList<>()); |
| | | dataGrid.setTotal(0); |
| | | return dataGrid; |
| | | } |
| | | 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), lambdaQueryWrapper); |
| | | if (!CollectionUtils.isEmpty(doList.getRecords())) { |
| | | dataGrid.setData(codeClassifyTemplateAttrDO2VOs(doList.getRecords())); |
| | | dataGrid.setTotal(VciBaseUtil.getInt(String.valueOf(codeClassifyTemplateAttrMapper.selectCount(lambdaQueryWrapper)))); |
| | | } |
| | | return dataGrid; |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»é¢åºåç±»çæ¨¡æ¿å±æ§å表 |
| | | * @param conditionMap æ¥è¯¢æ¡ä»¶ |
| | | * @param pageHelper å页åæåº |
| | | * @return 主é¢åºåç±»çæ¨¡æ¿å±æ§æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | * @throws VciBaseException æ¥è¯¢æ¡ä»¶åå页åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public DataGrid<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); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @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; |
| | | } |
| | | |
| | | } |