|
@@ -4,7 +4,9 @@ package com.benyun.service.impl;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.benyun.boot.core.vo.Result;
|
|
import com.benyun.boot.core.vo.Result;
|
|
import com.benyun.dao.ApplyDao;
|
|
import com.benyun.dao.ApplyDao;
|
|
|
|
+import com.benyun.dao.EventDao;
|
|
import com.benyun.entity.Apply;
|
|
import com.benyun.entity.Apply;
|
|
|
|
+import com.benyun.entity.Event;
|
|
import com.benyun.service.ApplyService;
|
|
import com.benyun.service.ApplyService;
|
|
import com.benyun.vo.ApplyEventVo;
|
|
import com.benyun.vo.ApplyEventVo;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -13,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
@@ -27,6 +30,7 @@ import java.util.UUID;
|
|
public class ApplyServiceImpl implements ApplyService {
|
|
public class ApplyServiceImpl implements ApplyService {
|
|
|
|
|
|
private final ApplyDao applyDao;
|
|
private final ApplyDao applyDao;
|
|
|
|
+ private final EventDao eventDao;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Apply queryById(String id) {
|
|
public Apply queryById(String id) {
|
|
@@ -43,6 +47,22 @@ public class ApplyServiceImpl implements ApplyService {
|
|
return applyDao.createLambdaQuery().andLike(Apply::getApplyName, "%" + (StrUtil.isNotBlank(applyName)? applyName: "") + "%").select();
|
|
return applyDao.createLambdaQuery().andLike(Apply::getApplyName, "%" + (StrUtil.isNotBlank(applyName)? applyName: "") + "%").select();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void copyFrom(String target, String from) {
|
|
|
|
+ List<Event> select = eventDao.createLambdaQuery()
|
|
|
|
+ .andEq(Event::getApplyId, from)
|
|
|
|
+ .select();
|
|
|
|
+
|
|
|
|
+ ArrayList<Event> list = new ArrayList<>();
|
|
|
|
+ for (Event event : select) {
|
|
|
|
+ event.setId(target+"@"+event.getEventCode());
|
|
|
|
+ event.setApplyId(target);
|
|
|
|
+ list.add(event);
|
|
|
|
+ }
|
|
|
|
+ eventDao.insertBatch(list);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void insert(Apply apply) {
|
|
public void insert(Apply apply) {
|