| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package jnpf.flowable.service.impl;
- import cn.hutool.core.collection.CollectionUtil;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import jnpf.base.service.SuperServiceImpl;
- import jnpf.flowable.entity.SubtaskDataEntity;
- import jnpf.flowable.mapper.SubtaskDataMapper;
- import jnpf.flowable.model.task.FlowModel;
- import jnpf.flowable.service.SubtaskDataService;
- import jnpf.util.JsonUtil;
- import jnpf.util.RandomUtil;
- import org.springframework.stereotype.Service;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * 类的描述
- *
- * @author JNPF@YinMai Info. Co., Ltd
- * @version 5.0.x
- * @since 2024/12/6 15:35
- */
- @Service
- public class SubtaskDataServiceImpl extends SuperServiceImpl<SubtaskDataMapper, SubtaskDataEntity> implements SubtaskDataService {
- @Override
- public List<SubtaskDataEntity> getList(String parentId, String parentCode) {
- QueryWrapper<SubtaskDataEntity> queryWrapper = new QueryWrapper<>();
- queryWrapper.lambda().eq(SubtaskDataEntity::getParentId, parentId).eq(SubtaskDataEntity::getNodeCode, parentCode)
- .orderByAsc(SubtaskDataEntity::getSortCode);
- return this.list(queryWrapper);
- }
- @Override
- public void save(List<FlowModel> subTaskData) {
- if (CollectionUtil.isEmpty(subTaskData)) {
- return;
- }
- List<SubtaskDataEntity> list = new ArrayList<>();
- for (int i = 0; i < subTaskData.size(); i++) {
- FlowModel model = subTaskData.get(i);
- SubtaskDataEntity entity = new SubtaskDataEntity();
- entity.setId(RandomUtil.uuId());
- entity.setParentId(model.getParentId());
- entity.setNodeCode(model.getSubCode());
- entity.setSubtaskJson(JsonUtil.getObjectToString(model));
- int sortCode = i + 1;
- entity.setSortCode((long) sortCode);
- list.add(entity);
- }
- if (CollectionUtil.isNotEmpty(list)) {
- this.saveBatch(list);
- }
- }
- }
|