组织架构物料管理增加克隆复制功能. http://172.16.46.63:31560/index.php?m=task&f=view&taskID=684
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -51,6 +51,14 @@ public interface DepartmentMaterialService {
|
||||
*/
|
||||
DepartmentMaterialRespVO getDepartmentMaterial(Long id);
|
||||
|
||||
/**
|
||||
* 根据多个ID获得组织架构物料列表
|
||||
*
|
||||
* @param ids 编号 list
|
||||
* @return 组织架构物料列表
|
||||
*/
|
||||
List<DepartmentMaterialRespVO> getDepartmentMaterialByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得组织架构物料分页
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user