pull/48/head
smallbun 1 year ago
parent efff5b4613
commit 0473ca0e7c

@ -17,6 +17,7 @@
*/
package cn.topiam.employee.application;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -86,6 +87,19 @@ public interface ApplicationService {
*/
String getBase64Icon();
/**
*
*
* @param name {@link String}
* @param icon {@link String}
* @param remark {@link String}
* @return {@link Long} ID
*/
@Transactional(rollbackFor = Exception.class)
default String create(String name, String icon, String remark) {
return create(name, icon, remark, new ArrayList<>());
}
/**
*
*

@ -17,10 +17,7 @@
*/
package cn.topiam.employee.console.service.app.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import cn.topiam.employee.common.entity.app.AppGroupAssociationEntity;
import cn.topiam.employee.common.repository.app.AppGroupAssociationRepository;
@ -52,6 +49,7 @@ import cn.topiam.employee.support.util.BeanUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_BY;
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_TIME;
@ -93,8 +91,13 @@ public class AppServiceImpl implements AppService {
public AppCreateResult createApp(AppCreateParam param) {
ApplicationService applicationService = applicationServiceLoader
.getApplicationService(param.getTemplate());
String appId = applicationService.create(param.getName(), param.getIcon(),
param.getRemark(), param.getGroupIds());
String appId;
if (!CollectionUtils.isEmpty(param.getGroupIds())) {
appId = applicationService.create(param.getName(), param.getIcon(), param.getRemark(),
param.getGroupIds());
} else {
appId = applicationService.create(param.getName(), param.getIcon(), param.getRemark());
}
AuditContext.setTarget(Target.builder().id(appId).type(TargetType.APPLICATION).build());
return new AppCreateResult(appId);
}

Loading…
Cancel
Save