Commit 14a15b58 authored by alex yao's avatar alex yao

feat:新增知识库训练

parent 2fdb0aae
package cn.com.poc.knowledge.service.impl; package cn.com.poc.knowledge.service.impl;
import cn.com.poc.common.constant.MkpCommonConstant; import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.utils.Assert; import cn.com.poc.common.utils.Assert;
import cn.com.poc.knowledge.convert.KnowledgeDocumentConvert; import cn.com.poc.knowledge.convert.KnowledgeDocumentConvert;
import cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity; import cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity;
...@@ -38,7 +38,7 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl ...@@ -38,7 +38,7 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl
public List<BizKnowledgeDocumentEntity> findByExample(BizKnowledgeDocumentEntity example, PagingInfo pagingInfo) throws Exception { public List<BizKnowledgeDocumentEntity> findByExample(BizKnowledgeDocumentEntity example, PagingInfo pagingInfo) throws Exception {
List<BizKnowledgeDocumentEntity> result = new ArrayList<>(); List<BizKnowledgeDocumentEntity> result = new ArrayList<>();
BizKnowledgeDocumentModel model = KnowledgeDocumentConvert.entityToModel(example); BizKnowledgeDocumentModel model = KnowledgeDocumentConvert.entityToModel(example);
model.setIsDeleted(MkpCommonConstant.IsDeleted.N);//只能查询未删除 model.setIsDeleted(CommonConstant.IsDeleted.N);//只能查询未删除
List<BizKnowledgeDocumentModel> models = this.repository.findByExample(model, pagingInfo); List<BizKnowledgeDocumentModel> models = this.repository.findByExample(model, pagingInfo);
if (!CollectionUtils.isEmpty(models)) { if (!CollectionUtils.isEmpty(models)) {
result = models.stream().map(KnowledgeDocumentConvert::modelToEntity).collect(Collectors.toList()); result = models.stream().map(KnowledgeDocumentConvert::modelToEntity).collect(Collectors.toList());
...@@ -73,8 +73,8 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl ...@@ -73,8 +73,8 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl
Assert.notNull(kdId); Assert.notNull(kdId);
BizKnowledgeDocumentModel bizKnowledgeDocumentModel = this.repository.get(kdId); BizKnowledgeDocumentModel bizKnowledgeDocumentModel = this.repository.get(kdId);
if (null != bizKnowledgeDocumentModel) { if (null != bizKnowledgeDocumentModel) {
bizKnowledgeDocumentModel.setIsEnable(MkpCommonConstant.IsDeleted.N); bizKnowledgeDocumentModel.setIsEnable(CommonConstant.IsDeleted.N);
bizKnowledgeDocumentModel.setIsDeleted(MkpCommonConstant.IsDeleted.Y); bizKnowledgeDocumentModel.setIsDeleted(CommonConstant.IsDeleted.Y);
this.repository.save(bizKnowledgeDocumentModel); this.repository.save(bizKnowledgeDocumentModel);
} }
return true; return true;
......
package cn.com.poc.knowledge.service.impl; package cn.com.poc.knowledge.service.impl;
import cn.com.poc.common.utils.BeanUtils;
import cn.com.poc.knowledge.convert.KnowledgeTrainLogConvert; import cn.com.poc.knowledge.convert.KnowledgeTrainLogConvert;
import cn.com.poc.knowledge.entity.BizKnowledgeTrainLogEntity; import cn.com.poc.knowledge.entity.BizKnowledgeTrainLogEntity;
import cn.com.poc.knowledge.model.BizKnowledgeTrainLogModel; import cn.com.poc.knowledge.model.BizKnowledgeTrainLogModel;
import cn.com.poc.knowledge.repository.BizKnowledgeTrainLogRepository; import cn.com.poc.knowledge.repository.BizKnowledgeTrainLogRepository;
import cn.com.poc.knowledge.service.BizKnowledgeTrainLogService; import cn.com.poc.knowledge.service.BizKnowledgeTrainLogService;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl; import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.yict.framemax.core.utils.BeanUtils;
import cn.com.yict.framemax.data.model.PagingInfo; import cn.com.yict.framemax.data.model.PagingInfo;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,7 +47,7 @@ public class BizKnowledgeTrainLogServiceImpl extends BaseServiceImpl ...@@ -45,7 +47,7 @@ public class BizKnowledgeTrainLogServiceImpl extends BaseServiceImpl
BizKnowledgeTrainLogModel saveModel = new BizKnowledgeTrainLogModel(); BizKnowledgeTrainLogModel saveModel = new BizKnowledgeTrainLogModel();
if (entity.getId() != null) { if (entity.getId() != null) {
saveModel = this.repository.get(entity.getId()); saveModel = this.repository.get(entity.getId());
BeanUtils.copyPropertiesIgnoreNull(entity, saveModel); BeanUtil.copyProperties(entity, saveModel,new CopyOptions().ignoreNullValue());
} }
else{ else{
saveModel = KnowledgeTrainLogConvert.entityToModel(entity); saveModel = KnowledgeTrainLogConvert.entityToModel(entity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment