组织架构物料管理增加克隆复制功能. http://172.16.46.63:31560/index.php?m=task&f=view&taskID=684

This commit is contained in:
ranke
2026-01-07 09:13:05 +08:00
parent cbc1f0f853
commit 73df6ca1a5
5 changed files with 70 additions and 1 deletions

12
pom.xml
View File

@@ -63,6 +63,10 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- Java 9+ 推荐使用 release 参数 -->
<release>${java.version}</release>
<annotationProcessorPaths>
<path>
<groupId>org.springframework.boot</groupId>
@@ -229,6 +233,14 @@
<config.version>1.0.0</config.version>
</properties>
</profile>
<profile>
<id>klw-dev</id>
<properties>
<env.name>dev</env.name>
<!--Nacos 配置-->
<config.namespace>klw</config.namespace>
</properties>
</profile>
</profiles>
</project>

View File

@@ -1,5 +1,7 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial;
import com.zt.plat.framework.common.util.object.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -103,4 +105,21 @@ public class DepartmentMaterialController {
list);
}
@PostMapping("/clone")
@Operation(summary = "克隆组织架构物料")
@Parameter(name = "ids", description = "要克隆的数据ID", required = true)
@Parameter(name = "deptId", description = "目标组织架构ID", required = true)
@PreAuthorize("@ss.hasPermission('base:department-material:clone')")
@Transactional
public CommonResult<Boolean> getDepartmentMaterial(@RequestBody DepartmentMaterialCloneReqVO req) {
List<DepartmentMaterialRespVO> list = departmentMaterialService.getDepartmentMaterialByIds(req.getIds());
for (DepartmentMaterialRespVO departmentMaterial : list) {
DepartmentMaterialSaveReqVO createReqVO = BeanUtils.toBean(departmentMaterial, DepartmentMaterialSaveReqVO.class);
createReqVO.setId( null);
createReqVO.setDeptId(req.getDeptId());
departmentMaterialService.createDepartmentMaterial(createReqVO);
}
return success(true);
}
}

View File

@@ -0,0 +1,21 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial.vo;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* 克隆组织架构物料 请求
* 2026/1/6 17:55
*/
@Data
public class DepartmentMaterialCloneReqVO {
@NotEmpty(message = "批量克隆 ids 不能为空")
private List<Long> ids;
@NotEmpty(message = "目标组织架构ID不能为空")
private Long deptId;
}

View File

@@ -51,6 +51,14 @@ public interface DepartmentMaterialService {
*/
DepartmentMaterialRespVO getDepartmentMaterial(Long id);
/**
* 根据多个ID获得组织架构物料列表
*
* @param ids 编号 list
* @return 组织架构物料列表
*/
List<DepartmentMaterialRespVO> getDepartmentMaterialByIds(List<Long> ids);
/**
* 获得组织架构物料分页
*

View File

@@ -106,7 +106,16 @@ public class DepartmentMaterialServiceImpl implements DepartmentMaterialService
if (data == null) {
return null;
}
return CollUtil.getFirst(decorateDepartmentMaterials(Collections.singletonList(data)));
return CollUtil.getFirst(decorateDepartmentMaterials(Collections.singletonList(data)));
}
@Override
public List<DepartmentMaterialRespVO> getDepartmentMaterialByIds(List<Long> ids) {
List<DepartmentMaterialDO> data = departmentMaterialMapper.selectByIds(ids);
if (org.apache.commons.collections4.CollectionUtils.isEmpty( data)) {
return null;
}
return decorateDepartmentMaterials(data);
}
@Override