Merge branch 'dev' into test

This commit is contained in:
chenbowen
2025-10-29 16:06:34 +08:00
149 changed files with 7696 additions and 11 deletions

2
.gitignore vendored
View File

@@ -73,3 +73,5 @@ functions/mock
screenshot screenshot
.firebase .firebase
sessionStore sessionStore
/CLAUDE.md
/nul

View File

@@ -29,4 +29,32 @@ public interface ErrorCodeConstants {
ErrorCode BUSINESS_DICTIONARY_TYPE_NOT_EXISTS = new ErrorCode(1_027_200_003, "业务字典类型不存在"); ErrorCode BUSINESS_DICTIONARY_TYPE_NOT_EXISTS = new ErrorCode(1_027_200_003, "业务字典类型不存在");
ErrorCode BUSINESS_DEPARTMENT_INDICATOR_NOT_EXISTS = new ErrorCode(1_027_200_004, "部门持有指标不存在"); ErrorCode BUSINESS_DEPARTMENT_INDICATOR_NOT_EXISTS = new ErrorCode(1_027_200_004, "部门持有指标不存在");
// ========== 模板文档管理系统 1-006-xxx-xxx ==========
// 模板分类 1-006-001-xxx
ErrorCode TEMPLATE_CATEGORY_NOT_EXISTS = new ErrorCode(1_006_001_001, "模板分类不存在");
// 标签库 1-006-002-xxx
ErrorCode TEMPLATE_TAG_NOT_EXISTS = new ErrorCode(1_006_002_001, "标签不存在");
ErrorCode TEMPLATE_TAG_CODE_DUPLICATE = new ErrorCode(1_006_002_002, "标签编码已存在");
// 模板 1-006-003-xxx
ErrorCode TEMPLATE_NOT_EXISTS = new ErrorCode(1_006_003_001, "模板不存在");
ErrorCode TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_006_003_002, "模板编码已存在");
// 模板实例 1-006-004-xxx
ErrorCode TEMPLATE_INSTANCE_NOT_EXISTS = new ErrorCode(1_006_004_001, "模板实例不存在");
ErrorCode TEMPLATE_INSTANCE_CODE_DUPLICATE = new ErrorCode(1_006_004_002, "实例编码已存在");
// ========== 物料属性 ==========
ErrorCode MATERIAL_PROPERTIES_NOT_EXISTS = new ErrorCode(1_027_101_001, "物料属性不存在");
ErrorCode MATERIAL_HAS_PROPERTIES_NOT_EXISTS = new ErrorCode(1_027_101_002, "物料持有属性不存在");
ErrorCode MATERIAL_CLASSES_NOT_EXISTS = new ErrorCode(1_027_101_003, "物料分类不存在");
ErrorCode DEPARTMENT_MATERIAL_NOT_EXISTS = new ErrorCode(1_027_101_004, "组织物料不存在");
ErrorCode MATERIAL_HAS_CLASSES_NOT_EXISTS = new ErrorCode(1_027_101_004, "物料持有属性不存在");
// ========== 工艺信息属性 ==========
ErrorCode PROCESSING_INFOMATION_NOT_EXISTS = new ErrorCode(1_027_101_005, "工艺信息不存在");
ErrorCode PROCESSING_INFOMATION_OPERATION_NOT_EXISTS = new ErrorCode(1_027_101_006, "工艺工序不存在");
ErrorCode PROCESSING_OPERATION_NOT_EXISTS = new ErrorCode(1_027_101_007, "工序不存在");
ErrorCode PROCESSING_OPERATION_MATERIAL_NOT_EXISTS = new ErrorCode(1_027_101_008, "工艺工序物料不存在");
} }

View File

@@ -122,6 +122,13 @@
<artifactId>zt-spring-boot-starter-excel</artifactId> <artifactId>zt-spring-boot-starter-excel</artifactId>
</dependency> </dependency>
<!-- Velocity模板引擎 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
</dependency>
<!-- 监控相关 --> <!-- 监控相关 -->
<dependency> <dependency>
<groupId>com.zt.plat</groupId> <groupId>com.zt.plat</groupId>

View File

@@ -19,6 +19,9 @@ public class MaterialInfomationPageReqVO extends PageParam {
@Schema(description = "物料名称", example = "张三") @Schema(description = "物料名称", example = "张三")
private String name; private String name;
@Schema(description = "分类ID", example = "1024")
private Long classesId;
@Schema(description = "备注") @Schema(description = "备注")
private String remark; private String remark;

View File

@@ -24,6 +24,10 @@ public class MaterialInfomationRespVO {
@ExcelProperty("物料名称") @ExcelProperty("物料名称")
private String name; private String name;
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@ExcelProperty("分类ID")
private Long classesId;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.base.controller.admin.base.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
@Schema(description = "管理后台 - 物料信息新增/修改 Request VO") @Schema(description = "管理后台 - 物料信息新增/修改 Request VO")
@@ -19,6 +20,10 @@ public class MaterialInfomationSaveReqVO {
@NotEmpty(message = "物料名称不能为空") @NotEmpty(message = "物料名称不能为空")
private String name; private String name;
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "所属分类不能为空")
private Long classesId;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空") @NotEmpty(message = "备注不能为空")
private String remark; private String remark;

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.departmentmaterial.vo.*;
import com.zt.plat.module.base.dal.dataobject.departmentmaterial.DepartmentMaterialDO;
import com.zt.plat.module.base.service.departmentmaterial.DepartmentMaterialService;
@Tag(name = "管理后台 - 组织架构物料")
@RestController
@RequestMapping("/base/department-material")
@Validated
public class DepartmentMaterialController {
@Resource
private DepartmentMaterialService departmentMaterialService;
@PostMapping("/create")
@Operation(summary = "创建组织架构物料")
@PreAuthorize("@ss.hasPermission('base:department-material:create')")
public CommonResult<DepartmentMaterialRespVO> createDepartmentMaterial(@Valid @RequestBody DepartmentMaterialSaveReqVO createReqVO) {
return success(departmentMaterialService.createDepartmentMaterial(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新组织架构物料")
@PreAuthorize("@ss.hasPermission('base:department-material:update')")
public CommonResult<Boolean> updateDepartmentMaterial(@Valid @RequestBody DepartmentMaterialSaveReqVO updateReqVO) {
departmentMaterialService.updateDepartmentMaterial(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除组织架构物料")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:department-material:delete')")
public CommonResult<Boolean> deleteDepartmentMaterial(@RequestParam("id") Long id) {
departmentMaterialService.deleteDepartmentMaterial(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除组织架构物料")
@PreAuthorize("@ss.hasPermission('base:department-material:delete')")
public CommonResult<Boolean> deleteDepartmentMaterialList(@RequestBody BatchDeleteReqVO req) {
departmentMaterialService.deleteDepartmentMaterialListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得组织架构物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:department-material:query')")
public CommonResult<DepartmentMaterialRespVO> getDepartmentMaterial(@RequestParam("id") Long id) {
DepartmentMaterialDO departmentMaterial = departmentMaterialService.getDepartmentMaterial(id);
return success(BeanUtils.toBean(departmentMaterial, DepartmentMaterialRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得组织架构物料分页")
@PreAuthorize("@ss.hasPermission('base:department-material:query')")
public CommonResult<PageResult<DepartmentMaterialRespVO>> getDepartmentMaterialPage(@Valid DepartmentMaterialPageReqVO pageReqVO) {
PageResult<DepartmentMaterialRespVO> pageResult = departmentMaterialService.getDepartmentMaterialPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出组织架构物料 Excel")
@PreAuthorize("@ss.hasPermission('base:department-material:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDepartmentMaterialExcel(@Valid DepartmentMaterialPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DepartmentMaterialRespVO> list = departmentMaterialService.getDepartmentMaterialPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "组织架构物料.xls", "数据", DepartmentMaterialRespVO.class,
list);
}
}

View File

@@ -0,0 +1,47 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 组织架构物料分页 Request VO")
@Data
public class DepartmentMaterialPageReqVO extends PageParam {
@Schema(description = "物料信息ID", example = "3923")
private Long infomationId;
@Schema(description = "物料信息ID集合(内部使用)")
private List<Long> infomationIds;
@Schema(description = "物料分类ID", example = "30114")
private Long classesId;
@Schema(description = "部门ID", example = "1001")
private Long deptId;
@Schema(description = "字典数据值-物料类型")
private String dictionaryDataValue;
@Schema(description = "状态编码", example = "1")
private String isEnable;
@Schema(description = "物料编码")
private String materialNumber;
@Schema(description = "物料名称")
private String materialName;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,83 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 组织架构物料 Response VO")
@Data
@ExcelIgnoreUnannotated
public class DepartmentMaterialRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5674")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3923")
@ExcelProperty("物料信息ID")
private Long infomationId;
@Schema(description = "物料分类ID", example = "30114")
@ExcelProperty("物料分类ID")
private Long classesId;
@Schema(description = "字典数据值-物料类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("字典数据值-物料类型")
private String dictionaryDataValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "部门ID")
@ExcelIgnore
private Long deptId;
@Schema(description = "部门名称")
@ExcelProperty("部门名称")
private String deptName;
@Schema(description = "物料编码")
@ExcelProperty("物料编码")
private String materialNumber;
@Schema(description = "物料名称")
@ExcelProperty("物料名称")
private String materialName;
@Schema(description = "物料大类名称")
@ExcelProperty("物料大类")
private String categoryLargeName;
@Schema(description = "物料中类名称")
@ExcelProperty("物料中类")
private String categoryMediumName;
@Schema(description = "物料小类名称")
@ExcelProperty("物料小类")
private String categorySmallName;
@Schema(description = "物料分类路径")
@ExcelProperty("物料分类路径")
private String categoryPath;
@Schema(description = "组织物料类型名称")
@ExcelProperty("组织物料类型")
private String dictionaryDataLabel;
@Schema(description = "状态编码")
@ExcelProperty("状态编码")
private String isEnable;
@Schema(description = "状态名称")
@ExcelProperty("状态")
private String statusLabel;
}

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.base.controller.admin.departmentmaterial.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 组织架构物料新增/修改 Request VO")
@Data
public class DepartmentMaterialSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5674")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3923")
@NotNull(message = "物料信息ID不能为空")
private Long infomationId;
@Schema(description = "物料分类ID", example = "30114")
private Long classesId;
@Schema(description = "字典数据值-物料类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "字典数据值-物料类型不能为空")
private String dictionaryDataValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
}

View File

@@ -0,0 +1,89 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategorySaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 模板分类 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 模板分类")
@RestController
@RequestMapping("/base/doc-template-category")
@Validated
public class DocTemplateCategoryController {
@Resource
private DocTemplateCategoryService templateCategoryService;
@PostMapping("/create")
@Operation(summary = "创建模板分类")
@PreAuthorize("@ss.hasPermission('base:template-category:create')")
public CommonResult<Long> createTemplateCategory(@Valid @RequestBody DocTemplateCategorySaveReqVO createReqVO) {
return success(templateCategoryService.createTemplateCategory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模板分类")
@PreAuthorize("@ss.hasPermission('base:template-category:update')")
public CommonResult<Boolean> updateTemplateCategory(@Valid @RequestBody DocTemplateCategorySaveReqVO updateReqVO) {
templateCategoryService.updateTemplateCategory(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除模板分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template-category:delete')")
public CommonResult<Boolean> deleteTemplateCategory(@RequestParam("id") Long id) {
templateCategoryService.deleteTemplateCategory(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得模板分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<DocTemplateCategoryRespVO> getTemplateCategory(@RequestParam("id") Long id) {
return success(templateCategoryService.getTemplateCategory(id));
}
@GetMapping("/page")
@Operation(summary = "获得模板分类分页")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<PageResult<DocTemplateCategoryRespVO>> getTemplateCategoryPage(@Valid DocTemplateCategoryPageReqVO pageReqVO) {
return success(templateCategoryService.getTemplateCategoryPage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得模板分类列表")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<List<DocTemplateCategoryRespVO>> getTemplateCategoryList() {
return success(templateCategoryService.getTemplateCategoryList());
}
@GetMapping("/tree")
@Operation(summary = "获得模板分类树形结构")
@PreAuthorize("@ss.hasPermission('base:template-category:query')")
public CommonResult<List<DocTemplateCategoryRespVO>> getTemplateCategoryTree() {
return success(templateCategoryService.buildTree());
}
}

View File

@@ -0,0 +1,82 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplatePageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateSaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 模板 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 模板")
@RestController
@RequestMapping("/base/doc-template")
@Validated
public class DocTemplateController {
@Resource
private DocTemplateService templateService;
@PostMapping("/create")
@Operation(summary = "创建模板")
@PreAuthorize("@ss.hasPermission('base:template:create')")
public CommonResult<Long> createTemplate(@Valid @RequestBody DocTemplateSaveReqVO createReqVO) {
return success(templateService.createTemplate(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模板")
@PreAuthorize("@ss.hasPermission('base:template:update')")
public CommonResult<Boolean> updateTemplate(@Valid @RequestBody DocTemplateSaveReqVO updateReqVO) {
templateService.updateTemplate(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除模板")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template:delete')")
public CommonResult<Boolean> deleteTemplate(@RequestParam("id") Long id) {
templateService.deleteTemplate(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得模板")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<DocTemplateRespVO> getTemplate(@RequestParam("id") Long id) {
return success(templateService.getTemplate(id));
}
@GetMapping("/page")
@Operation(summary = "获得模板分页")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<PageResult<DocTemplateRespVO>> getTemplatePage(@Valid DocTemplatePageReqVO pageReqVO) {
return success(templateService.getTemplatePage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得模板列表")
@PreAuthorize("@ss.hasPermission('base:template:query')")
public CommonResult<List<DocTemplateRespVO>> getTemplateList() {
return success(templateService.getTemplateList());
}
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstancePageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceSaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateInstanceService;
import com.zt.plat.module.base.service.doctemplate.DocTemplateRenderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 模板实例 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 模板实例")
@RestController
@RequestMapping("/base/doc-template-instance")
@Validated
public class DocTemplateInstanceController {
@Resource
private DocTemplateInstanceService templateInstanceService;
@Resource
private DocTemplateRenderService renderService;
@PostMapping("/create")
@Operation(summary = "创建模板实例")
@PreAuthorize("@ss.hasPermission('base:template-instance:create')")
public CommonResult<Long> createTemplateInstance(@Valid @RequestBody DocTemplateInstanceSaveReqVO createReqVO) {
return success(templateInstanceService.createTemplateInstance(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新模板实例")
@PreAuthorize("@ss.hasPermission('base:template-instance:update')")
public CommonResult<Boolean> updateTemplateInstance(@Valid @RequestBody DocTemplateInstanceSaveReqVO updateReqVO) {
templateInstanceService.updateTemplateInstance(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除模板实例")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template-instance:delete')")
public CommonResult<Boolean> deleteTemplateInstance(@RequestParam("id") Long id) {
templateInstanceService.deleteTemplateInstance(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得模板实例")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template-instance:query')")
public CommonResult<DocTemplateInstanceRespVO> getTemplateInstance(@RequestParam("id") Long id) {
return success(templateInstanceService.getTemplateInstance(id));
}
@GetMapping("/page")
@Operation(summary = "获得模板实例分页")
@PreAuthorize("@ss.hasPermission('base:template-instance:query')")
public CommonResult<PageResult<DocTemplateInstanceRespVO>> getTemplateInstancePage(@Valid DocTemplateInstancePageReqVO pageReqVO) {
return success(templateInstanceService.getTemplateInstancePage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得模板实例列表")
@PreAuthorize("@ss.hasPermission('base:template-instance:query')")
public CommonResult<List<DocTemplateInstanceRespVO>> getTemplateInstanceList() {
return success(templateInstanceService.getTemplateInstanceList());
}
@PostMapping("/render")
@Operation(summary = "渲染模板实例")
@PreAuthorize("@ss.hasPermission('base:template-instance:query')")
public CommonResult<String> renderTemplateInstance(
@Parameter(name = "instanceId", description = "实例ID", required = true) @RequestParam("instanceId") Long instanceId,
@Parameter(name = "dataMap", description = "数据Map") @RequestBody(required = false) Map<String, Object> dataMap) {
String renderedContent = renderService.render(null, instanceId, null, dataMap);
return success(renderedContent);
}
@PostMapping("/render-and-save")
@Operation(summary = "渲染并保存模板实例")
@PreAuthorize("@ss.hasPermission('base:template-instance:update')")
public CommonResult<Boolean> renderAndSaveTemplateInstance(
@Parameter(name = "instanceId", description = "实例ID", required = true) @RequestParam("instanceId") Long instanceId,
@Parameter(name = "dataMap", description = "数据Map", required = true) @RequestBody Map<String, Object> dataMap) {
renderService.renderAndSave(instanceId, dataMap);
return success(true);
}
}

View File

@@ -0,0 +1,82 @@
package com.zt.plat.module.base.controller.admin.doctemplate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagSaveReqVO;
import com.zt.plat.module.base.service.doctemplate.DocTemplateTagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
/**
* 标签库 Controller
*
* @author 系统生成
*/
@Tag(name = "管理后台 - 标签库")
@RestController
@RequestMapping("/base/doc-template-tag")
@Validated
public class DocTemplateTagController {
@Resource
private DocTemplateTagService templateTagService;
@PostMapping("/create")
@Operation(summary = "创建标签")
@PreAuthorize("@ss.hasPermission('base:template-tag:create')")
public CommonResult<Long> createTemplateTag(@Valid @RequestBody DocTemplateTagSaveReqVO createReqVO) {
return success(templateTagService.createTemplateTag(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新标签")
@PreAuthorize("@ss.hasPermission('base:template-tag:update')")
public CommonResult<Boolean> updateTemplateTag(@Valid @RequestBody DocTemplateTagSaveReqVO updateReqVO) {
templateTagService.updateTemplateTag(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除标签")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:template-tag:delete')")
public CommonResult<Boolean> deleteTemplateTag(@RequestParam("id") Long id) {
templateTagService.deleteTemplateTag(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得标签")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<DocTemplateTagRespVO> getTemplateTag(@RequestParam("id") Long id) {
return success(templateTagService.getTemplateTag(id));
}
@GetMapping("/page")
@Operation(summary = "获得标签分页")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<PageResult<DocTemplateTagRespVO>> getTemplateTagPage(@Valid DocTemplateTagPageReqVO pageReqVO) {
return success(templateTagService.getTemplateTagPage(pageReqVO));
}
@GetMapping("/list")
@Operation(summary = "获得标签列表")
@PreAuthorize("@ss.hasPermission('base:template-tag:query')")
public CommonResult<List<DocTemplateTagRespVO>> getTemplateTagList() {
return success(templateTagService.getTemplateTagList());
}
}

View File

@@ -0,0 +1,27 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 模板分类分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplateCategoryPageReqVO extends PageParam {
@Schema(description = "分类名称", example = "采购类")
private String categoryName;
@Schema(description = "分类编码", example = "PURCHASE")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", example = "1")
private Integer level;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 模板分类 Response VO")
@Data
public class DocTemplateCategoryRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购类")
private String categoryName;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PURCHASE")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer level;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "备注", example = "采购业务相关文档分类")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人", example = "admin")
private String creator;
@Schema(description = "子分类列表")
private List<DocTemplateCategoryRespVO> children;
}

View File

@@ -0,0 +1,37 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 模板分类新增/修改 Request VO")
@Data
public class DocTemplateCategorySaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购类")
@NotBlank(message = "分类名称不能为空")
private String categoryName;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PURCHASE")
@NotBlank(message = "分类编码不能为空")
private String categoryCode;
@Schema(description = "父分类ID", example = "1")
private Long parentId;
@Schema(description = "层级1=大类2=小类)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "层级不能为空")
private Integer level;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "备注", example = "采购业务相关文档分类")
private String remark;
}

View File

@@ -0,0 +1,36 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 模板实例分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplateInstancePageReqVO extends PageParam {
@Schema(description = "实例名称", example = "采购合同")
private String instanceName;
@Schema(description = "模板ID", example = "1")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "状态", example = "draft")
private String status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,51 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 模板实例 Response VO")
@Data
public class DocTemplateInstanceRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "实例名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025年上海XX供应商采购合同")
private String instanceName;
@Schema(description = "实例编码", example = "DOC-20250127-001")
private String instanceCode;
@Schema(description = "引用的模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "业务关联ID", example = "100")
private Long businessId;
@Schema(description = "业务关联标签", example = "PC-2025-001")
private String businessLabel;
@Schema(description = "用户编辑后的内容")
private String editedContent;
@Schema(description = "渲染后的最终内容")
private String renderedContent;
@Schema(description = "备注", example = "采购合同文档")
private String remark;
@Schema(description = "状态", example = "draft")
private String status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人", example = "admin")
private String creator;
}

View File

@@ -0,0 +1,49 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 模板实例新增/修改 Request VO")
@Data
public class DocTemplateInstanceSaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "实例名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025年上海XX供应商采购合同")
@NotBlank(message = "实例名称不能为空")
private String instanceName;
@Schema(description = "实例编码", example = "DOC-20250127-001")
private String instanceCode;
@Schema(description = "引用的模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "模板ID不能为空")
private Long templateId;
@Schema(description = "业务关联类型", example = "contract")
private String businessType;
@Schema(description = "业务关联ID", example = "100")
private Long businessId;
@Schema(description = "业务关联标签", example = "PC-2025-001")
private String businessLabel;
@Schema(description = "用户编辑后的内容", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "内容不能为空")
private String editedContent;
@Schema(description = "渲染后的最终内容")
private String renderedContent;
@Schema(description = "备注", example = "采购合同文档")
private String remark;
@Schema(description = "状态", example = "draft")
private String status;
}

View File

@@ -0,0 +1,39 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 模板分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplatePageReqVO extends PageParam {
@Schema(description = "模板名称", example = "采购合同模板")
private String tmplName;
@Schema(description = "模板编码", example = "PO_CONTRACT_001")
private String tmplCode;
@Schema(description = "所属大类", example = "1")
private Long bigCategoryId;
@Schema(description = "所属小类", example = "11")
private Long smallCategoryId;
@Schema(description = "状态1=启用0=停用2=草稿)", example = "1")
private String enabled;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,57 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 模板 Response VO")
@Data
public class DocTemplateRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购合同模板")
private String tmplName;
@Schema(description = "模板编码(唯一)", requiredMode = Schema.RequiredMode.REQUIRED, example = "PO_CONTRACT_001")
private String tmplCode;
@Schema(description = "模板图标", example = "📄")
private String icon;
@Schema(description = "所属大类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long bigCategoryId;
@Schema(description = "所属小类", example = "11")
private Long smallCategoryId;
@Schema(description = "版本号", example = "v1.2")
private String version;
@Schema(description = "模板描述", example = "标准采购合同范本")
private String description;
@Schema(description = "模板内容HTML含占位符", requiredMode = Schema.RequiredMode.REQUIRED)
private String content;
@Schema(description = "SQL配置JSON格式可选")
private String sqlConfig;
@Schema(description = "数据源标识", example = "default")
private String dataSource;
@Schema(description = "使用次数", example = "10")
private Integer useCount;
@Schema(description = "状态1=启用0=停用2=草稿)", example = "1")
private String enabled;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人", example = "admin")
private String creator;
}

View File

@@ -0,0 +1,53 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 模板新增/修改 Request VO")
@Data
public class DocTemplateSaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "采购合同模板")
@NotBlank(message = "模板名称不能为空")
private String tmplName;
@Schema(description = "模板编码(唯一)", requiredMode = Schema.RequiredMode.REQUIRED, example = "PO_CONTRACT_001")
@NotBlank(message = "模板编码不能为空")
private String tmplCode;
@Schema(description = "模板图标", example = "📄")
private String icon;
@Schema(description = "所属大类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "所属大类不能为空")
private Long bigCategoryId;
@Schema(description = "所属小类", example = "11")
private Long smallCategoryId;
@Schema(description = "版本号", example = "v1.2")
private String version;
@Schema(description = "模板描述", example = "标准采购合同范本")
private String description;
@Schema(description = "模板内容HTML含占位符", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "模板内容不能为空")
private String content;
@Schema(description = "SQL配置JSON格式可选")
private String sqlConfig;
@Schema(description = "数据源标识", example = "default")
private String dataSource;
@Schema(description = "状态1=启用0=停用2=草稿)", example = "2")
private String enabled;
}

View File

@@ -0,0 +1,27 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 标签库分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DocTemplateTagPageReqVO extends PageParam {
@Schema(description = "标签名称", example = "合同编号")
private String tagName;
@Schema(description = "标签编码", example = "contractNo")
private String tagCode;
@Schema(description = "所属分类ID", example = "1")
private Long categoryId;
@Schema(description = "是否启用1=启用0=停用)", example = "1")
private String enabled;
}

View File

@@ -0,0 +1,63 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 标签库 Response VO")
@Data
public class DocTemplateTagRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "标签名称(中文)", requiredMode = Schema.RequiredMode.REQUIRED, example = "合同编号")
private String tagName;
@Schema(description = "标签编码Velocity变量名", requiredMode = Schema.RequiredMode.REQUIRED, example = "contractNo")
private String tagCode;
@Schema(description = "所属分类ID", example = "1")
private Long categoryId;
@Schema(description = "所属分类名称", example = "合同管理")
private String categoryName;
@Schema(description = "数据类型", example = "String")
private String dataType;
@Schema(description = "默认值", example = "")
private String defaultValue;
@Schema(description = "SQL脚本可选仅保存参考", example = "SELECT contract_no FROM contract_main WHERE id = #{businessId}")
private String sqlScript;
@Schema(description = "描述", example = "合同主表的合同编号字段")
private String description;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "是否启用1=启用0=停用)", example = "1")
private String enabled;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "创建人ID", example = "1")
private String creator;
@Schema(description = "创建人名称", example = "管理员")
private String creatorName;
@Schema(description = "更新时间")
private LocalDateTime updateTime;
@Schema(description = "更新人ID", example = "1")
private String updater;
@Schema(description = "更新人名称", example = "管理员")
private String updaterName;
}

View File

@@ -0,0 +1,44 @@
package com.zt.plat.module.base.controller.admin.doctemplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
@Schema(description = "管理后台 - 标签库新增/修改 Request VO")
@Data
public class DocTemplateTagSaveReqVO {
@Schema(description = "主键", example = "1024")
private Long id;
@Schema(description = "标签名称(中文)", requiredMode = Schema.RequiredMode.REQUIRED, example = "合同编号")
@NotBlank(message = "标签名称不能为空")
private String tagName;
@Schema(description = "标签编码Velocity变量名", requiredMode = Schema.RequiredMode.REQUIRED, example = "contractNo")
@NotBlank(message = "标签编码不能为空")
private String tagCode;
@Schema(description = "所属分类ID", example = "1")
private Long categoryId;
@Schema(description = "数据类型", example = "String")
private String dataType;
@Schema(description = "默认值", example = "")
private String defaultValue;
@Schema(description = "SQL脚本可选仅保存参考", example = "SELECT contract_no FROM contract_main WHERE id = #{businessId}")
private String sqlScript;
@Schema(description = "描述", example = "合同主表的合同编号字段")
private String description;
@Schema(description = "排序号", example = "1")
private Integer sort;
@Schema(description = "是否启用1=启用0=停用)", example = "1")
private String enabled;
}

View File

@@ -0,0 +1,138 @@
package com.zt.plat.module.base.controller.admin.materialclasses;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.materialclasses.vo.*;
import com.zt.plat.module.base.dal.dataobject.materialclasses.MaterialClassesDO;
import com.zt.plat.module.base.service.materialclasses.MaterialClassesService;
@Tag(name = "管理后台 - 物料分类")
@RestController
@RequestMapping("/base/material-classes")
@Validated
public class MaterialClassesController {
@Resource
private MaterialClassesService materialClassesService;
@PostMapping("/create")
@Operation(summary = "创建物料分类")
@PreAuthorize("@ss.hasPermission('base:material-classes:create')")
public CommonResult<MaterialClassesRespVO> createMaterialClasses(@Valid @RequestBody MaterialClassesSaveReqVO createReqVO) {
return success(materialClassesService.createMaterialClasses(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料分类")
@PreAuthorize("@ss.hasPermission('base:material-classes:update')")
public CommonResult<Boolean> updateMaterialClasses(@Valid @RequestBody MaterialClassesSaveReqVO updateReqVO) {
materialClassesService.updateMaterialClasses(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:material-classes:delete')")
public CommonResult<Boolean> deleteMaterialClasses(@RequestParam("id") Long id) {
materialClassesService.deleteMaterialClasses(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除物料分类")
@PreAuthorize("@ss.hasPermission('base:material-classes:delete')")
public CommonResult<Boolean> deleteMaterialClassesList(@RequestBody BatchDeleteReqVO req) {
materialClassesService.deleteMaterialClassesListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:material-classes:query')")
public CommonResult<MaterialClassesRespVO> getMaterialClasses(@RequestParam("id") Long id) {
MaterialClassesDO materialClasses = materialClassesService.getMaterialClasses(id);
return success(BeanUtils.toBean(materialClasses, MaterialClassesRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得物料分类分页")
@PreAuthorize("@ss.hasPermission('base:material-classes:query')")
public CommonResult<PageResult<MaterialClassesRespVO>> getMaterialClassesPage(@Valid MaterialClassesPageReqVO pageReqVO) {
PageResult<MaterialClassesDO> pageResult = materialClassesService.getMaterialClassesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialClassesRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料分类 Excel")
@PreAuthorize("@ss.hasPermission('base:material-classes:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialClassesExcel(@Valid MaterialClassesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialClassesDO> list = materialClassesService.getMaterialClassesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料分类.xls", "数据", MaterialClassesRespVO.class,
BeanUtils.toBean(list, MaterialClassesRespVO.class));
}
@GetMapping("/tree")
@Operation(summary = "获得物料分类树")
@PreAuthorize("@ss.hasPermission('base:material-classes:query')")
public CommonResult<List<MaterialClassesTreeRespVO>> getMaterialClassesTree() {
List<MaterialClassesDO> list = materialClassesService.getMaterialClassesList();
return success(buildTree(list));
}
private List<MaterialClassesTreeRespVO> buildTree(List<MaterialClassesDO> list) {
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
Map<Long, MaterialClassesTreeRespVO> nodeMap = new LinkedHashMap<>();
list.stream()
.sorted(Comparator.comparing(MaterialClassesDO::getId))
.forEach(item -> {
MaterialClassesTreeRespVO node = BeanUtils.toBean(item, MaterialClassesTreeRespVO.class);
nodeMap.put(node.getId(), node);
});
List<MaterialClassesTreeRespVO> roots = new ArrayList<>();
nodeMap.values().forEach(node -> {
Long parentId = node.getParentId();
if (parentId == null || parentId == 0 || !nodeMap.containsKey(parentId)) {
roots.add(node);
} else {
nodeMap.get(parentId).getChildren().add(node);
}
});
return roots;
}
}

View File

@@ -0,0 +1,35 @@
package com.zt.plat.module.base.controller.admin.materialclasses.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料分类分页 Request VO")
@Data
public class MaterialClassesPageReqVO extends PageParam {
@Schema(description = "父级ID", example = "20706")
private Long parentId;
@Schema(description = "分类编码")
private String code;
@Schema(description = "分类名称", example = "赵六")
private String name;
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
private Long level;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.materialclasses.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 物料分类 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialClassesRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4051")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "父级ID", example = "20706")
@ExcelProperty("父级ID")
private Long parentId;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("分类编码")
private String code;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("分类名称")
private String name;
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
@ExcelProperty("分类级别-用于类别层级(大/中/小类)")
private Long level;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.base.controller.admin.materialclasses.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 物料分类新增/修改 Request VO")
@Data
public class MaterialClassesSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4051")
private Long id;
@Schema(description = "父级ID", example = "20706")
private Long parentId;
@Schema(description = "分类编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "分类编码不能为空")
private String code;
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "分类名称不能为空")
private String name;
@Schema(description = "分类级别-用于类别层级(大/中/小类)")
private Long level;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
}

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.base.controller.admin.materialclasses.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Schema(description = "管理后台 - 物料分类树节点 Response VO")
@Data
public class MaterialClassesTreeRespVO {
@Schema(description = "主键ID", example = "1001")
private Long id;
@Schema(description = "父级ID", example = "0")
private Long parentId;
@Schema(description = "分类编码", example = "CL-001")
private String code;
@Schema(description = "分类名称", example = "原材料")
private String name;
@Schema(description = "分类级别")
private Long level;
@Schema(description = "备注")
private String remark;
@Schema(description = "子节点")
private List<MaterialClassesTreeRespVO> children = new ArrayList<>();
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.materialhasclasses;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.materialhasclasses.vo.*;
import com.zt.plat.module.base.dal.dataobject.materialhasclasses.MaterialHasClassesDO;
import com.zt.plat.module.base.service.materialhasclasses.MaterialHasClassesService;
@Tag(name = "管理后台 - 物料持有分类")
@RestController
@RequestMapping("/base/material-has-classes")
@Validated
public class MaterialHasClassesController {
@Resource
private MaterialHasClassesService materialHasClassesService;
@PostMapping("/create")
@Operation(summary = "创建物料持有分类")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:create')")
public CommonResult<MaterialHasClassesRespVO> createMaterialHasClasses(@Valid @RequestBody MaterialHasClassesSaveReqVO createReqVO) {
return success(materialHasClassesService.createMaterialHasClasses(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料持有分类")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:update')")
public CommonResult<Boolean> updateMaterialHasClasses(@Valid @RequestBody MaterialHasClassesSaveReqVO updateReqVO) {
materialHasClassesService.updateMaterialHasClasses(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料持有分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:material-has-classes:delete')")
public CommonResult<Boolean> deleteMaterialHasClasses(@RequestParam("id") Long id) {
materialHasClassesService.deleteMaterialHasClasses(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除物料持有分类")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:delete')")
public CommonResult<Boolean> deleteMaterialHasClassesList(@RequestBody BatchDeleteReqVO req) {
materialHasClassesService.deleteMaterialHasClassesListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料持有分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:query')")
public CommonResult<MaterialHasClassesRespVO> getMaterialHasClasses(@RequestParam("id") Long id) {
MaterialHasClassesDO materialHasClasses = materialHasClassesService.getMaterialHasClasses(id);
return success(BeanUtils.toBean(materialHasClasses, MaterialHasClassesRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得物料持有分类分页")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:query')")
public CommonResult<PageResult<MaterialHasClassesRespVO>> getMaterialHasClassesPage(@Valid MaterialHasClassesPageReqVO pageReqVO) {
PageResult<MaterialHasClassesDO> pageResult = materialHasClassesService.getMaterialHasClassesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialHasClassesRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料持有分类 Excel")
@PreAuthorize("@ss.hasPermission('base:material-has-classes:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialHasClassesExcel(@Valid MaterialHasClassesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialHasClassesDO> list = materialHasClassesService.getMaterialHasClassesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料持有分类.xls", "数据", MaterialHasClassesRespVO.class,
BeanUtils.toBean(list, MaterialHasClassesRespVO.class));
}
}

View File

@@ -0,0 +1,26 @@
package com.zt.plat.module.base.controller.admin.materialhasclasses.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料持有分类分页 Request VO")
@Data
public class MaterialHasClassesPageReqVO extends PageParam {
@Schema(description = "物料信息ID", example = "31031")
private Long infomationId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "分类ID", example = "5914")
private Long classesId;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.controller.admin.materialhasclasses.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 物料持有分类 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialHasClassesRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16228")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31031")
@ExcelProperty("物料信息ID")
private Long infomationId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5914")
@ExcelProperty("分类ID")
private Long classesId;
}

View File

@@ -0,0 +1,23 @@
package com.zt.plat.module.base.controller.admin.materialhasclasses.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 物料持有分类新增/修改 Request VO")
@Data
public class MaterialHasClassesSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16228")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31031")
@NotNull(message = "物料信息ID不能为空")
private Long infomationId;
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5914")
@NotNull(message = "分类ID不能为空")
private Long classesId;
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.materialhasproperties;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.*;
import com.zt.plat.module.base.dal.dataobject.materialhasproperties.MaterialHasPropertiesDO;
import com.zt.plat.module.base.service.materialhasproperties.MaterialHasPropertiesService;
@Tag(name = "管理后台 - 物料持有属性")
@RestController
@RequestMapping("/base/material-has-properties")
@Validated
public class MaterialHasPropertiesController {
@Resource
private MaterialHasPropertiesService materialHasPropertiesService;
@PostMapping("/create")
@Operation(summary = "创建物料持有属性")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:create')")
public CommonResult<MaterialHasPropertiesRespVO> createMaterialHasProperties(@Valid @RequestBody MaterialHasPropertiesSaveReqVO createReqVO) {
return success(materialHasPropertiesService.createMaterialHasProperties(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料持有属性")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:update')")
public CommonResult<Boolean> updateMaterialHasProperties(@Valid @RequestBody MaterialHasPropertiesSaveReqVO updateReqVO) {
materialHasPropertiesService.updateMaterialHasProperties(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料持有属性")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:material-has-properties:delete')")
public CommonResult<Boolean> deleteMaterialHasProperties(@RequestParam("id") Long id) {
materialHasPropertiesService.deleteMaterialHasProperties(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除物料持有属性")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:delete')")
public CommonResult<Boolean> deleteMaterialHasPropertiesList(@RequestBody BatchDeleteReqVO req) {
materialHasPropertiesService.deleteMaterialHasPropertiesListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料持有属性")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:query')")
public CommonResult<MaterialHasPropertiesRespVO> getMaterialHasProperties(@RequestParam("id") Long id) {
MaterialHasPropertiesDO materialHasProperties = materialHasPropertiesService.getMaterialHasProperties(id);
return success(BeanUtils.toBean(materialHasProperties, MaterialHasPropertiesRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得物料持有属性分页")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:query')")
public CommonResult<PageResult<MaterialHasPropertiesRespVO>> getMaterialHasPropertiesPage(@Valid MaterialHasPropertiesPageReqVO pageReqVO) {
PageResult<MaterialHasPropertiesDO> pageResult = materialHasPropertiesService.getMaterialHasPropertiesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialHasPropertiesRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料持有属性 Excel")
@PreAuthorize("@ss.hasPermission('base:material-has-properties:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialHasPropertiesExcel(@Valid MaterialHasPropertiesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialHasPropertiesDO> list = materialHasPropertiesService.getMaterialHasPropertiesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料持有属性.xls", "数据", MaterialHasPropertiesRespVO.class,
BeanUtils.toBean(list, MaterialHasPropertiesRespVO.class));
}
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.base.controller.admin.materialhasproperties.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料持有属性分页 Request VO")
@Data
public class MaterialHasPropertiesPageReqVO extends PageParam {
@Schema(description = "物料信息ID", example = "2614")
private Long infomationId;
@Schema(description = "属性ID", example = "8607")
private Long propertiesId;
@Schema(description = "计量单位ID-默认计量单位", example = "23731")
private Long unitId;
@Schema(description = "属性值")
private String value;
@Schema(description = "是否关键属性-关键属性表示物料唯一性")
private Integer isKey;
@Schema(description = "是否计量定价")
private Integer isMetering;
@Schema(description = "排序号")
private Long sort;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,51 @@
package com.zt.plat.module.base.controller.admin.materialhasproperties.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 物料持有属性 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialHasPropertiesRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6800")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2614")
@ExcelProperty("物料信息ID")
private Long infomationId;
@Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8607")
@ExcelProperty("属性ID")
private Long propertiesId;
@Schema(description = "计量单位ID-默认计量单位", example = "23731")
@ExcelProperty("计量单位ID-默认计量单位")
private Long unitId;
@Schema(description = "属性值", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("属性值")
private String value;
@Schema(description = "是否关键属性-关键属性表示物料唯一性")
@ExcelProperty("是否关键属性-关键属性表示物料唯一性")
private Integer isKey;
@Schema(description = "是否计量定价")
@ExcelProperty("是否计量定价")
private Integer isMetering;
@Schema(description = "排序号")
@ExcelProperty("排序号")
private Long sort;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,39 @@
package com.zt.plat.module.base.controller.admin.materialhasproperties.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 物料持有属性新增/修改 Request VO")
@Data
public class MaterialHasPropertiesSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6800")
private Long id;
@Schema(description = "物料信息ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2614")
@NotNull(message = "物料信息ID不能为空")
private Long infomationId;
@Schema(description = "属性ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8607")
@NotNull(message = "属性ID不能为空")
private Long propertiesId;
@Schema(description = "计量单位ID-默认计量单位", example = "23731")
private Long unitId;
@Schema(description = "属性值", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "属性值不能为空")
private String value;
@Schema(description = "是否关键属性-关键属性表示物料唯一性")
private Integer isKey;
@Schema(description = "是否计量定价")
private Integer isMetering;
@Schema(description = "排序号")
private Long sort;
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.materialproperties;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.materialproperties.vo.*;
import com.zt.plat.module.base.dal.dataobject.materialproperties.MaterialPropertiesDO;
import com.zt.plat.module.base.service.materialproperties.MaterialPropertiesService;
@Tag(name = "管理后台 - 物料属性")
@RestController
@RequestMapping("/base/material-properties")
@Validated
public class MaterialPropertiesController {
@Resource
private MaterialPropertiesService materialPropertiesService;
@PostMapping("/create")
@Operation(summary = "创建物料属性")
@PreAuthorize("@ss.hasPermission('base:material-properties:create')")
public CommonResult<MaterialPropertiesRespVO> createMaterialProperties(@Valid @RequestBody MaterialPropertiesSaveReqVO createReqVO) {
return success(materialPropertiesService.createMaterialProperties(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料属性")
@PreAuthorize("@ss.hasPermission('base:material-properties:update')")
public CommonResult<Boolean> updateMaterialProperties(@Valid @RequestBody MaterialPropertiesSaveReqVO updateReqVO) {
materialPropertiesService.updateMaterialProperties(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料属性")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:material-properties:delete')")
public CommonResult<Boolean> deleteMaterialProperties(@RequestParam("id") Long id) {
materialPropertiesService.deleteMaterialProperties(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除物料属性")
@PreAuthorize("@ss.hasPermission('base:material-properties:delete')")
public CommonResult<Boolean> deleteMaterialPropertiesList(@RequestBody BatchDeleteReqVO req) {
materialPropertiesService.deleteMaterialPropertiesListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料属性")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:material-properties:query')")
public CommonResult<MaterialPropertiesRespVO> getMaterialProperties(@RequestParam("id") Long id) {
MaterialPropertiesDO materialProperties = materialPropertiesService.getMaterialProperties(id);
return success(BeanUtils.toBean(materialProperties, MaterialPropertiesRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得物料属性分页")
@PreAuthorize("@ss.hasPermission('base:material-properties:query')")
public CommonResult<PageResult<MaterialPropertiesRespVO>> getMaterialPropertiesPage(@Valid MaterialPropertiesPageReqVO pageReqVO) {
PageResult<MaterialPropertiesDO> pageResult = materialPropertiesService.getMaterialPropertiesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialPropertiesRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料属性 Excel")
@PreAuthorize("@ss.hasPermission('base:material-properties:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialPropertiesExcel(@Valid MaterialPropertiesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialPropertiesDO> list = materialPropertiesService.getMaterialPropertiesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料属性.xls", "数据", MaterialPropertiesRespVO.class,
BeanUtils.toBean(list, MaterialPropertiesRespVO.class));
}
}

View File

@@ -0,0 +1,38 @@
package com.zt.plat.module.base.controller.admin.materialproperties.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 物料属性分页 Request VO")
@Data
public class MaterialPropertiesPageReqVO extends PageParam {
@Schema(description = "属性编码")
private String code;
@Schema(description = "属性名称", example = "芋艿")
private String name;
@Schema(description = "计量单位量ID", example = "30468")
private Long unitQuantityId;
@Schema(description = "业务字典数据值")
private String dictionaryDataValue;
@Schema(description = "数据类型", example = "1")
private String dataType;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,47 @@
package com.zt.plat.module.base.controller.admin.materialproperties.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 物料属性 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialPropertiesRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10591")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "属性编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("属性编码")
private String code;
@Schema(description = "属性名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("属性名称")
private String name;
@Schema(description = "计量单位量ID", example = "30468")
@ExcelProperty("计量单位量ID")
private Long unitQuantityId;
@Schema(description = "业务字典数据值", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("业务字典数据值")
private String dictionaryDataValue;
@Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("数据类型")
private String dataType;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,38 @@
package com.zt.plat.module.base.controller.admin.materialproperties.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 物料属性新增/修改 Request VO")
@Data
public class MaterialPropertiesSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10591")
private Long id;
@Schema(description = "属性编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "属性编码不能为空")
private String code;
@Schema(description = "属性名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "属性名称不能为空")
private String name;
@Schema(description = "计量单位量ID", example = "30468")
private Long unitQuantityId;
@Schema(description = "业务字典数据值", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "业务字典数据值不能为空")
private String dictionaryDataValue;
@Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "数据类型不能为空")
private String dataType;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
}

View File

@@ -0,0 +1,138 @@
package com.zt.plat.module.base.controller.admin.processinginfomation;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.processinginfomation.vo.*;
import com.zt.plat.module.base.dal.dataobject.processinginfomation.ProcessingInfomationDO;
import com.zt.plat.module.base.service.processinginfomation.ProcessingInfomationService;
@Tag(name = "管理后台 - 工艺信息")
@RestController
@RequestMapping("/base/processing-infomation")
@Validated
public class ProcessingInfomationController {
@Resource
private ProcessingInfomationService processingInfomationService;
@PostMapping("/create")
@Operation(summary = "创建工艺信息")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:create')")
public CommonResult<ProcessingInfomationRespVO> createProcessingInfomation(@Valid @RequestBody ProcessingInfomationSaveReqVO createReqVO) {
return success(processingInfomationService.createProcessingInfomation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新工艺信息")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:update')")
public CommonResult<Boolean> updateProcessingInfomation(@Valid @RequestBody ProcessingInfomationSaveReqVO updateReqVO) {
processingInfomationService.updateProcessingInfomation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除工艺信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:processing-infomation:delete')")
public CommonResult<Boolean> deleteProcessingInfomation(@RequestParam("id") Long id) {
processingInfomationService.deleteProcessingInfomation(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除工艺信息")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:delete')")
public CommonResult<Boolean> deleteProcessingInfomationList(@RequestBody BatchDeleteReqVO req) {
processingInfomationService.deleteProcessingInfomationListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得工艺信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:query')")
public CommonResult<ProcessingInfomationRespVO> getProcessingInfomation(@RequestParam("id") Long id) {
ProcessingInfomationDO processingInfomation = processingInfomationService.getProcessingInfomation(id);
return success(BeanUtils.toBean(processingInfomation, ProcessingInfomationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得工艺信息分页")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:query')")
public CommonResult<PageResult<ProcessingInfomationRespVO>> getProcessingInfomationPage(@Valid ProcessingInfomationPageReqVO pageReqVO) {
PageResult<ProcessingInfomationDO> pageResult = processingInfomationService.getProcessingInfomationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProcessingInfomationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出工艺信息 Excel")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProcessingInfomationExcel(@Valid ProcessingInfomationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProcessingInfomationDO> list = processingInfomationService.getProcessingInfomationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "工艺信息.xls", "数据", ProcessingInfomationRespVO.class,
BeanUtils.toBean(list, ProcessingInfomationRespVO.class));
}
@GetMapping("/tree")
@Operation(summary = "获得工艺信息树")
@PreAuthorize("@ss.hasPermission('base:processing-infomation:query')")
public CommonResult<List<ProcessingInfomationTreeRespVO>> getProcessingInfomationTree() {
List<ProcessingInfomationDO> list = processingInfomationService.getProcessingInfomationList();
return success(buildTree(list));
}
private List<ProcessingInfomationTreeRespVO> buildTree(List<ProcessingInfomationDO> list) {
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
Map<Long, ProcessingInfomationTreeRespVO> nodeMap = new LinkedHashMap<>();
list.stream()
.sorted(Comparator.comparing(ProcessingInfomationDO::getId))
.forEach(item -> {
ProcessingInfomationTreeRespVO node = BeanUtils.toBean(item, ProcessingInfomationTreeRespVO.class);
nodeMap.put(node.getId(), node);
});
List<ProcessingInfomationTreeRespVO> roots = new ArrayList<>();
nodeMap.values().forEach(node -> {
Long parentId = node.getParentId();
if (parentId == null || parentId == 0 || !nodeMap.containsKey(parentId)) {
roots.add(node);
} else {
nodeMap.get(parentId).getChildren().add(node);
}
});
return roots;
}
}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.base.controller.admin.processinginfomation.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 工艺信息分页 Request VO")
@Data
public class ProcessingInfomationPageReqVO extends PageParam {
@Schema(description = "父级ID", example = "16823")
private Long parentId;
@Schema(description = "工艺编码-唯一业务键")
private String code;
@Schema(description = "工艺名称", example = "赵六")
private String name;
@Schema(description = "工艺类型值")
private Long typeValue;
@Schema(description = "状态值-工艺状态")
private String statusValue;
@Schema(description = "工艺描述")
private String description;
@Schema(description = "生效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] effectiveDate;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,51 @@
package com.zt.plat.module.base.controller.admin.processinginfomation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 工艺信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProcessingInfomationRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16240")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "父级ID", example = "16823")
@ExcelProperty("父级ID")
private Long parentId;
@Schema(description = "工艺编码-唯一业务键", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("工艺编码-唯一业务键")
private String code;
@Schema(description = "工艺名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("工艺名称")
private String name;
@Schema(description = "工艺类型值")
@ExcelProperty("工艺类型值")
private Long typeValue;
@Schema(description = "状态值-工艺状态", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("状态值-工艺状态")
private String statusValue;
@Schema(description = "工艺描述", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("工艺描述")
private String description;
@Schema(description = "生效日期")
@ExcelProperty("生效日期")
private LocalDateTime effectiveDate;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.base.controller.admin.processinginfomation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 工艺信息新增/修改 Request VO")
@Data
public class ProcessingInfomationSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16240")
private Long id;
@Schema(description = "父级ID", example = "16823")
private Long parentId;
@Schema(description = "工艺编码-唯一业务键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "工艺编码-唯一业务键不能为空")
private String code;
@Schema(description = "工艺名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "工艺名称不能为空")
private String name;
@Schema(description = "工艺类型值")
private Long typeValue;
@Schema(description = "状态值-工艺状态", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "状态值-工艺状态不能为空")
private String statusValue;
@Schema(description = "工艺描述", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "工艺描述不能为空")
private String description;
@Schema(description = "生效日期")
private LocalDateTime effectiveDate;
}

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.base.controller.admin.processinginfomation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Schema(description = "管理后台 - 工艺信息树节点 Response VO")
@Data
public class ProcessingInfomationTreeRespVO {
@Schema(description = "主键ID", example = "1001")
private Long id;
@Schema(description = "父级ID", example = "0")
private Long parentId;
@Schema(description = "工艺编码", example = "PRC-001")
private String code;
@Schema(description = "工艺名称", example = "熔铸")
private String name;
@Schema(description = "工艺类型值")
private Long typeValue;
@Schema(description = "状态值-工艺状态")
private String statusValue;
@Schema(description = "子节点")
private List<ProcessingInfomationTreeRespVO> children = new ArrayList<>();
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.processinginfomationoperation;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo.*;
import com.zt.plat.module.base.dal.dataobject.processinginfomationoperation.ProcessingInfomationOperationDO;
import com.zt.plat.module.base.service.processinginfomationoperation.ProcessingInfomationOperationService;
@Tag(name = "管理后台 - 工艺工序")
@RestController
@RequestMapping("/base/processing-infomation-operation")
@Validated
public class ProcessingInfomationOperationController {
@Resource
private ProcessingInfomationOperationService processingInfomationOperationService;
@PostMapping("/create")
@Operation(summary = "创建工艺工序")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:create')")
public CommonResult<ProcessingInfomationOperationRespVO> createProcessingInfomationOperation(@Valid @RequestBody ProcessingInfomationOperationSaveReqVO createReqVO) {
return success(processingInfomationOperationService.createProcessingInfomationOperation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新工艺工序")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:update')")
public CommonResult<Boolean> updateProcessingInfomationOperation(@Valid @RequestBody ProcessingInfomationOperationSaveReqVO updateReqVO) {
processingInfomationOperationService.updateProcessingInfomationOperation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除工艺工序")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:delete')")
public CommonResult<Boolean> deleteProcessingInfomationOperation(@RequestParam("id") Long id) {
processingInfomationOperationService.deleteProcessingInfomationOperation(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除工艺工序")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:delete')")
public CommonResult<Boolean> deleteProcessingInfomationOperationList(@RequestBody BatchDeleteReqVO req) {
processingInfomationOperationService.deleteProcessingInfomationOperationListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得工艺工序")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:query')")
public CommonResult<ProcessingInfomationOperationRespVO> getProcessingInfomationOperation(@RequestParam("id") Long id) {
ProcessingInfomationOperationDO processingInfomationOperation = processingInfomationOperationService.getProcessingInfomationOperation(id);
return success(BeanUtils.toBean(processingInfomationOperation, ProcessingInfomationOperationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得工艺工序分页")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:query')")
public CommonResult<PageResult<ProcessingInfomationOperationRespVO>> getProcessingInfomationOperationPage(@Valid ProcessingInfomationOperationPageReqVO pageReqVO) {
PageResult<ProcessingInfomationOperationRespVO> pageResult = processingInfomationOperationService.getProcessingInfomationOperationDetailPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出工艺工序 Excel")
@PreAuthorize("@ss.hasPermission('base:processing-infomation-operation:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProcessingInfomationOperationExcel(@Valid ProcessingInfomationOperationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProcessingInfomationOperationRespVO> list = processingInfomationOperationService.getProcessingInfomationOperationDetailList(pageReqVO);
// 导出 Excel
ExcelUtils.write(response, "工艺工序.xls", "数据", ProcessingInfomationOperationRespVO.class,
list);
}
}

View File

@@ -0,0 +1,41 @@
package com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 工艺工序分页 Request VO")
@Data
public class ProcessingInfomationOperationPageReqVO extends PageParam {
@Schema(description = "前序工序ID", example = "14658")
private Long previousOperationId;
@Schema(description = "后续工序ID", example = "22110")
private Long nextOperationId;
@Schema(description = "工艺ID", example = "5773")
private Long processingId;
@Schema(description = "是否关键工序")
private Integer isKey;
@Schema(description = "备注")
private String remark;
@Schema(description = "后续工序编码")
private String nextOperationCode;
@Schema(description = "后续工序名称")
private String nextOperationName;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,59 @@
package com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 工艺工序 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProcessingInfomationOperationRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29694")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "前序工序ID", example = "14658")
@ExcelProperty("前序工序ID")
private Long previousOperationId;
@Schema(description = "前序工序编码")
@ExcelProperty("前序工序编码")
private String previousOperationCode;
@Schema(description = "前序工序名称")
@ExcelProperty("前序工序名称")
private String previousOperationName;
@Schema(description = "后续工序ID", example = "22110")
@ExcelProperty("后续工序ID")
private Long nextOperationId;
@Schema(description = "后续工序编码")
@ExcelProperty("后续工序编码")
private String nextOperationCode;
@Schema(description = "后续工序名称")
@ExcelProperty("后续工序名称")
private String nextOperationName;
@Schema(description = "工艺ID", example = "5773")
@ExcelProperty("工艺ID")
private Long processingId;
@Schema(description = "是否关键工序")
@ExcelProperty("是否关键工序")
private Integer isKey;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 工艺工序新增/修改 Request VO")
@Data
public class ProcessingInfomationOperationSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29694")
private Long id;
@Schema(description = "前序工序ID", example = "14658")
private Long previousOperationId;
@Schema(description = "后续工序ID", example = "22110")
private Long nextOperationId;
@Schema(description = "工艺ID", example = "5773")
private Long processingId;
@Schema(description = "是否关键工序")
private Integer isKey;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
}

View File

@@ -0,0 +1,115 @@
package com.zt.plat.module.base.controller.admin.processingoperation;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.processingoperation.vo.*;
import com.zt.plat.module.base.dal.dataobject.processingoperation.ProcessingOperationDO;
import com.zt.plat.module.base.service.processingoperation.ProcessingOperationService;
@Tag(name = "管理后台 - 工序")
@RestController
@RequestMapping("/base/processing-operation")
@Validated
public class ProcessingOperationController {
@Resource
private ProcessingOperationService processingOperationService;
@PostMapping("/create")
@Operation(summary = "创建工序")
@PreAuthorize("@ss.hasPermission('base:processing-operation:create')")
public CommonResult<ProcessingOperationRespVO> createProcessingOperation(@Valid @RequestBody ProcessingOperationSaveReqVO createReqVO) {
return success(processingOperationService.createProcessingOperation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新工序")
@PreAuthorize("@ss.hasPermission('base:processing-operation:update')")
public CommonResult<Boolean> updateProcessingOperation(@Valid @RequestBody ProcessingOperationSaveReqVO updateReqVO) {
processingOperationService.updateProcessingOperation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除工序")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:processing-operation:delete')")
public CommonResult<Boolean> deleteProcessingOperation(@RequestParam("id") Long id) {
processingOperationService.deleteProcessingOperation(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除工序")
@PreAuthorize("@ss.hasPermission('base:processing-operation:delete')")
public CommonResult<Boolean> deleteProcessingOperationList(@RequestBody BatchDeleteReqVO req) {
processingOperationService.deleteProcessingOperationListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得工序")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:processing-operation:query')")
public CommonResult<ProcessingOperationRespVO> getProcessingOperation(@RequestParam("id") Long id) {
ProcessingOperationDO processingOperation = processingOperationService.getProcessingOperation(id);
return success(BeanUtils.toBean(processingOperation, ProcessingOperationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得工序分页")
@PreAuthorize("@ss.hasPermission('base:processing-operation:query')")
public CommonResult<PageResult<ProcessingOperationRespVO>> getProcessingOperationPage(@Valid ProcessingOperationPageReqVO pageReqVO) {
PageResult<ProcessingOperationDO> pageResult = processingOperationService.getProcessingOperationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProcessingOperationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出工序 Excel")
@PreAuthorize("@ss.hasPermission('base:processing-operation:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProcessingOperationExcel(@Valid ProcessingOperationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProcessingOperationDO> list = processingOperationService.getProcessingOperationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "工序.xls", "数据", ProcessingOperationRespVO.class,
BeanUtils.toBean(list, ProcessingOperationRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得工序简单列表")
@PreAuthorize("@ss.hasPermission('base:processing-operation:query')")
public CommonResult<List<ProcessingOperationSimpleRespVO>> getProcessingOperationSimpleList() {
List<ProcessingOperationDO> list = processingOperationService.getProcessingOperationList();
return success(BeanUtils.toBean(list, ProcessingOperationSimpleRespVO.class));
}
}

View File

@@ -0,0 +1,35 @@
package com.zt.plat.module.base.controller.admin.processingoperation.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 工序分页 Request VO")
@Data
public class ProcessingOperationPageReqVO extends PageParam {
@Schema(description = "工序编码")
private String code;
@Schema(description = "工序名称", example = "王五")
private String name;
@Schema(description = "排序号")
private Long sort;
@Schema(description = "类型值-工序类型")
private String typeValue;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.processingoperation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 工序 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProcessingOperationRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14097")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "工序编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("工序编码")
private String code;
@Schema(description = "工序名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("工序名称")
private String name;
@Schema(description = "排序号")
@ExcelProperty("排序号")
private Long sort;
@Schema(description = "类型值-工序类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("类型值-工序类型")
private String typeValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.base.controller.admin.processingoperation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 工序新增/修改 Request VO")
@Data
public class ProcessingOperationSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14097")
private Long id;
@Schema(description = "工序编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "工序编码不能为空")
private String code;
@Schema(description = "工序名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "工序名称不能为空")
private String name;
@Schema(description = "排序号")
private Long sort;
@Schema(description = "类型值-工序类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "类型值-工序类型不能为空")
private String typeValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
}

View File

@@ -0,0 +1,19 @@
package com.zt.plat.module.base.controller.admin.processingoperation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 工序简单信息 Response VO")
@Data
public class ProcessingOperationSimpleRespVO {
@Schema(description = "工序ID", example = "1001")
private Long id;
@Schema(description = "工序编码", example = "OP-001")
private String code;
@Schema(description = "工序名称", example = "熔铸")
private String name;
}

View File

@@ -0,0 +1,107 @@
package com.zt.plat.module.base.controller.admin.processingoperationmaterial;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.base.controller.admin.processingoperationmaterial.vo.*;
import com.zt.plat.module.base.dal.dataobject.processingoperationmaterial.ProcessingOperationMaterialDO;
import com.zt.plat.module.base.service.processingoperationmaterial.ProcessingOperationMaterialService;
@Tag(name = "管理后台 - 工艺工序物料")
@RestController
@RequestMapping("/base/processing-operation-material")
@Validated
public class ProcessingOperationMaterialController {
@Resource
private ProcessingOperationMaterialService processingOperationMaterialService;
@PostMapping("/create")
@Operation(summary = "创建工艺工序物料")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:create')")
public CommonResult<ProcessingOperationMaterialRespVO> createProcessingOperationMaterial(@Valid @RequestBody ProcessingOperationMaterialSaveReqVO createReqVO) {
return success(processingOperationMaterialService.createProcessingOperationMaterial(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新工艺工序物料")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:update')")
public CommonResult<Boolean> updateProcessingOperationMaterial(@Valid @RequestBody ProcessingOperationMaterialSaveReqVO updateReqVO) {
processingOperationMaterialService.updateProcessingOperationMaterial(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除工艺工序物料")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:delete')")
public CommonResult<Boolean> deleteProcessingOperationMaterial(@RequestParam("id") Long id) {
processingOperationMaterialService.deleteProcessingOperationMaterial(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除工艺工序物料")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:delete')")
public CommonResult<Boolean> deleteProcessingOperationMaterialList(@RequestBody BatchDeleteReqVO req) {
processingOperationMaterialService.deleteProcessingOperationMaterialListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得工艺工序物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:query')")
public CommonResult<ProcessingOperationMaterialRespVO> getProcessingOperationMaterial(@RequestParam("id") Long id) {
ProcessingOperationMaterialDO processingOperationMaterial = processingOperationMaterialService.getProcessingOperationMaterial(id);
return success(BeanUtils.toBean(processingOperationMaterial, ProcessingOperationMaterialRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得工艺工序物料分页")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:query')")
public CommonResult<PageResult<ProcessingOperationMaterialRespVO>> getProcessingOperationMaterialPage(@Valid ProcessingOperationMaterialPageReqVO pageReqVO) {
PageResult<ProcessingOperationMaterialDO> pageResult = processingOperationMaterialService.getProcessingOperationMaterialPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProcessingOperationMaterialRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出工艺工序物料 Excel")
@PreAuthorize("@ss.hasPermission('base:processing-operation-material:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProcessingOperationMaterialExcel(@Valid ProcessingOperationMaterialPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProcessingOperationMaterialDO> list = processingOperationMaterialService.getProcessingOperationMaterialPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "工艺工序物料.xls", "数据", ProcessingOperationMaterialRespVO.class,
BeanUtils.toBean(list, ProcessingOperationMaterialRespVO.class));
}
}

View File

@@ -0,0 +1,29 @@
package com.zt.plat.module.base.controller.admin.processingoperationmaterial.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 工艺工序物料分页 Request VO")
@Data
public class ProcessingOperationMaterialPageReqVO extends PageParam {
@Schema(description = "类型值-物料类型(产出/投入)")
private String typeValue;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "组织机构")
private String departmentIds;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.processingoperationmaterial.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 工艺工序物料 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProcessingOperationMaterialRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27200")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "工艺工序ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18575")
@ExcelProperty("工艺工序ID")
private Long processingOperationId;
@Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15117")
@ExcelProperty("物料ID")
private Long materialId;
@Schema(description = "类型值-物料类型(产出/投入)", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("类型值-物料类型(产出/投入)")
private String typeValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "组织机构")
@ExcelProperty("组织机构")
private String departmentIds;
}

View File

@@ -0,0 +1,32 @@
package com.zt.plat.module.base.controller.admin.processingoperationmaterial.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 工艺工序物料新增/修改 Request VO")
@Data
public class ProcessingOperationMaterialSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27200")
private Long id;
@Schema(description = "工艺工序ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18575")
private Long processingOperationId;
@Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15117")
private Long materialId;
@Schema(description = "类型值-物料类型(产出/投入)", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "类型值-物料类型(产出/投入)不能为空")
private String typeValue;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "备注不能为空")
private String remark;
@Schema(description = "组织机构")
private String departmentIds;
}

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.base.convert.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategorySaveReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateCategoryDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 模板分类 Convert
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateCategoryConvert {
DocTemplateCategoryConvert INSTANCE = Mappers.getMapper(DocTemplateCategoryConvert.class);
DocTemplateCategoryDO convert(DocTemplateCategorySaveReqVO bean);
DocTemplateCategoryRespVO convert(DocTemplateCategoryDO bean);
List<DocTemplateCategoryRespVO> convertList(List<DocTemplateCategoryDO> list);
PageResult<DocTemplateCategoryRespVO> convertPage(PageResult<DocTemplateCategoryDO> page);
}

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.base.convert.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 模板 Convert
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateConvert {
DocTemplateConvert INSTANCE = Mappers.getMapper(DocTemplateConvert.class);
DocTemplateDO convert(DocTemplateSaveReqVO bean);
DocTemplateRespVO convert(DocTemplateDO bean);
List<DocTemplateRespVO> convertList(List<DocTemplateDO> list);
PageResult<DocTemplateRespVO> convertPage(PageResult<DocTemplateDO> page);
}

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.base.convert.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateInstanceDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 模板实例 Convert
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateInstanceConvert {
DocTemplateInstanceConvert INSTANCE = Mappers.getMapper(DocTemplateInstanceConvert.class);
DocTemplateInstanceDO convert(DocTemplateInstanceSaveReqVO bean);
DocTemplateInstanceRespVO convert(DocTemplateInstanceDO bean);
List<DocTemplateInstanceRespVO> convertList(List<DocTemplateInstanceDO> list);
PageResult<DocTemplateInstanceRespVO> convertPage(PageResult<DocTemplateInstanceDO> page);
}

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.base.convert.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateTagDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 标签库 Convert
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateTagConvert {
DocTemplateTagConvert INSTANCE = Mappers.getMapper(DocTemplateTagConvert.class);
DocTemplateTagDO convert(DocTemplateTagSaveReqVO bean);
DocTemplateTagRespVO convert(DocTemplateTagDO bean);
List<DocTemplateTagRespVO> convertList(List<DocTemplateTagDO> list);
PageResult<DocTemplateTagRespVO> convertPage(PageResult<DocTemplateTagDO> page);
}

View File

@@ -0,0 +1,32 @@
package com.zt.plat.module.base.dal.dao.departmentmaterial;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.departmentmaterial.DepartmentMaterialDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.departmentmaterial.vo.*;
/**
* 组织架构物料 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface DepartmentMaterialMapper extends BaseMapperX<DepartmentMaterialDO> {
default PageResult<DepartmentMaterialDO> selectPage(DepartmentMaterialPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DepartmentMaterialDO>()
.eqIfPresent(DepartmentMaterialDO::getInfomationId, reqVO.getInfomationId())
.inIfPresent(DepartmentMaterialDO::getInfomationId, reqVO.getInfomationIds())
.eqIfPresent(DepartmentMaterialDO::getClassesId, reqVO.getClassesId())
.eqIfPresent(DepartmentMaterialDO::getDeptId, reqVO.getDeptId())
.eqIfPresent(DepartmentMaterialDO::getDictionaryDataValue, reqVO.getDictionaryDataValue())
.eqIfPresent(DepartmentMaterialDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DepartmentMaterialDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DepartmentMaterialDO::getId));
}
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.base.dal.dao.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateCategoryDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 模板分类 Mapper
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateCategoryMapper extends BaseMapperX<DocTemplateCategoryDO> {
default PageResult<DocTemplateCategoryDO> selectPage(DocTemplateCategoryPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DocTemplateCategoryDO>()
.likeIfPresent(DocTemplateCategoryDO::getCategoryName, reqVO.getCategoryName())
.eqIfPresent(DocTemplateCategoryDO::getCategoryCode, reqVO.getCategoryCode())
.eqIfPresent(DocTemplateCategoryDO::getParentId, reqVO.getParentId())
.eqIfPresent(DocTemplateCategoryDO::getLevel, reqVO.getLevel())
.orderByAsc(DocTemplateCategoryDO::getSort)
.orderByDesc(DocTemplateCategoryDO::getId));
}
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.base.dal.dao.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstancePageReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateInstanceDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 模板实例 Mapper
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateInstanceMapper extends BaseMapperX<DocTemplateInstanceDO> {
default PageResult<DocTemplateInstanceDO> selectPage(DocTemplateInstancePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DocTemplateInstanceDO>()
.likeIfPresent(DocTemplateInstanceDO::getInstanceName, reqVO.getInstanceName())
.eqIfPresent(DocTemplateInstanceDO::getTemplateId, reqVO.getTemplateId())
.eqIfPresent(DocTemplateInstanceDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(DocTemplateInstanceDO::getStatus, reqVO.getStatus())
.betweenIfPresent(DocTemplateInstanceDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DocTemplateInstanceDO::getId));
}
}

View File

@@ -0,0 +1,29 @@
package com.zt.plat.module.base.dal.dao.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplatePageReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 模板 Mapper
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateMapper extends BaseMapperX<DocTemplateDO> {
default PageResult<DocTemplateDO> selectPage(DocTemplatePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DocTemplateDO>()
.likeIfPresent(DocTemplateDO::getTmplName, reqVO.getTmplName())
.likeIfPresent(DocTemplateDO::getTmplCode, reqVO.getTmplCode())
.eqIfPresent(DocTemplateDO::getBigCategoryId, reqVO.getBigCategoryId())
.eqIfPresent(DocTemplateDO::getSmallCategoryId, reqVO.getSmallCategoryId())
.eqIfPresent(DocTemplateDO::getEnabled, reqVO.getEnabled())
.betweenIfPresent(DocTemplateDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DocTemplateDO::getId));
}
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.base.dal.dao.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateTagPageReqVO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateTagDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 标签库 Mapper
*
* @author 系统生成
*/
@Mapper
public interface DocTemplateTagMapper extends BaseMapperX<DocTemplateTagDO> {
default PageResult<DocTemplateTagDO> selectPage(DocTemplateTagPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DocTemplateTagDO>()
.likeIfPresent(DocTemplateTagDO::getTagName, reqVO.getTagName())
.likeIfPresent(DocTemplateTagDO::getTagCode, reqVO.getTagCode())
.eqIfPresent(DocTemplateTagDO::getCategoryId, reqVO.getCategoryId())
.eqIfPresent(DocTemplateTagDO::getEnabled, reqVO.getEnabled())
.orderByAsc(DocTemplateTagDO::getSort)
.orderByDesc(DocTemplateTagDO::getId));
}
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.dal.dao.materialclasses;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.materialclasses.MaterialClassesDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.materialclasses.vo.*;
/**
* 物料分类 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface MaterialClassesMapper extends BaseMapperX<MaterialClassesDO> {
default PageResult<MaterialClassesDO> selectPage(MaterialClassesPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialClassesDO>()
.eqIfPresent(MaterialClassesDO::getParentId, reqVO.getParentId())
.eqIfPresent(MaterialClassesDO::getCode, reqVO.getCode())
.likeIfPresent(MaterialClassesDO::getName, reqVO.getName())
.eqIfPresent(MaterialClassesDO::getLevel, reqVO.getLevel())
.eqIfPresent(MaterialClassesDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialClassesDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialClassesDO::getId));
}
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.base.dal.dao.materialhasclasses;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.materialhasclasses.MaterialHasClassesDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.materialhasclasses.vo.*;
/**
* 物料持有分类 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface MaterialHasClassesMapper extends BaseMapperX<MaterialHasClassesDO> {
default PageResult<MaterialHasClassesDO> selectPage(MaterialHasClassesPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialHasClassesDO>()
.eqIfPresent(MaterialHasClassesDO::getInfomationId, reqVO.getInfomationId())
.betweenIfPresent(MaterialHasClassesDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(MaterialHasClassesDO::getClassesId, reqVO.getClassesId())
.orderByDesc(MaterialHasClassesDO::getId));
}
}

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.base.dal.dao.materialhasproperties;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.materialhasproperties.MaterialHasPropertiesDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.materialhasproperties.vo.*;
/**
* 物料持有属性 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface MaterialHasPropertiesMapper extends BaseMapperX<MaterialHasPropertiesDO> {
default PageResult<MaterialHasPropertiesDO> selectPage(MaterialHasPropertiesPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialHasPropertiesDO>()
.eqIfPresent(MaterialHasPropertiesDO::getInfomationId, reqVO.getInfomationId())
.eqIfPresent(MaterialHasPropertiesDO::getPropertiesId, reqVO.getPropertiesId())
.eqIfPresent(MaterialHasPropertiesDO::getUnitId, reqVO.getUnitId())
.eqIfPresent(MaterialHasPropertiesDO::getValue, reqVO.getValue())
.eqIfPresent(MaterialHasPropertiesDO::getIsKey, reqVO.getIsKey())
.eqIfPresent(MaterialHasPropertiesDO::getIsMetering, reqVO.getIsMetering())
.eqIfPresent(MaterialHasPropertiesDO::getSort, reqVO.getSort())
.betweenIfPresent(MaterialHasPropertiesDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialHasPropertiesDO::getId));
}
}

View File

@@ -0,0 +1,32 @@
package com.zt.plat.module.base.dal.dao.materialproperties;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.materialproperties.MaterialPropertiesDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.materialproperties.vo.*;
/**
* 物料属性 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface MaterialPropertiesMapper extends BaseMapperX<MaterialPropertiesDO> {
default PageResult<MaterialPropertiesDO> selectPage(MaterialPropertiesPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialPropertiesDO>()
.eqIfPresent(MaterialPropertiesDO::getCode, reqVO.getCode())
.likeIfPresent(MaterialPropertiesDO::getName, reqVO.getName())
.eqIfPresent(MaterialPropertiesDO::getUnitQuantityId, reqVO.getUnitQuantityId())
.eqIfPresent(MaterialPropertiesDO::getDictionaryDataValue, reqVO.getDictionaryDataValue())
.eqIfPresent(MaterialPropertiesDO::getDataType, reqVO.getDataType())
.eqIfPresent(MaterialPropertiesDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialPropertiesDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialPropertiesDO::getId));
}
}

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.base.dal.dao.processinginfomation;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.processinginfomation.ProcessingInfomationDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processinginfomation.vo.*;
/**
* 工艺信息 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ProcessingInfomationMapper extends BaseMapperX<ProcessingInfomationDO> {
default PageResult<ProcessingInfomationDO> selectPage(ProcessingInfomationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingInfomationDO>()
.eqIfPresent(ProcessingInfomationDO::getParentId, reqVO.getParentId())
.eqIfPresent(ProcessingInfomationDO::getCode, reqVO.getCode())
.likeIfPresent(ProcessingInfomationDO::getName, reqVO.getName())
.eqIfPresent(ProcessingInfomationDO::getTypeValue, reqVO.getTypeValue())
.eqIfPresent(ProcessingInfomationDO::getStatusValue, reqVO.getStatusValue())
.eqIfPresent(ProcessingInfomationDO::getDescription, reqVO.getDescription())
.betweenIfPresent(ProcessingInfomationDO::getEffectiveDate, reqVO.getEffectiveDate())
.betweenIfPresent(ProcessingInfomationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProcessingInfomationDO::getId));
}
}

View File

@@ -0,0 +1,42 @@
package com.zt.plat.module.base.dal.dao.processinginfomationoperation;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.processinginfomationoperation.ProcessingInfomationOperationDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processinginfomationoperation.vo.*;
/**
* 工艺工序 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ProcessingInfomationOperationMapper extends BaseMapperX<ProcessingInfomationOperationDO> {
default PageResult<ProcessingInfomationOperationDO> selectPage(ProcessingInfomationOperationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingInfomationOperationDO>()
.eqIfPresent(ProcessingInfomationOperationDO::getPreviousOperationId, reqVO.getPreviousOperationId())
.eqIfPresent(ProcessingInfomationOperationDO::getNextOperationId, reqVO.getNextOperationId())
.eqIfPresent(ProcessingInfomationOperationDO::getProcessingId, reqVO.getProcessingId())
.eqIfPresent(ProcessingInfomationOperationDO::getIsKey, reqVO.getIsKey())
.eqIfPresent(ProcessingInfomationOperationDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ProcessingInfomationOperationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProcessingInfomationOperationDO::getId));
}
default List<ProcessingInfomationOperationDO> selectList(ProcessingInfomationOperationPageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ProcessingInfomationOperationDO>()
.eqIfPresent(ProcessingInfomationOperationDO::getPreviousOperationId, reqVO.getPreviousOperationId())
.eqIfPresent(ProcessingInfomationOperationDO::getNextOperationId, reqVO.getNextOperationId())
.eqIfPresent(ProcessingInfomationOperationDO::getProcessingId, reqVO.getProcessingId())
.eqIfPresent(ProcessingInfomationOperationDO::getIsKey, reqVO.getIsKey())
.eqIfPresent(ProcessingInfomationOperationDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ProcessingInfomationOperationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProcessingInfomationOperationDO::getId));
}
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.dal.dao.processingoperation;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.processingoperation.ProcessingOperationDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processingoperation.vo.*;
/**
* 工序 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ProcessingOperationMapper extends BaseMapperX<ProcessingOperationDO> {
default PageResult<ProcessingOperationDO> selectPage(ProcessingOperationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingOperationDO>()
.eqIfPresent(ProcessingOperationDO::getCode, reqVO.getCode())
.likeIfPresent(ProcessingOperationDO::getName, reqVO.getName())
.eqIfPresent(ProcessingOperationDO::getSort, reqVO.getSort())
.eqIfPresent(ProcessingOperationDO::getTypeValue, reqVO.getTypeValue())
.eqIfPresent(ProcessingOperationDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ProcessingOperationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProcessingOperationDO::getId));
}
}

View File

@@ -0,0 +1,29 @@
package com.zt.plat.module.base.dal.dao.processingoperationmaterial;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.processingoperationmaterial.ProcessingOperationMaterialDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.base.controller.admin.processingoperationmaterial.vo.*;
/**
* 工艺工序物料 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ProcessingOperationMaterialMapper extends BaseMapperX<ProcessingOperationMaterialDO> {
default PageResult<ProcessingOperationMaterialDO> selectPage(ProcessingOperationMaterialPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProcessingOperationMaterialDO>()
.eqIfPresent(ProcessingOperationMaterialDO::getTypeValue, reqVO.getTypeValue())
.eqIfPresent(ProcessingOperationMaterialDO::getRemark, reqVO.getRemark())
.betweenIfPresent(ProcessingOperationMaterialDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ProcessingOperationMaterialDO::getDepartmentIds, reqVO.getDepartmentIds())
.orderByDesc(ProcessingOperationMaterialDO::getId));
}
}

View File

@@ -39,6 +39,11 @@ public class MaterialInfomationDO extends BaseDO {
@TableField("NAME") @TableField("NAME")
private String name; private String name;
/** /**
* 分类ID中间表关联
*/
@TableField(exist = false)
private Long classesId;
/**
* 备注 * 备注
*/ */
@TableField("RMK") @TableField("RMK")

View File

@@ -0,0 +1,60 @@
package com.zt.plat.module.base.dal.dataobject.departmentmaterial;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 组织架构物料 DO
*
* @author 后台管理-1
*/
@TableName("bse_dept_mtrl")
@KeySequence("bse_dept_mtrl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class DepartmentMaterialDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 部门ID
*/
@TableField("DEPT_ID")
private Long deptId;
/**
* 物料信息ID
*/
@TableField("INF_ID")
private Long infomationId;
/**
* 物料分类ID
*/
@TableField("CLS_ID")
private Long classesId;
/**
* 字典数据值-物料类型
*/
@TableField("DIC_DAT_VAL")
private String dictionaryDataValue;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,63 @@
package com.zt.plat.module.base.dal.dataobject.doctemplate;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 模板分类 DO
*
* @author 系统生成
*/
@TableName(value = "bse_doc_category")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocTemplateCategoryDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 分类名称
*/
@TableField("category_name")
private String categoryName;
/**
* 分类编码
*/
@TableField("category_code")
private String categoryCode;
/**
* 父分类IDNULL=大类)
*/
@TableField("parent_id")
private Long parentId;
/**
* 层级1=大类2=小类)
*/
@TableField("level")
private Integer level;
/**
* 排序号
*/
@TableField("sort")
private Integer sort;
/**
* 备注
*/
@TableField("remark")
private String remark;
}

View File

@@ -0,0 +1,99 @@
package com.zt.plat.module.base.dal.dataobject.doctemplate;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 模板 DO
*
* @author 系统生成
*/
@TableName(value = "bse_doc_tmpl")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocTemplateDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 模板名称
*/
@TableField("tmpl_name")
private String tmplName;
/**
* 模板编码(唯一)
*/
@TableField("tmpl_code")
private String tmplCode;
/**
* 模板图标
*/
@TableField("icon")
private String icon;
/**
* 所属大类
*/
@TableField("big_category_id")
private Long bigCategoryId;
/**
* 所属小类
*/
@TableField("small_category_id")
private Long smallCategoryId;
/**
* 版本号
*/
@TableField("version")
private String version;
/**
* 模板描述
*/
@TableField("description")
private String description;
/**
* 模板内容HTML含占位符
*/
@TableField("content")
private String content;
/**
* SQL配置JSON格式可选
*/
@TableField("sql_config")
private String sqlConfig;
/**
* 数据源标识
*/
@TableField("data_source")
private String dataSource;
/**
* 使用次数(引用创建实例的次数)
*/
@TableField("use_count")
private Integer useCount;
/**
* 状态1=启用0=停用2=草稿)
*/
@TableField("enabled")
private String enabled;
}

View File

@@ -0,0 +1,87 @@
package com.zt.plat.module.base.dal.dataobject.doctemplate;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 模板实例 DO
*
* @author 系统生成
*/
@TableName(value = "bse_doc_instance")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocTemplateInstanceDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 实例名称
*/
@TableField("instance_name")
private String instanceName;
/**
* 实例编码(唯一)
*/
@TableField("instance_code")
private String instanceCode;
/**
* 引用的模板ID
*/
@TableField("template_id")
private Long templateId;
/**
* 业务关联类型
*/
@TableField("business_type")
private String businessType;
/**
* 业务关联ID
*/
@TableField("business_id")
private Long businessId;
/**
* 业务关联标签(如 PC-2025-001
*/
@TableField("business_label")
private String businessLabel;
/**
* 用户编辑后的内容(含占位符)
*/
@TableField("edited_content")
private String editedContent;
/**
* 渲染后的最终内容(占位符已替换)
*/
@TableField("rendered_content")
private String renderedContent;
/**
* 备注
*/
@TableField("remark")
private String remark;
/**
* 状态draft=草稿published=已发布)
*/
@TableField("status")
private String status;
}

View File

@@ -0,0 +1,81 @@
package com.zt.plat.module.base.dal.dataobject.doctemplate;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 标签库 DO
*
* @author 系统生成
*/
@TableName(value = "bse_doc_tag")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DocTemplateTagDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 标签名称(中文)
*/
@TableField("tag_name")
private String tagName;
/**
* 标签编码Velocity变量名
*/
@TableField("tag_code")
private String tagCode;
/**
* 所属分类ID
*/
@TableField("category_id")
private Long categoryId;
/**
* 数据类型String/Number/Date/Boolean
*/
@TableField("data_type")
private String dataType;
/**
* 默认值
*/
@TableField("default_value")
private String defaultValue;
/**
* SQL脚本可选仅保存参考
*/
@TableField("sql_script")
private String sqlScript;
/**
* 描述
*/
@TableField("description")
private String description;
/**
* 排序号
*/
@TableField("sort")
private Integer sort;
/**
* 是否启用1=启用0=停用)
*/
@TableField("enabled")
private String enabled;
}

View File

@@ -0,0 +1,60 @@
package com.zt.plat.module.base.dal.dataobject.materialclasses;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 物料分类 DO
*
* @author 后台管理-1
*/
@TableName("bse_mtrl_cls")
@KeySequence("bse_mtrl_cls_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class MaterialClassesDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 父级ID
*/
@TableField("PRN_ID")
private Long parentId;
/**
* 分类编码
*/
@TableField("CD")
private String code;
/**
* 分类名称
*/
@TableField("NAME")
private String name;
/**
* 分类级别-用于类别层级(大/中/小类)
*/
@TableField("LVL")
private Long level;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,45 @@
package com.zt.plat.module.base.dal.dataobject.materialhasclasses;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 物料持有分类 DO
*
* @author 后台管理-1
*/
@TableName("bse_mtrl_hs_cls")
@KeySequence("bse_mtrl_hs_cls_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class MaterialHasClassesDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料信息ID
*/
@TableField("INF_ID")
private Long infomationId;
/**
* 分类ID
*/
@TableField("CLS_ID")
private Long classesId;
}

View File

@@ -0,0 +1,70 @@
package com.zt.plat.module.base.dal.dataobject.materialhasproperties;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 物料持有属性 DO
*
* @author 后台管理-1
*/
@TableName("bse_mtrl_hs_prps")
@KeySequence("bse_mtrl_hs_prps_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class MaterialHasPropertiesDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料信息ID
*/
@TableField("INF_ID")
private Long infomationId;
/**
* 属性ID
*/
@TableField("PRPS_ID")
private Long propertiesId;
/**
* 计量单位ID-默认计量单位
*/
@TableField("UNT_ID")
private Long unitId;
/**
* 属性值
*/
@TableField("VAL")
private String value;
/**
* 是否关键属性-关键属性表示物料唯一性
*/
@TableField("IS_KY")
private Integer isKey;
/**
* 是否计量定价
*/
@TableField("IS_MTNG")
private Integer isMetering;
/**
* 排序号
*/
@TableField("SRT")
private Long sort;
}

View File

@@ -0,0 +1,65 @@
package com.zt.plat.module.base.dal.dataobject.materialproperties;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 物料属性 DO
*
* @author 后台管理-1
*/
@TableName("bse_mtrl_prps")
@KeySequence("bse_mtrl_prps_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class MaterialPropertiesDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 属性编码
*/
@TableField("CD")
private String code;
/**
* 属性名称
*/
@TableField("NAME")
private String name;
/**
* 计量单位量ID
*/
@TableField("UNT_QTY_ID")
private Long unitQuantityId;
/**
* 业务字典数据值
*/
@TableField("DIC_DAT_VAL")
private String dictionaryDataValue;
/**
* 数据类型
*/
@TableField("DAT_TP")
private String dataType;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,76 @@
package com.zt.plat.module.base.dal.dataobject.processinginfomation;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 工艺信息 DO
*
* @author 后台管理-1
*/
@TableName("bse_proc_inf")
@KeySequence("bse_proc_inf_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ProcessingInfomationDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 父级ID
*/
@TableField("PRN_ID")
private Long parentId;
/**
* 工艺编码-唯一业务键
*/
@TableField("CD")
private String code;
/**
* 工艺名称
*/
@TableField("NAME")
private String name;
/**
* 工艺类型值
*/
@TableField("TP_VAL")
private Long typeValue;
/**
* 状态值-工艺状态
*/
@TableField("STS_VAL")
private String statusValue;
/**
* 工艺描述
*/
@TableField("DSP")
private String description;
/**
* 部门ID
*/
@TableField("DEPT_ID")
private Long deptId;
/**
* 生效日期
*/
@TableField("EFCT_DT")
private LocalDateTime effectiveDate;
}

View File

@@ -0,0 +1,60 @@
package com.zt.plat.module.base.dal.dataobject.processinginfomationoperation;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 工艺工序 DO
*
* @author 后台管理-1
*/
@TableName("bse_proc_inf_optn")
@KeySequence("bse_proc_inf_optn_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ProcessingInfomationOperationDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 前序工序ID
*/
@TableField("PRE_OPTN_ID")
private Long previousOperationId;
/**
* 后续工序ID
*/
@TableField("NXT_OPTN_ID")
private Long nextOperationId;
/**
* 工艺ID
*/
@TableField("PROC_ID")
private Long processingId;
/**
* 是否关键工序
*/
@TableField("IS_KY")
private Integer isKey;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,60 @@
package com.zt.plat.module.base.dal.dataobject.processingoperation;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 工序 DO
*
* @author 后台管理-1
*/
@TableName("bse_proc_optn")
@KeySequence("bse_proc_optn_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ProcessingOperationDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 工序编码
*/
@TableField("CD")
private String code;
/**
* 工序名称
*/
@TableField("NAME")
private String name;
/**
* 排序号
*/
@TableField("SRT")
private Long sort;
/**
* 类型值-工序类型
*/
@TableField("TP_VAL")
private String typeValue;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -0,0 +1,58 @@
package com.zt.plat.module.base.dal.dataobject.processingoperationmaterial;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BaseDO;
/**
* 工艺工序物料 DO
*
* @author 后台管理-1
*/
@TableName("bse_proc_optn_mtrl")
@KeySequence("bse_proc_optn_mtrl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ProcessingOperationMaterialDO extends BaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 工艺工序ID
*/
private Long processingOperationId;
/**
* 物料ID
*/
private Long materialId;
/**
* 类型值-物料类型(产出/投入)
*/
@TableField("TP_VAL")
private String typeValue;
/**
* 备注
*/
@TableField("RMK")
private String remark;
/**
* 组织机构
*/
@TableField("DEPT_IDS")
private String departmentIds;
}

View File

@@ -7,6 +7,8 @@ import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationPageRe
import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO; import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
/** /**
* 物料信息 Mapper * 物料信息 Mapper
* *
@@ -16,11 +18,16 @@ import org.apache.ibatis.annotations.Mapper;
public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomationDO> { public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomationDO> {
default PageResult<MaterialInfomationDO> selectPage(MaterialInfomationPageReqVO reqVO) { default PageResult<MaterialInfomationDO> selectPage(MaterialInfomationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialInfomationDO>() return selectPage(reqVO, (Collection<Long>) null);
}
default PageResult<MaterialInfomationDO> selectPage(MaterialInfomationPageReqVO reqVO, Collection<Long> infomationIds) {
return BaseMapperX.super.selectPage(reqVO, new LambdaQueryWrapperX<MaterialInfomationDO>()
.eqIfPresent(MaterialInfomationDO::getCode, reqVO.getCode()) .eqIfPresent(MaterialInfomationDO::getCode, reqVO.getCode())
.likeIfPresent(MaterialInfomationDO::getName, reqVO.getName()) .likeIfPresent(MaterialInfomationDO::getName, reqVO.getName())
.eqIfPresent(MaterialInfomationDO::getRemark, reqVO.getRemark()) .eqIfPresent(MaterialInfomationDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialInfomationDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MaterialInfomationDO::getCreateTime, reqVO.getCreateTime())
.inIfPresent(MaterialInfomationDO::getId, infomationIds)
.orderByDesc(MaterialInfomationDO::getId)); .orderByDesc(MaterialInfomationDO::getId));
} }

View File

@@ -1,21 +1,29 @@
package com.zt.plat.module.base.service.base; package com.zt.plat.module.base.service.base;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationPageReqVO; import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationPageReqVO;
import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationRespVO; import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationRespVO;
import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationSaveReqVO; import com.zt.plat.module.base.controller.admin.base.vo.MaterialInfomationSaveReqVO;
import com.zt.plat.module.base.dal.dao.materialhasclasses.MaterialHasClassesMapper;
import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO; import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO;
import com.zt.plat.module.base.dal.dataobject.materialhasclasses.MaterialHasClassesDO;
import com.zt.plat.module.base.dal.mysql.base.MaterialInfomationMapper; import com.zt.plat.module.base.dal.mysql.base.MaterialInfomationMapper;
import com.zt.plat.module.erp.api.ErpExternalApi; import com.zt.plat.module.erp.api.ErpExternalApi;
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO; import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.MATERIAL_INFOMATION_NOT_EXISTS; import static com.zt.plat.module.base.enums.ErrorCodeConstants.MATERIAL_INFOMATION_NOT_EXISTS;
@@ -35,23 +43,46 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
@Resource @Resource
private ErpExternalApi erpExternalApi; private ErpExternalApi erpExternalApi;
@Resource
private MaterialHasClassesMapper materialHasClassesMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public MaterialInfomationRespVO createMaterialInfomation(MaterialInfomationSaveReqVO createReqVO) { public MaterialInfomationRespVO createMaterialInfomation(MaterialInfomationSaveReqVO createReqVO) {
// 插入 // 插入
MaterialInfomationDO materialInfomation = BeanUtils.toBean(createReqVO, MaterialInfomationDO.class); MaterialInfomationDO materialInfomation = BeanUtils.toBean(createReqVO, MaterialInfomationDO.class);
materialInfomationMapper.insert(materialInfomation); materialInfomationMapper.insert(materialInfomation);
// 维护分类关联
if (createReqVO.getClassesId() != null) {
MaterialHasClassesDO relation = MaterialHasClassesDO.builder()
.classesId(createReqVO.getClassesId())
.infomationId(materialInfomation.getId())
.build();
materialHasClassesMapper.insert(relation);
materialInfomation.setClassesId(createReqVO.getClassesId());
}
// 返回 // 返回
return BeanUtils.toBean(materialInfomation, MaterialInfomationRespVO.class); return BeanUtils.toBean(materialInfomation, MaterialInfomationRespVO.class);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void updateMaterialInfomation(MaterialInfomationSaveReqVO updateReqVO) { public void updateMaterialInfomation(MaterialInfomationSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateMaterialInfomationExists(updateReqVO.getId()); validateMaterialInfomationExists(updateReqVO.getId());
// 更新 // 更新
MaterialInfomationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialInfomationDO.class); MaterialInfomationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialInfomationDO.class);
materialInfomationMapper.updateById(updateObj); materialInfomationMapper.updateById(updateObj);
// 更新分类关联
materialHasClassesMapper.delete(new LambdaUpdateWrapper<MaterialHasClassesDO>()
.eq(MaterialHasClassesDO::getInfomationId, updateReqVO.getId()));
if (updateReqVO.getClassesId() != null) {
MaterialHasClassesDO relation = MaterialHasClassesDO.builder()
.classesId(updateReqVO.getClassesId())
.infomationId(updateReqVO.getId())
.build();
materialHasClassesMapper.insert(relation);
}
} }
@Override @Override
@@ -60,6 +91,8 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
validateMaterialInfomationExists(id); validateMaterialInfomationExists(id);
// 删除 // 删除
materialInfomationMapper.deleteById(id); materialInfomationMapper.deleteById(id);
materialHasClassesMapper.delete(new LambdaUpdateWrapper<MaterialHasClassesDO>()
.eq(MaterialHasClassesDO::getInfomationId, id));
} }
@Override @Override
@@ -85,12 +118,52 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
@Override @Override
public MaterialInfomationDO getMaterialInfomation(Long id) { public MaterialInfomationDO getMaterialInfomation(Long id) {
return materialInfomationMapper.selectById(id); MaterialInfomationDO info = materialInfomationMapper.selectById(id);
if (info == null) {
return null;
}
MaterialHasClassesDO relation = materialHasClassesMapper.selectFirstOne(MaterialHasClassesDO::getInfomationId, id);
if (relation != null) {
info.setClassesId(relation.getClassesId());
}
return info;
} }
@Override @Override
public PageResult<MaterialInfomationDO> getMaterialInfomationPage(MaterialInfomationPageReqVO pageReqVO) { public PageResult<MaterialInfomationDO> getMaterialInfomationPage(MaterialInfomationPageReqVO pageReqVO) {
return materialInfomationMapper.selectPage(pageReqVO); List<Long> infomationIds = null;
List<MaterialHasClassesDO> relationList = Collections.emptyList();
if (pageReqVO.getClassesId() != null) {
relationList = materialHasClassesMapper.selectList(MaterialHasClassesDO::getClassesId, pageReqVO.getClassesId());
if (CollUtil.isEmpty(relationList)) {
return PageResult.empty();
}
infomationIds = relationList.stream()
.map(MaterialHasClassesDO::getInfomationId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
}
PageResult<MaterialInfomationDO> pageResult = materialInfomationMapper.selectPage(pageReqVO, infomationIds);
if (CollUtil.isEmpty(pageResult.getList())) {
return pageResult;
}
List<Long> currentInfoIds = pageResult.getList().stream()
.map(MaterialInfomationDO::getId)
.collect(Collectors.toList());
if (pageReqVO.getClassesId() == null) {
relationList = materialHasClassesMapper.selectList(MaterialHasClassesDO::getInfomationId, currentInfoIds);
}
Map<Long, Long> infoClassMap = relationList.stream()
.filter(item -> item.getInfomationId() != null)
.collect(Collectors.toMap(MaterialHasClassesDO::getInfomationId, MaterialHasClassesDO::getClassesId, (existing, replacement) -> existing));
pageResult.getList().forEach(item -> item.setClassesId(infoClassMap.get(item.getId())));
return pageResult;
} }
@Override @Override

View File

@@ -0,0 +1,62 @@
package com.zt.plat.module.base.service.departmentmaterial;
import java.util.*;
import jakarta.validation.*;
import com.zt.plat.module.base.controller.admin.departmentmaterial.vo.*;
import com.zt.plat.module.base.dal.dataobject.departmentmaterial.DepartmentMaterialDO;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.PageParam;
/**
* 组织架构物料 Service 接口
*
* @author 后台管理-1
*/
public interface DepartmentMaterialService {
/**
* 创建组织架构物料
*
* @param createReqVO 创建信息
* @return 编号
*/
DepartmentMaterialRespVO createDepartmentMaterial(@Valid DepartmentMaterialSaveReqVO createReqVO);
/**
* 更新组织架构物料
*
* @param updateReqVO 更新信息
*/
void updateDepartmentMaterial(@Valid DepartmentMaterialSaveReqVO updateReqVO);
/**
* 删除组织架构物料
*
* @param id 编号
*/
void deleteDepartmentMaterial(Long id);
/**
* 批量删除组织架构物料
*
* @param ids 编号
*/
void deleteDepartmentMaterialListByIds(List<Long> ids);
/**
* 获得组织架构物料
*
* @param id 编号
* @return 组织架构物料
*/
DepartmentMaterialDO getDepartmentMaterial(Long id);
/**
* 获得组织架构物料分页
*
* @param pageReqVO 分页查询
* @return 组织架构物料分页
*/
PageResult<DepartmentMaterialRespVO> getDepartmentMaterialPage(DepartmentMaterialPageReqVO pageReqVO);
}

View File

@@ -0,0 +1,246 @@
package com.zt.plat.module.base.service.departmentmaterial;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.collection.CollectionUtils;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.base.controller.admin.departmentmaterial.vo.*;
import com.zt.plat.module.base.dal.dao.departmentmaterial.DepartmentMaterialMapper;
import com.zt.plat.module.base.dal.dao.materialclasses.MaterialClassesMapper;
import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO;
import com.zt.plat.module.base.dal.dataobject.departmentmaterial.DepartmentMaterialDO;
import com.zt.plat.module.base.dal.dataobject.materialclasses.MaterialClassesDO;
import com.zt.plat.module.base.dal.mysql.base.MaterialInfomationMapper;
import com.zt.plat.module.system.api.dept.DeptApi;
import com.zt.plat.module.system.api.dept.dto.DeptRespDTO;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.*;
/**
* 组织架构物料 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class DepartmentMaterialServiceImpl implements DepartmentMaterialService {
@Resource
private DepartmentMaterialMapper departmentMaterialMapper;
@Resource
private MaterialInfomationMapper materialInfomationMapper;
@Resource
private MaterialClassesMapper materialClassesMapper;
@Resource
private DeptApi deptApi;
@Override
public DepartmentMaterialRespVO createDepartmentMaterial(DepartmentMaterialSaveReqVO createReqVO) {
// 插入
DepartmentMaterialDO departmentMaterial = BeanUtils.toBean(createReqVO, DepartmentMaterialDO.class);
departmentMaterialMapper.insert(departmentMaterial);
// 返回
return BeanUtils.toBean(departmentMaterial, DepartmentMaterialRespVO.class);
}
@Override
public void updateDepartmentMaterial(DepartmentMaterialSaveReqVO updateReqVO) {
// 校验存在
validateDepartmentMaterialExists(updateReqVO.getId());
// 更新
DepartmentMaterialDO updateObj = BeanUtils.toBean(updateReqVO, DepartmentMaterialDO.class);
departmentMaterialMapper.updateById(updateObj);
}
@Override
public void deleteDepartmentMaterial(Long id) {
// 校验存在
validateDepartmentMaterialExists(id);
// 删除
departmentMaterialMapper.deleteById(id);
}
@Override
public void deleteDepartmentMaterialListByIds(List<Long> ids) {
// 校验存在
validateDepartmentMaterialExists(ids);
// 删除
departmentMaterialMapper.deleteByIds(ids);
}
private void validateDepartmentMaterialExists(List<Long> ids) {
List<DepartmentMaterialDO> list = departmentMaterialMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(DEPARTMENT_MATERIAL_NOT_EXISTS);
}
}
private void validateDepartmentMaterialExists(Long id) {
if (departmentMaterialMapper.selectById(id) == null) {
throw exception(DEPARTMENT_MATERIAL_NOT_EXISTS);
}
}
@Override
public DepartmentMaterialDO getDepartmentMaterial(Long id) {
return departmentMaterialMapper.selectById(id);
}
@Override
public PageResult<DepartmentMaterialRespVO> getDepartmentMaterialPage(DepartmentMaterialPageReqVO pageReqVO) {
// 预处理物料名称/编码查询条件
List<Long> matchedInfoIds = null;
if (StrUtil.isNotBlank(pageReqVO.getMaterialName()) || StrUtil.isNotBlank(pageReqVO.getMaterialNumber())) {
LambdaQueryWrapperX<MaterialInfomationDO> infoWrapper = new LambdaQueryWrapperX<>();
infoWrapper.likeIfPresent(MaterialInfomationDO::getName, pageReqVO.getMaterialName())
.likeIfPresent(MaterialInfomationDO::getCode, pageReqVO.getMaterialNumber());
List<MaterialInfomationDO> infoCandidates = materialInfomationMapper.selectList(infoWrapper);
if (CollUtil.isEmpty(infoCandidates)) {
return PageResult.empty();
}
matchedInfoIds = infoCandidates.stream().map(MaterialInfomationDO::getId).toList();
pageReqVO.setInfomationIds(matchedInfoIds);
}
PageResult<DepartmentMaterialDO> pageResult = departmentMaterialMapper.selectPage(pageReqVO);
// 重置,避免后续使用该入参出现意外的 in 条件
pageReqVO.setInfomationIds(null);
if (CollUtil.isEmpty(pageResult.getList())) {
return PageResult.empty(pageResult.getTotal());
}
// 关联数据准备
Set<Long> infoIds = pageResult.getList().stream()
.map(DepartmentMaterialDO::getInfomationId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Map<Long, MaterialInfomationDO> infoMap = infoIds.isEmpty()
? Collections.emptyMap()
: materialInfomationMapper.selectBatchIds(infoIds).stream()
.filter(Objects::nonNull)
.collect(Collectors.toMap(MaterialInfomationDO::getId, Function.identity()));
Set<Long> classIds = new HashSet<>();
pageResult.getList().forEach(item -> {
if (item.getClassesId() != null) {
classIds.add(item.getClassesId());
}
MaterialInfomationDO info = infoMap.get(item.getInfomationId());
if (info != null && info.getClassesId() != null) {
classIds.add(info.getClassesId());
}
});
Map<Long, MaterialClassesDO> classCache = loadClassHierarchy(classIds);
Set<Long> deptIds = pageResult.getList().stream()
.map(DepartmentMaterialDO::getDeptId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Map<Long, DeptRespDTO> deptMap = Collections.emptyMap();
if (!deptIds.isEmpty()) {
try {
deptMap = CollectionUtils.convertMap(deptApi.getDeptList(deptIds).getCheckedData(), DeptRespDTO::getId);
} catch (Exception ignore) {
deptMap = Collections.emptyMap();
}
}
List<DepartmentMaterialRespVO> respList = new ArrayList<>(pageResult.getList().size());
for (DepartmentMaterialDO item : pageResult.getList()) {
DepartmentMaterialRespVO respVO = BeanUtils.toBean(item, DepartmentMaterialRespVO.class);
MaterialInfomationDO info = infoMap.get(item.getInfomationId());
if (info != null) {
respVO.setMaterialNumber(info.getCode());
respVO.setMaterialName(info.getName());
}
Long targetClassId = item.getClassesId();
if (targetClassId == null && info != null) {
targetClassId = info.getClassesId();
}
if (targetClassId != null) {
List<String> classPath = buildClassPath(targetClassId, classCache);
if (!classPath.isEmpty()) {
respVO.setCategoryLargeName(classPath.get(0));
if (classPath.size() > 1) {
respVO.setCategoryMediumName(classPath.get(1));
}
if (classPath.size() > 2) {
respVO.setCategorySmallName(classPath.get(classPath.size() - 1));
}
respVO.setCategoryPath(String.join("/", classPath));
}
}
DeptRespDTO deptRespDTO = deptMap.get(item.getDeptId());
if (deptRespDTO != null) {
respVO.setDeptName(deptRespDTO.getName());
}
respVO.setStatusLabel(StrUtil.isNotBlank(respVO.getStatusLabel()) ? respVO.getStatusLabel() : "未配置");
respVO.setDictionaryDataLabel(respVO.getDictionaryDataValue());
respList.add(respVO);
}
return new PageResult<>(respList, pageResult.getTotal());
}
private Map<Long, MaterialClassesDO> loadClassHierarchy(Set<Long> initialIds) {
if (CollUtil.isEmpty(initialIds)) {
return Collections.emptyMap();
}
Map<Long, MaterialClassesDO> cache = new HashMap<>();
Set<Long> pending = new HashSet<>(initialIds);
while (!pending.isEmpty()) {
List<MaterialClassesDO> fetched = materialClassesMapper.selectBatchIds(pending);
pending = new HashSet<>();
for (MaterialClassesDO cls : fetched) {
if (cls == null || cache.containsKey(cls.getId())) {
continue;
}
cache.put(cls.getId(), cls);
Long parentId = cls.getParentId();
if (parentId != null && parentId > 0 && !cache.containsKey(parentId)) {
pending.add(parentId);
}
}
}
return cache;
}
private List<String> buildClassPath(Long classId, Map<Long, MaterialClassesDO> cache) {
List<String> path = new ArrayList<>();
MaterialClassesDO current = cache.get(classId);
int guard = 0;
while (current != null && guard++ < 10) {
path.add(current.getName());
Long parentId = current.getParentId();
if (parentId == null || parentId == 0) {
break;
}
current = cache.get(parentId);
}
Collections.reverse(path);
return path;
}
}

View File

@@ -0,0 +1,78 @@
package com.zt.plat.module.base.service.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategorySaveReqVO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 模板分类 Service 接口
*
* @author 系统生成
*/
public interface DocTemplateCategoryService {
/**
* 创建模板分类
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createTemplateCategory(@Valid DocTemplateCategorySaveReqVO createReqVO);
/**
* 更新模板分类
*
* @param updateReqVO 更新信息
*/
void updateTemplateCategory(@Valid DocTemplateCategorySaveReqVO updateReqVO);
/**
* 删除模板分类
*
* @param id 编号
*/
void deleteTemplateCategory(Long id);
/**
* 获得模板分类
*
* @param id 编号
* @return 模板分类
*/
DocTemplateCategoryRespVO getTemplateCategory(Long id);
/**
* 获得模板分类分页
*
* @param pageReqVO 分页查询
* @return 模板分类分页
*/
PageResult<DocTemplateCategoryRespVO> getTemplateCategoryPage(DocTemplateCategoryPageReqVO pageReqVO);
/**
* 获得模板分类列表
*
* @return 模板分类列表
*/
List<DocTemplateCategoryRespVO> getTemplateCategoryList();
/**
* 获得模板分类树形结构
*
* @return 模板分类树
*/
List<DocTemplateCategoryRespVO> buildTree();
/**
* 获得分类完整路径(包含所有父级)
*
* @param categoryId 分类ID
* @return 分类路径,用"/"分隔,如"合同管理/销售合同"
*/
String getCategoryFullPath(Long categoryId);
}

View File

@@ -0,0 +1,158 @@
package com.zt.plat.module.base.service.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryPageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategoryRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateCategorySaveReqVO;
import com.zt.plat.module.base.convert.doctemplate.DocTemplateCategoryConvert;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateCategoryDO;
import com.zt.plat.module.base.dal.dao.doctemplate.DocTemplateCategoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.TEMPLATE_CATEGORY_NOT_EXISTS;
/**
* 模板分类 Service 实现类
*
* @author 系统生成
*/
@Service
@Validated
public class DocTemplateCategoryServiceImpl implements DocTemplateCategoryService {
@Resource
private DocTemplateCategoryMapper templateCategoryMapper;
@Override
public Long createTemplateCategory(DocTemplateCategorySaveReqVO createReqVO) {
// 插入
DocTemplateCategoryDO templateCategory = DocTemplateCategoryConvert.INSTANCE.convert(createReqVO);
// 设置默认值
if (templateCategory.getSort() == null) {
templateCategory.setSort(0);
}
templateCategoryMapper.insert(templateCategory);
// 返回
return templateCategory.getId();
}
@Override
public void updateTemplateCategory(DocTemplateCategorySaveReqVO updateReqVO) {
// 校验存在
validateTemplateCategoryExists(updateReqVO.getId());
// 更新
DocTemplateCategoryDO updateObj = DocTemplateCategoryConvert.INSTANCE.convert(updateReqVO);
templateCategoryMapper.updateById(updateObj);
}
@Override
public void deleteTemplateCategory(Long id) {
// 校验存在
validateTemplateCategoryExists(id);
// 删除
templateCategoryMapper.deleteById(id);
}
private void validateTemplateCategoryExists(Long id) {
if (templateCategoryMapper.selectById(id) == null) {
throw exception(TEMPLATE_CATEGORY_NOT_EXISTS);
}
}
@Override
public DocTemplateCategoryRespVO getTemplateCategory(Long id) {
DocTemplateCategoryDO templateCategory = templateCategoryMapper.selectById(id);
return DocTemplateCategoryConvert.INSTANCE.convert(templateCategory);
}
@Override
public PageResult<DocTemplateCategoryRespVO> getTemplateCategoryPage(DocTemplateCategoryPageReqVO pageReqVO) {
PageResult<DocTemplateCategoryDO> pageResult = templateCategoryMapper.selectPage(pageReqVO);
return DocTemplateCategoryConvert.INSTANCE.convertPage(pageResult);
}
@Override
public List<DocTemplateCategoryRespVO> getTemplateCategoryList() {
List<DocTemplateCategoryDO> list = templateCategoryMapper.selectList();
return DocTemplateCategoryConvert.INSTANCE.convertList(list);
}
@Override
public List<DocTemplateCategoryRespVO> buildTree() {
// 1. 查询所有分类数据
List<DocTemplateCategoryDO> allCategories = templateCategoryMapper.selectList();
// 2. 转换为 VO
List<DocTemplateCategoryRespVO> categoryVOs = DocTemplateCategoryConvert.INSTANCE.convertList(allCategories);
// 3. 构建树形结构
return buildTreeStructure(categoryVOs);
}
/**
* 构建树形结构
*/
private List<DocTemplateCategoryRespVO> buildTreeStructure(List<DocTemplateCategoryRespVO> categories) {
// 1. 按 parentId 分组
Map<String, List<DocTemplateCategoryRespVO>> groupByParentId = categories.stream()
.collect(Collectors.groupingBy(node ->
node.getParentId() != null ? node.getParentId().toString() : "null"));
// 2. 设置子节点并排序
categories.forEach(node -> {
List<DocTemplateCategoryRespVO> children = groupByParentId.get(node.getId().toString());
if (children != null && !children.isEmpty()) {
// 按排序号升序排列
children.sort(Comparator.comparing(DocTemplateCategoryRespVO::getSort,
Comparator.nullsLast(Comparator.naturalOrder())));
node.setChildren(children);
}
});
// 3. 返回根节点parentId 为 null 的节点)
List<DocTemplateCategoryRespVO> rootNodes = groupByParentId.get("null");
if (rootNodes != null) {
// 根节点也要排序
rootNodes.sort(Comparator.comparing(DocTemplateCategoryRespVO::getSort,
Comparator.nullsLast(Comparator.naturalOrder())));
return rootNodes;
}
return List.of();
}
@Override
public String getCategoryFullPath(Long categoryId) {
if (categoryId == null) {
return "";
}
// 构建分类路径
List<String> pathNames = new ArrayList<>();
Long currentId = categoryId;
// 递归查找父级分类
while (currentId != null) {
DocTemplateCategoryDO category = templateCategoryMapper.selectById(currentId);
if (category == null) {
break;
}
// 将当前分类名称添加到列表开头
pathNames.add(0, category.getCategoryName());
// 继续查找父级
currentId = category.getParentId();
}
// 用"/"拼接分类路径
return String.join("/", pathNames);
}
}

View File

@@ -0,0 +1,63 @@
package com.zt.plat.module.base.service.doctemplate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstancePageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceSaveReqVO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 模板实例 Service 接口
*
* @author 系统生成
*/
public interface DocTemplateInstanceService {
/**
* 创建模板实例
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createTemplateInstance(@Valid DocTemplateInstanceSaveReqVO createReqVO);
/**
* 更新模板实例
*
* @param updateReqVO 更新信息
*/
void updateTemplateInstance(@Valid DocTemplateInstanceSaveReqVO updateReqVO);
/**
* 删除模板实例
*
* @param id 编号
*/
void deleteTemplateInstance(Long id);
/**
* 获得模板实例
*
* @param id 编号
* @return 模板实例
*/
DocTemplateInstanceRespVO getTemplateInstance(Long id);
/**
* 获得模板实例分页
*
* @param pageReqVO 分页查询
* @return 模板实例分页
*/
PageResult<DocTemplateInstanceRespVO> getTemplateInstancePage(DocTemplateInstancePageReqVO pageReqVO);
/**
* 获得模板实例列表
*
* @return 模板实例列表
*/
List<DocTemplateInstanceRespVO> getTemplateInstanceList();
}

View File

@@ -0,0 +1,136 @@
package com.zt.plat.module.base.service.doctemplate;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstancePageReqVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceRespVO;
import com.zt.plat.module.base.controller.admin.doctemplate.vo.DocTemplateInstanceSaveReqVO;
import com.zt.plat.module.base.convert.doctemplate.DocTemplateInstanceConvert;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateInstanceDO;
import com.zt.plat.module.base.dal.dataobject.doctemplate.DocTemplateDO;
import com.zt.plat.module.base.dal.dao.doctemplate.DocTemplateInstanceMapper;
import com.zt.plat.module.base.dal.dao.doctemplate.DocTemplateMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.*;
/**
* 模板实例 Service 实现类
*
* @author 系统生成
*/
@Service
@Validated
public class DocTemplateInstanceServiceImpl implements DocTemplateInstanceService {
@Resource
private DocTemplateInstanceMapper docTemplateInstanceMapper;
@Resource
private DocTemplateMapper docTemplateMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createTemplateInstance(DocTemplateInstanceSaveReqVO createReqVO) {
// 校验模板存在
DocTemplateDO template = docTemplateMapper.selectById(createReqVO.getTemplateId());
if (template == null) {
throw exception(TEMPLATE_NOT_EXISTS);
}
// 校验实例编码唯一性
validateInstanceCodeUnique(null, createReqVO.getInstanceCode());
// 插入实例
DocTemplateInstanceDO templateInstance = DocTemplateInstanceConvert.INSTANCE.convert(createReqVO);
docTemplateInstanceMapper.insert(templateInstance);
// 更新模板使用次数
incrementTemplateUseCount(createReqVO.getTemplateId());
// 返回
return templateInstance.getId();
}
@Override
public void updateTemplateInstance(DocTemplateInstanceSaveReqVO updateReqVO) {
// 校验存在
validateTemplateInstanceExists(updateReqVO.getId());
// 校验实例编码唯一性
validateInstanceCodeUnique(updateReqVO.getId(), updateReqVO.getInstanceCode());
// 更新
DocTemplateInstanceDO updateObj = DocTemplateInstanceConvert.INSTANCE.convert(updateReqVO);
docTemplateInstanceMapper.updateById(updateObj);
}
@Override
public void deleteTemplateInstance(Long id) {
// 校验存在
validateTemplateInstanceExists(id);
// 删除
docTemplateInstanceMapper.deleteById(id);
}
private void validateTemplateInstanceExists(Long id) {
if (docTemplateInstanceMapper.selectById(id) == null) {
throw exception(TEMPLATE_INSTANCE_NOT_EXISTS);
}
}
/**
* 校验实例编码唯一性
*/
private void validateInstanceCodeUnique(Long id, String instanceCode) {
if (StrUtil.isBlank(instanceCode)) {
return;
}
DocTemplateInstanceDO instance = docTemplateInstanceMapper.selectOne(new LambdaQueryWrapper<DocTemplateInstanceDO>()
.eq(DocTemplateInstanceDO::getInstanceCode, instanceCode));
if (instance == null) {
return;
}
// 如果是更新操作,排除自己
if (id != null && id.equals(instance.getId())) {
return;
}
throw exception(TEMPLATE_INSTANCE_CODE_DUPLICATE);
}
/**
* 增加模板使用次数
*/
private void incrementTemplateUseCount(Long templateId) {
DocTemplateDO template = docTemplateMapper.selectById(templateId);
if (template != null) {
DocTemplateDO updateObj = new DocTemplateDO();
updateObj.setId(templateId);
updateObj.setUseCount(template.getUseCount() == null ? 1 : template.getUseCount() + 1);
docTemplateMapper.updateById(updateObj);
}
}
@Override
public DocTemplateInstanceRespVO getTemplateInstance(Long id) {
DocTemplateInstanceDO templateInstance = docTemplateInstanceMapper.selectById(id);
return DocTemplateInstanceConvert.INSTANCE.convert(templateInstance);
}
@Override
public PageResult<DocTemplateInstanceRespVO> getTemplateInstancePage(DocTemplateInstancePageReqVO pageReqVO) {
PageResult<DocTemplateInstanceDO> pageResult = docTemplateInstanceMapper.selectPage(pageReqVO);
return DocTemplateInstanceConvert.INSTANCE.convertPage(pageResult);
}
@Override
public List<DocTemplateInstanceRespVO> getTemplateInstanceList() {
List<DocTemplateInstanceDO> list = docTemplateInstanceMapper.selectList();
return DocTemplateInstanceConvert.INSTANCE.convertList(list);
}
}

Some files were not shown because too many files have changed in this diff Show More