diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/worklog/LogStatisticsMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/worklog/LogStatisticsMapper.xml index 6e4c9d3d..d549fed5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/worklog/LogStatisticsMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/worklog/LogStatisticsMapper.xml @@ -173,7 +173,7 @@ and b.type = #{dto.type} - and b.dept_id = #{deptId} + and b.dept_id = #{dto.deptId} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/IndustryCategoryController.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/IndustryCategoryController.java new file mode 100644 index 00000000..45b46a4e --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/IndustryCategoryController.java @@ -0,0 +1,103 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategory; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.IndustryCategoryPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.IndustryCategoryRespVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.IndustryCategorySaveReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertyRespVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategory.IndustryCategoryDO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.service.industrycategory.IndustryCategoryService; +import cn.iocoder.yudao.module.wms.service.industrycategoryproperty.IndustryCategoryPropertyService; +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 javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 行业分类") +@RestController +@RequestMapping("/wms/industry-category") +@Validated +public class IndustryCategoryController { + + @Resource + private IndustryCategoryService industryCategoryService; + @Resource + private IndustryCategoryPropertyService industryCategoryPropertyService; + + + @PostMapping("/create") + @Operation(summary = "创建行业分类") + @PreAuthorize("@ss.hasPermission('wms:industry-category:create')") + public CommonResult createIndustryCategory(@Valid @RequestBody IndustryCategorySaveReqVO createReqVO) { + return success(industryCategoryService.createIndustryCategory(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新行业分类") + @PreAuthorize("@ss.hasPermission('wms:industry-category:update')") + public CommonResult updateIndustryCategory(@Valid @RequestBody IndustryCategorySaveReqVO updateReqVO) { + industryCategoryService.updateIndustryCategory(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除行业分类") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('wms:industry-category:delete')") + public CommonResult deleteIndustryCategory(@RequestParam("id") Long id) { + industryCategoryService.deleteIndustryCategory(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得行业分类") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('wms:industry-category:query')") + public CommonResult getIndustryCategory(@RequestParam("id") Long id) { + IndustryCategoryDO industryCategory = industryCategoryService.getIndustryCategory(id); + IndustryCategoryRespVO vo = BeanUtils.toBean(industryCategory, IndustryCategoryRespVO.class); + List industryCategoryPropertyList = industryCategoryPropertyService.getByIndustryCategoryId(id); + List propertyRespVOS = BeanUtils.toBean(industryCategoryPropertyList, IndustryCategoryPropertyRespVO.class); + vo.setItems(propertyRespVOS); + return success(vo); + } + + @GetMapping("/page") + @Operation(summary = "获得行业分类分页") + @PreAuthorize("@ss.hasPermission('wms:industry-category:query')") + public CommonResult> getIndustryCategoryPage(@Valid IndustryCategoryPageReqVO pageReqVO) { + PageResult pageResult = industryCategoryService.getIndustryCategoryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, IndustryCategoryRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出行业分类 Excel") + @PreAuthorize("@ss.hasPermission('wms:industry-category:export')") + @OperateLog(type = EXPORT) + public void exportIndustryCategoryExcel(@Valid IndustryCategoryPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = industryCategoryService.getIndustryCategoryPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "行业分类.xls", "数据", IndustryCategoryRespVO.class, + BeanUtils.toBean(list, IndustryCategoryRespVO.class)); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryPageReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryPageReqVO.java new file mode 100644 index 00000000..74cfa1ad --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.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 IndustryCategoryPageReqVO extends PageParam { + + @Schema(description = "行业分类名称", example = "赵六") + private String name; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryRespVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryRespVO.java new file mode 100644 index 00000000..660ebdca --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategoryRespVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo; + +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertyRespVO; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Schema(description = "管理后台 - 行业分类 Response VO") +@Data +@ExcelIgnoreUnannotated +public class IndustryCategoryRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26302") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "行业分类名称", example = "赵六") + @ExcelProperty("行业分类名称") + private String name; + + @Schema(description = "备注", example = "随便") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "属性列表", example = "属性列表") + private List items; + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategorySaveReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategorySaveReqVO.java new file mode 100644 index 00000000..f29ec640 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategory/vo/IndustryCategorySaveReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo; + +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertySaveReqVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Schema(description = "管理后台 - 行业分类新增/修改 Request VO") +@Data +public class IndustryCategorySaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26302") + private Long id; + + @Schema(description = "行业分类名称", example = "赵六") + private String name; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "行业分类属性新增/修改列表") + private List items; +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/IndustryCategoryPropertyController.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/IndustryCategoryPropertyController.java new file mode 100644 index 00000000..e00ca0e8 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/IndustryCategoryPropertyController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty; + +import org.springframework.web.bind.annotation.*; +import javax.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 javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.*; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.service.industrycategoryproperty.IndustryCategoryPropertyService; + +@Tag(name = "管理后台 - 行业分类属性") +@RestController +@RequestMapping("/wms/industry-category-property") +@Validated +public class IndustryCategoryPropertyController { + + @Resource + private IndustryCategoryPropertyService industryCategoryPropertyService; + + @PostMapping("/create") + @Operation(summary = "创建行业分类属性") + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:create')") + public CommonResult createIndustryCategoryProperty(@Valid @RequestBody IndustryCategoryPropertySaveReqVO createReqVO) { + return success(industryCategoryPropertyService.createIndustryCategoryProperty(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新行业分类属性") + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:update')") + public CommonResult updateIndustryCategoryProperty(@Valid @RequestBody IndustryCategoryPropertySaveReqVO updateReqVO) { + industryCategoryPropertyService.updateIndustryCategoryProperty(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除行业分类属性") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:delete')") + public CommonResult deleteIndustryCategoryProperty(@RequestParam("id") Long id) { + industryCategoryPropertyService.deleteIndustryCategoryProperty(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得行业分类属性") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:query')") + public CommonResult getIndustryCategoryProperty(@RequestParam("id") Long id) { + IndustryCategoryPropertyDO industryCategoryProperty = industryCategoryPropertyService.getIndustryCategoryProperty(id); + return success(BeanUtils.toBean(industryCategoryProperty, IndustryCategoryPropertyRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得行业分类属性分页") + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:query')") + public CommonResult> getIndustryCategoryPropertyPage(@Valid IndustryCategoryPropertyPageReqVO pageReqVO) { + PageResult pageResult = industryCategoryPropertyService.getIndustryCategoryPropertyPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, IndustryCategoryPropertyRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出行业分类属性 Excel") + @PreAuthorize("@ss.hasPermission('wms:industry-category-property:export')") + @OperateLog(type = EXPORT) + public void exportIndustryCategoryPropertyExcel(@Valid IndustryCategoryPropertyPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = industryCategoryPropertyService.getIndustryCategoryPropertyPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "行业分类属性.xls", "数据", IndustryCategoryPropertyRespVO.class, + BeanUtils.toBean(list, IndustryCategoryPropertyRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyPageReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyPageReqVO.java new file mode 100644 index 00000000..eecdb017 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.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 IndustryCategoryPropertyPageReqVO extends PageParam { + + @Schema(description = "行业分类id", example = "27454") + private Long industryCategoryId; + + @Schema(description = "属性名称", example = "芋艿") + private String name; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyRespVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyRespVO.java new file mode 100644 index 00000000..04154c76 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertyRespVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +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 IndustryCategoryPropertyRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4356") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "行业分类id", example = "27454") + @ExcelProperty("行业分类id") + private Long industryCategoryId; + + @Schema(description = "属性名称", example = "芋艿") + @ExcelProperty("属性名称") + private String name; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertySaveReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertySaveReqVO.java new file mode 100644 index 00000000..bdc2f711 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/industrycategoryproperty/vo/IndustryCategoryPropertySaveReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 行业分类属性新增/修改 Request VO") +@Data +public class IndustryCategoryPropertySaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4356") + private Long id; + + @Schema(description = "行业分类id", example = "27454") + private Long industryCategoryId; + + @Schema(description = "属性名称", example = "芋艿") + private String name; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/ProductCategoryController.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/ProductCategoryController.java new file mode 100644 index 00000000..9e050286 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/ProductCategoryController.java @@ -0,0 +1,128 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategory; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategoryPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategoryRespVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategorySaveReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertyRespVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategory.ProductCategoryDO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.service.productcategory.ProductCategoryService; +import cn.iocoder.yudao.module.wms.service.productcategoryproperty.ProductCategoryPropertyService; +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 javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 产品分类") +@RestController +@RequestMapping("/wms/product-category") +@Validated +public class ProductCategoryController { + + @Resource + private ProductCategoryService productCategoryService; + @Resource + private ProductCategoryPropertyService productCategoryPropertyService; + + @PostMapping("/create") + @Operation(summary = "创建产品分类") + @PreAuthorize("@ss.hasPermission('wms:product-category:create')") + public CommonResult createProductCategory(@Valid @RequestBody ProductCategorySaveReqVO createReqVO) { + return success(productCategoryService.createProductCategory(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新产品分类") + @PreAuthorize("@ss.hasPermission('wms:product-category:update')") + public CommonResult updateProductCategory(@Valid @RequestBody ProductCategorySaveReqVO updateReqVO) { + productCategoryService.updateProductCategory(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除产品分类") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('wms:product-category:delete')") + public CommonResult deleteProductCategory(@RequestParam("id") Long id) { + productCategoryService.deleteProductCategory(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得产品分类") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('wms:product-category:query')") + public CommonResult getProductCategory(@RequestParam("id") Long id) { + ProductCategoryDO productCategory = productCategoryService.getProductCategory(id); + ProductCategoryRespVO vo = BeanUtils.toBean(productCategory, ProductCategoryRespVO.class); + List productCategoryPropertyDOS = productCategoryPropertyService.getByProductCategoryId(id); + List propertyRespVOS = BeanUtils.toBean(productCategoryPropertyDOS, ProductCategoryPropertyRespVO.class); + vo.setItems(propertyRespVOS); + return success(vo); + } + + + @GetMapping("/getByIndustryCategoryId") + @Operation(summary = "根据行业分类id获得产品分类列表") + @Parameter(name = "industryCategoryId", description = "行业分类id", required = true, example = "1024") + public CommonResult> getByIndustryCategoryId(@RequestParam("industryCategoryId") Long industryCategoryId) { + List productCategoryDOList = productCategoryService.getByIndustryCategoryId(industryCategoryId); + List vos = BeanUtils.toBean(productCategoryDOList, ProductCategoryRespVO.class); + List productCategoryIds = new ArrayList<>(); + if (!vos.isEmpty()) { + productCategoryIds = vos.stream().map(ProductCategoryRespVO::getId).collect(Collectors.toList()); + } + List productCategoryPropertyDOS = productCategoryPropertyService.getByProductCategoryIds(productCategoryIds); + if (!productCategoryPropertyDOS.isEmpty()) { + Map> map = productCategoryPropertyDOS.stream().collect(Collectors.groupingBy(ProductCategoryPropertyDO::getProductCategoryId, Collectors.toList())); + for (ProductCategoryRespVO vo : vos) { + List items = map.get(vo.getId()); + List propertyRespVOS = BeanUtils.toBean(items, ProductCategoryPropertyRespVO.class); + vo.setItems(propertyRespVOS); + } + } + return success(vos); + } + + @GetMapping("/page") + @Operation(summary = "获得产品分类分页") + @PreAuthorize("@ss.hasPermission('wms:product-category:query')") + public CommonResult> getProductCategoryPage(@Valid ProductCategoryPageReqVO pageReqVO) { + PageResult pageResult = productCategoryService.getProductCategoryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProductCategoryRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出产品分类 Excel") + @PreAuthorize("@ss.hasPermission('wms:product-category:export')") + @OperateLog(type = EXPORT) + public void exportProductCategoryExcel(@Valid ProductCategoryPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = productCategoryService.getProductCategoryPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "产品分类.xls", "数据", ProductCategoryRespVO.class, + BeanUtils.toBean(list, ProductCategoryRespVO.class)); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryPageReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryPageReqVO.java new file mode 100644 index 00000000..31b26160 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryPageReqVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.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 ProductCategoryPageReqVO extends PageParam { + + @Schema(description = "行业分类id", example = "16442") + private Long industryCategoryId; + + @Schema(description = "产品分类名称", example = "赵六") + private String name; + + @Schema(description = "一级单位") + private String unitI; + + @Schema(description = "二级单位") + private String unitIi; + + @Schema(description = "三级单位") + private String unitIii; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryRespVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryRespVO.java new file mode 100644 index 00000000..d4c7f16d --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategoryRespVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo; + +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertyRespVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +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 ProductCategoryRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26727") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "行业分类id", example = "16442") + @ExcelProperty("行业分类id") + private Long industryCategoryId; + + @Schema(description = "产品分类名称", example = "赵六") + @ExcelProperty("产品分类名称") + private String name; + + @Schema(description = "一级单位") + @ExcelProperty("一级单位") + private String unitI; + + @Schema(description = "二级单位") + @ExcelProperty("二级单位") + private String unitIi; + + @Schema(description = "三级单位") + @ExcelProperty("三级单位") + private String unitIii; + + @Schema(description = "备注", example = "随便") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "属性列表", example = "属性列表") + private List items; + + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategorySaveReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategorySaveReqVO.java new file mode 100644 index 00000000..07237b7f --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategory/vo/ProductCategorySaveReqVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo; + +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 产品分类新增/修改 Request VO") +@Data +public class ProductCategorySaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26727") + private Long id; + + @Schema(description = "行业分类id", example = "16442") + private Long industryCategoryId; + + @Schema(description = "产品分类名称", example = "赵六") + private String name; + + @Schema(description = "一级单位") + private String unitI; + + @Schema(description = "二级单位") + private String unitIi; + + @Schema(description = "三级单位") + private String unitIii; + + @Schema(description = "备注", example = "随便") + private String remark; + + @Schema(description = "属性列表", example = "属性列表") + private List items; + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/ProductCategoryPropertyController.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/ProductCategoryPropertyController.java new file mode 100644 index 00000000..42973691 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/ProductCategoryPropertyController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty; + +import org.springframework.web.bind.annotation.*; +import javax.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 javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.*; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.service.productcategoryproperty.ProductCategoryPropertyService; + +@Tag(name = "管理后台 - 产品分类属性") +@RestController +@RequestMapping("/wms/product-category-property") +@Validated +public class ProductCategoryPropertyController { + + @Resource + private ProductCategoryPropertyService productCategoryPropertyService; + + @PostMapping("/create") + @Operation(summary = "创建产品分类属性") + @PreAuthorize("@ss.hasPermission('wms:product-category-property:create')") + public CommonResult createProductCategoryProperty(@Valid @RequestBody ProductCategoryPropertySaveReqVO createReqVO) { + return success(productCategoryPropertyService.createProductCategoryProperty(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新产品分类属性") + @PreAuthorize("@ss.hasPermission('wms:product-category-property:update')") + public CommonResult updateProductCategoryProperty(@Valid @RequestBody ProductCategoryPropertySaveReqVO updateReqVO) { + productCategoryPropertyService.updateProductCategoryProperty(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除产品分类属性") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('wms:product-category-property:delete')") + public CommonResult deleteProductCategoryProperty(@RequestParam("id") Long id) { + productCategoryPropertyService.deleteProductCategoryProperty(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得产品分类属性") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('wms:product-category-property:query')") + public CommonResult getProductCategoryProperty(@RequestParam("id") Long id) { + ProductCategoryPropertyDO productCategoryProperty = productCategoryPropertyService.getProductCategoryProperty(id); + return success(BeanUtils.toBean(productCategoryProperty, ProductCategoryPropertyRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得产品分类属性分页") + @PreAuthorize("@ss.hasPermission('wms:product-category-property:query')") + public CommonResult> getProductCategoryPropertyPage(@Valid ProductCategoryPropertyPageReqVO pageReqVO) { + PageResult pageResult = productCategoryPropertyService.getProductCategoryPropertyPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProductCategoryPropertyRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出产品分类属性 Excel") + @PreAuthorize("@ss.hasPermission('wms:product-category-property:export')") + @OperateLog(type = EXPORT) + public void exportProductCategoryPropertyExcel(@Valid ProductCategoryPropertyPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = productCategoryPropertyService.getProductCategoryPropertyPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "产品分类属性.xls", "数据", ProductCategoryPropertyRespVO.class, + BeanUtils.toBean(list, ProductCategoryPropertyRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyPageReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyPageReqVO.java new file mode 100644 index 00000000..fc943e0a --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.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 ProductCategoryPropertyPageReqVO extends PageParam { + + @Schema(description = "产品分类id", example = "32382") + private Long productCategoryId; + + @Schema(description = "属性名称", example = "王五") + private String name; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyRespVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyRespVO.java new file mode 100644 index 00000000..8d3ac6ac --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertyRespVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +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 ProductCategoryPropertyRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "975") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "产品分类id", example = "32382") + @ExcelProperty("产品分类id") + private Long productCategoryId; + + @Schema(description = "属性名称", example = "王五") + @ExcelProperty("属性名称") + private String name; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertySaveReqVO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertySaveReqVO.java new file mode 100644 index 00000000..923d33ea --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/controller/admin/productcategoryproperty/vo/ProductCategoryPropertySaveReqVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 产品分类属性新增/修改 Request VO") +@Data +public class ProductCategoryPropertySaveReqVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "975") + private Long id; + + @Schema(description = "产品分类id", example = "32382") + private Long productCategoryId; + + @Schema(description = "属性名称", example = "王五") + private String name; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategory/IndustryCategoryDO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategory/IndustryCategoryDO.java new file mode 100644 index 00000000..02099c2b --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategory/IndustryCategoryDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.wms.dal.dataobject.industrycategory; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 行业分类 DO + * + * @author 艾楷 + */ +@TableName("wms_industry_category") +@KeySequence("wms_industry_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class IndustryCategoryDO extends BaseDO { + + /** + * ID + */ + @TableId + private Long id; + /** + * 行业分类名称 + */ + private String name; + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategoryproperty/IndustryCategoryPropertyDO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategoryproperty/IndustryCategoryPropertyDO.java new file mode 100644 index 00000000..ce81f0e3 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/industrycategoryproperty/IndustryCategoryPropertyDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 行业分类属性 DO + * + * @author 艾楷 + */ +@TableName("wms_industry_category_property") +@KeySequence("wms_industry_category_property_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class IndustryCategoryPropertyDO extends BaseDO { + + /** + * ID + */ + @TableId + private Long id; + /** + * 行业分类id + */ + private Long industryCategoryId; + /** + * 属性名称 + */ + private String name; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategory/ProductCategoryDO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategory/ProductCategoryDO.java new file mode 100644 index 00000000..e55f8709 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategory/ProductCategoryDO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.wms.dal.dataobject.productcategory; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 产品分类 DO + * + * @author 艾楷 + */ +@TableName("wms_product_category") +@KeySequence("wms_product_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProductCategoryDO extends BaseDO { + + /** + * ID + */ + @TableId + private Long id; + /** + * 行业分类id + */ + private Long industryCategoryId; + /** + * 产品分类名称 + */ + private String name; + /** + * 一级单位 + */ + private String unitI; + /** + * 二级单位 + */ + private String unitIi; + /** + * 三级单位 + */ + private String unitIii; + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategoryproperty/ProductCategoryPropertyDO.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategoryproperty/ProductCategoryPropertyDO.java new file mode 100644 index 00000000..8e5f091e --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/dataobject/productcategoryproperty/ProductCategoryPropertyDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 产品分类属性 DO + * + * @author 艾楷 + */ +@TableName("wms_product_category_property") +@KeySequence("wms_product_category_property_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProductCategoryPropertyDO extends BaseDO { + + /** + * ID + */ + @TableId + private Long id; + /** + * 产品分类id + */ + private Long productCategoryId; + /** + * 属性名称 + */ + private String name; + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategory/IndustryCategoryMapper.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategory/IndustryCategoryMapper.java new file mode 100644 index 00000000..2965c0e9 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategory/IndustryCategoryMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.dal.mysql.industrycategory; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategory.IndustryCategoryDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.*; + +/** + * 行业分类 Mapper + * + * @author 艾楷 + */ +@Mapper +public interface IndustryCategoryMapper extends BaseMapperX { + + default PageResult selectPage(IndustryCategoryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(IndustryCategoryDO::getName, reqVO.getName()) + .eqIfPresent(IndustryCategoryDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(IndustryCategoryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(IndustryCategoryDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategoryproperty/IndustryCategoryPropertyMapper.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategoryproperty/IndustryCategoryPropertyMapper.java new file mode 100644 index 00000000..de0c4e46 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/industrycategoryproperty/IndustryCategoryPropertyMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.dal.mysql.industrycategoryproperty; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.*; + +/** + * 行业分类属性 Mapper + * + * @author 艾楷 + */ +@Mapper +public interface IndustryCategoryPropertyMapper extends BaseMapperX { + + default PageResult selectPage(IndustryCategoryPropertyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(IndustryCategoryPropertyDO::getIndustryCategoryId, reqVO.getIndustryCategoryId()) + .likeIfPresent(IndustryCategoryPropertyDO::getName, reqVO.getName()) + .betweenIfPresent(IndustryCategoryPropertyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(IndustryCategoryPropertyDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategory/ProductCategoryMapper.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategory/ProductCategoryMapper.java new file mode 100644 index 00000000..e743c51b --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategory/ProductCategoryMapper.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.wms.dal.mysql.productcategory; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategory.ProductCategoryDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.*; + +/** + * 产品分类 Mapper + * + * @author 艾楷 + */ +@Mapper +public interface ProductCategoryMapper extends BaseMapperX { + + default PageResult selectPage(ProductCategoryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ProductCategoryDO::getIndustryCategoryId, reqVO.getIndustryCategoryId()) + .likeIfPresent(ProductCategoryDO::getName, reqVO.getName()) + .eqIfPresent(ProductCategoryDO::getUnitI, reqVO.getUnitI()) + .eqIfPresent(ProductCategoryDO::getUnitIi, reqVO.getUnitIi()) + .eqIfPresent(ProductCategoryDO::getUnitIii, reqVO.getUnitIii()) + .eqIfPresent(ProductCategoryDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(ProductCategoryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ProductCategoryDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategoryproperty/ProductCategoryPropertyMapper.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategoryproperty/ProductCategoryPropertyMapper.java new file mode 100644 index 00000000..83b9de13 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/dal/mysql/productcategoryproperty/ProductCategoryPropertyMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.wms.dal.mysql.productcategoryproperty; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.*; + +/** + * 产品分类属性 Mapper + * + * @author 艾楷 + */ +@Mapper +public interface ProductCategoryPropertyMapper extends BaseMapperX { + + default PageResult selectPage(ProductCategoryPropertyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ProductCategoryPropertyDO::getProductCategoryId, reqVO.getProductCategoryId()) + .likeIfPresent(ProductCategoryPropertyDO::getName, reqVO.getName()) + .betweenIfPresent(ProductCategoryPropertyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ProductCategoryPropertyDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryService.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryService.java new file mode 100644 index 00000000..7c84cfc5 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.wms.service.industrycategory; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.*; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategory.IndustryCategoryDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 行业分类 Service 接口 + * + * @author 艾楷 + */ +public interface IndustryCategoryService { + + /** + * 创建行业分类 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createIndustryCategory(@Valid IndustryCategorySaveReqVO createReqVO); + + /** + * 更新行业分类 + * + * @param updateReqVO 更新信息 + */ + void updateIndustryCategory(@Valid IndustryCategorySaveReqVO updateReqVO); + + /** + * 删除行业分类 + * + * @param id 编号 + */ + void deleteIndustryCategory(Long id); + + /** + * 获得行业分类 + * + * @param id 编号 + * @return 行业分类 + */ + IndustryCategoryDO getIndustryCategory(Long id); + + /** + * 获得行业分类分页 + * + * @param pageReqVO 分页查询 + * @return 行业分类分页 + */ + PageResult getIndustryCategoryPage(IndustryCategoryPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryServiceImpl.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryServiceImpl.java new file mode 100644 index 00000000..4771060a --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategory/IndustryCategoryServiceImpl.java @@ -0,0 +1,92 @@ +package cn.iocoder.yudao.module.wms.service.industrycategory; + +import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.IndustryCategoryPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategory.vo.IndustryCategorySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategory.IndustryCategoryDO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.dal.mysql.industrycategory.IndustryCategoryMapper; +import cn.iocoder.yudao.module.wms.dal.mysql.industrycategoryproperty.IndustryCategoryPropertyMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 行业分类 Service 实现类 + * + * @author 艾楷 + */ +@Service +@Validated +public class IndustryCategoryServiceImpl implements IndustryCategoryService { + + @Resource + private IndustryCategoryMapper industryCategoryMapper; + @Resource + private IndustryCategoryPropertyMapper industryCategoryPropertyMapper; + + @Override + public Long createIndustryCategory(IndustryCategorySaveReqVO createReqVO) { + // 插入 + IndustryCategoryDO industryCategory = BeanUtils.toBean(createReqVO, IndustryCategoryDO.class); + industryCategoryMapper.insert(industryCategory); + List items = BeanUtils.toBean(createReqVO.getItems(), IndustryCategoryPropertyDO.class); + for (IndustryCategoryPropertyDO item : items) { + item.setIndustryCategoryId(industryCategory.getId()); + } + industryCategoryPropertyMapper.insertBatch(items); + // 返回 + return industryCategory.getId(); + } + + @Override + public void updateIndustryCategory(IndustryCategorySaveReqVO updateReqVO) { + // 更新 + IndustryCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IndustryCategoryDO.class); + industryCategoryMapper.updateById(updateObj); + List list = BeanUtils.toBean(updateReqVO.getItems(), IndustryCategoryPropertyDO.class); + // -- 查询旧的 + List oldList = industryCategoryPropertyMapper.selectList( + new LambdaQueryWrapper().eq(IndustryCategoryPropertyDO::getIndustryCategoryId, updateObj.getId()) + ); + List oldIds = oldList.stream().map(IndustryCategoryPropertyDO::getId).collect(Collectors.toList()); + List newIds = list.stream().map(IndustryCategoryPropertyDO::getId).filter(Objects::nonNull).collect(Collectors.toList()); + List delIds = CollectionUtil.subtractToList(oldIds, newIds); + if (!delIds.isEmpty()) { + industryCategoryPropertyMapper.deleteBatchIds(delIds); + } + List saveList = list.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + if (!saveList.isEmpty()) { + for (IndustryCategoryPropertyDO industryCategoryPropertyDO : saveList) { + industryCategoryPropertyDO.setIndustryCategoryId(updateReqVO.getId()); + } + industryCategoryPropertyMapper.insertBatch(saveList); + } + } + + @Override + public void deleteIndustryCategory(Long id) { + // 删除 + industryCategoryMapper.deleteById(id); + industryCategoryPropertyMapper.delete(new LambdaQueryWrapper() + .eq(IndustryCategoryPropertyDO::getIndustryCategoryId, id)); + } + + @Override + public IndustryCategoryDO getIndustryCategory(Long id) { + return industryCategoryMapper.selectById(id); + } + + @Override + public PageResult getIndustryCategoryPage(IndustryCategoryPageReqVO pageReqVO) { + return industryCategoryMapper.selectPage(pageReqVO); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyService.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyService.java new file mode 100644 index 00000000..78ae057f --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyService.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.wms.service.industrycategoryproperty; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertyPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 行业分类属性 Service 接口 + * + * @author 艾楷 + */ +public interface IndustryCategoryPropertyService { + + /** + * 创建行业分类属性 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createIndustryCategoryProperty(@Valid IndustryCategoryPropertySaveReqVO createReqVO); + + /** + * 更新行业分类属性 + * + * @param updateReqVO 更新信息 + */ + void updateIndustryCategoryProperty(@Valid IndustryCategoryPropertySaveReqVO updateReqVO); + + /** + * 删除行业分类属性 + * + * @param id 编号 + */ + void deleteIndustryCategoryProperty(Long id); + + /** + * 获得行业分类属性 + * + * @param id 编号 + * @return 行业分类属性 + */ + IndustryCategoryPropertyDO getIndustryCategoryProperty(Long id); + + /** + * 获得行业分类属性分页 + * + * @param pageReqVO 分页查询 + * @return 行业分类属性分页 + */ + PageResult getIndustryCategoryPropertyPage(IndustryCategoryPropertyPageReqVO pageReqVO); + + /** + * 根据行业分类id查询行业分类属性 + * @param industryCategoryId + * @return + */ + List getByIndustryCategoryId(Long industryCategoryId); +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyServiceImpl.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyServiceImpl.java new file mode 100644 index 00000000..8b11d94d --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/industrycategoryproperty/IndustryCategoryPropertyServiceImpl.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.wms.service.industrycategoryproperty; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertyPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.industrycategoryproperty.vo.IndustryCategoryPropertySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.industrycategoryproperty.IndustryCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.dal.mysql.industrycategoryproperty.IndustryCategoryPropertyMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 行业分类属性 Service 实现类 + * + * @author 艾楷 + */ +@Service +@Validated +public class IndustryCategoryPropertyServiceImpl implements IndustryCategoryPropertyService { + + @Resource + private IndustryCategoryPropertyMapper industryCategoryPropertyMapper; + + @Override + public Long createIndustryCategoryProperty(IndustryCategoryPropertySaveReqVO createReqVO) { + // 插入 + IndustryCategoryPropertyDO industryCategoryProperty = BeanUtils.toBean(createReqVO, IndustryCategoryPropertyDO.class); + industryCategoryPropertyMapper.insert(industryCategoryProperty); + + // 返回 + return industryCategoryProperty.getId(); + } + + @Override + public void updateIndustryCategoryProperty(IndustryCategoryPropertySaveReqVO updateReqVO) { + // 更新 + IndustryCategoryPropertyDO updateObj = BeanUtils.toBean(updateReqVO, IndustryCategoryPropertyDO.class); + industryCategoryPropertyMapper.updateById(updateObj); + } + + @Override + public void deleteIndustryCategoryProperty(Long id) { + // 删除 + industryCategoryPropertyMapper.deleteById(id); + } + + @Override + public IndustryCategoryPropertyDO getIndustryCategoryProperty(Long id) { + return industryCategoryPropertyMapper.selectById(id); + } + + @Override + public PageResult getIndustryCategoryPropertyPage(IndustryCategoryPropertyPageReqVO pageReqVO) { + return industryCategoryPropertyMapper.selectPage(pageReqVO); + } + + @Override + public List getByIndustryCategoryId(Long industryCategoryId) { + return industryCategoryPropertyMapper.selectList(new LambdaQueryWrapper() + .eq(IndustryCategoryPropertyDO::getIndustryCategoryId, industryCategoryId)); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryService.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryService.java new file mode 100644 index 00000000..128d673a --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryService.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.wms.service.productcategory; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategoryPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategorySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategory.ProductCategoryDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 产品分类 Service 接口 + * + * @author 艾楷 + */ +public interface ProductCategoryService { + + /** + * 创建产品分类 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProductCategory(@Valid ProductCategorySaveReqVO createReqVO); + + /** + * 更新产品分类 + * + * @param updateReqVO 更新信息 + */ + void updateProductCategory(@Valid ProductCategorySaveReqVO updateReqVO); + + /** + * 删除产品分类 + * + * @param id 编号 + */ + void deleteProductCategory(Long id); + + /** + * 获得产品分类 + * + * @param id 编号 + * @return 产品分类 + */ + ProductCategoryDO getProductCategory(Long id); + + /** + * 获得产品分类分页 + * + * @param pageReqVO 分页查询 + * @return 产品分类分页 + */ + PageResult getProductCategoryPage(ProductCategoryPageReqVO pageReqVO); + + /** + * 根据行业分类id获取产品分类列表 + * + * @param industryCategoryId + * @return + */ + List getByIndustryCategoryId(Long industryCategoryId); +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryServiceImpl.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryServiceImpl.java new file mode 100644 index 00000000..8c0758c3 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategory/ProductCategoryServiceImpl.java @@ -0,0 +1,101 @@ +package cn.iocoder.yudao.module.wms.service.productcategory; + +import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategoryPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategory.vo.ProductCategorySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategory.ProductCategoryDO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.dal.mysql.productcategory.ProductCategoryMapper; +import cn.iocoder.yudao.module.wms.dal.mysql.productcategoryproperty.ProductCategoryPropertyMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 产品分类 Service 实现类 + * + * @author 艾楷 + */ +@Service +@Validated +public class ProductCategoryServiceImpl implements ProductCategoryService { + + @Resource + private ProductCategoryMapper productCategoryMapper; + @Resource + private ProductCategoryPropertyMapper productCategoryPropertyMapper; + + @Override + public Long createProductCategory(ProductCategorySaveReqVO createReqVO) { + // 插入 + ProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, ProductCategoryDO.class); + productCategoryMapper.insert(productCategory); + + List items = BeanUtils.toBean(createReqVO.getItems(), ProductCategoryPropertyDO.class); + for (ProductCategoryPropertyDO item : items) { + item.setProductCategoryId(productCategory.getId()); + } + productCategoryPropertyMapper.insertBatch(items); + // 返回 + return productCategory.getId(); + } + + @Override + public void updateProductCategory(ProductCategorySaveReqVO updateReqVO) { + // 更新 + ProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, ProductCategoryDO.class); + productCategoryMapper.updateById(updateObj); + + + List list = BeanUtils.toBean(updateReqVO.getItems(), ProductCategoryPropertyDO.class); + // -- 查询旧的 + List oldList = productCategoryPropertyMapper.selectList( + new LambdaQueryWrapper().eq(ProductCategoryPropertyDO::getProductCategoryId, updateObj.getId()) + ); + List oldIds = oldList.stream().map(ProductCategoryPropertyDO::getId).collect(Collectors.toList()); + List newIds = list.stream().map(ProductCategoryPropertyDO::getId).filter(Objects::nonNull).collect(Collectors.toList()); + List delIds = CollectionUtil.subtractToList(oldIds, newIds); + if (!delIds.isEmpty()) { + productCategoryPropertyMapper.deleteBatchIds(delIds); + } + List saveList = list.stream().filter(item -> item.getId() == null).collect(Collectors.toList()); + if (!saveList.isEmpty()) { + for (ProductCategoryPropertyDO productCategoryPropertyDO : saveList) { + productCategoryPropertyDO.setProductCategoryId(updateReqVO.getId()); + } + productCategoryPropertyMapper.insertBatch(saveList); + } + } + + @Override + public void deleteProductCategory(Long id) { + // 删除 + productCategoryMapper.deleteById(id); + productCategoryPropertyMapper.delete(new LambdaQueryWrapper() + .eq(ProductCategoryPropertyDO::getProductCategoryId, id)); + } + + @Override + public ProductCategoryDO getProductCategory(Long id) { + return productCategoryMapper.selectById(id); + } + + @Override + public PageResult getProductCategoryPage(ProductCategoryPageReqVO pageReqVO) { + return productCategoryMapper.selectPage(pageReqVO); + } + + @Override + public List getByIndustryCategoryId(Long industryCategoryId) { + return productCategoryMapper.selectList(new LambdaQueryWrapper() + .eq(ProductCategoryDO::getIndustryCategoryId, industryCategoryId)); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyService.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyService.java new file mode 100644 index 00000000..7c5aad1c --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyService.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.wms.service.productcategoryproperty; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertyPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 产品分类属性 Service 接口 + * + * @author 艾楷 + */ +public interface ProductCategoryPropertyService { + + /** + * 创建产品分类属性 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProductCategoryProperty(@Valid ProductCategoryPropertySaveReqVO createReqVO); + + /** + * 更新产品分类属性 + * + * @param updateReqVO 更新信息 + */ + void updateProductCategoryProperty(@Valid ProductCategoryPropertySaveReqVO updateReqVO); + + /** + * 删除产品分类属性 + * + * @param id 编号 + */ + void deleteProductCategoryProperty(Long id); + + /** + * 获得产品分类属性 + * + * @param id 编号 + * @return 产品分类属性 + */ + ProductCategoryPropertyDO getProductCategoryProperty(Long id); + + /** + * 获得产品分类属性分页 + * + * @param pageReqVO 分页查询 + * @return 产品分类属性分页 + */ + PageResult getProductCategoryPropertyPage(ProductCategoryPropertyPageReqVO pageReqVO); + + /** + * 根据产品分类id获取产品属性列表 + * + * @param productCategoryId + * @return + */ + List getByProductCategoryId(Long productCategoryId); + + /** + * 根据产品分类ids获取产品属性列表 + * + * @param productCategoryIds + * @return + */ + List getByProductCategoryIds(List productCategoryIds); +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyServiceImpl.java b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyServiceImpl.java new file mode 100644 index 00000000..87c20e70 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/java/cn/iocoder/yudao/module/wms/service/productcategoryproperty/ProductCategoryPropertyServiceImpl.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.wms.service.productcategoryproperty; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertyPageReqVO; +import cn.iocoder.yudao.module.wms.controller.admin.productcategoryproperty.vo.ProductCategoryPropertySaveReqVO; +import cn.iocoder.yudao.module.wms.dal.dataobject.productcategoryproperty.ProductCategoryPropertyDO; +import cn.iocoder.yudao.module.wms.dal.mysql.productcategoryproperty.ProductCategoryPropertyMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +/** + * 产品分类属性 Service 实现类 + * + * @author 艾楷 + */ +@Service +@Validated +public class ProductCategoryPropertyServiceImpl implements ProductCategoryPropertyService { + + @Resource + private ProductCategoryPropertyMapper productCategoryPropertyMapper; + + @Override + public Long createProductCategoryProperty(ProductCategoryPropertySaveReqVO createReqVO) { + // 插入 + ProductCategoryPropertyDO productCategoryProperty = BeanUtils.toBean(createReqVO, ProductCategoryPropertyDO.class); + productCategoryPropertyMapper.insert(productCategoryProperty); + // 返回 + return productCategoryProperty.getId(); + } + + @Override + public void updateProductCategoryProperty(ProductCategoryPropertySaveReqVO updateReqVO) { + // 更新 + ProductCategoryPropertyDO updateObj = BeanUtils.toBean(updateReqVO, ProductCategoryPropertyDO.class); + productCategoryPropertyMapper.updateById(updateObj); + } + + @Override + public void deleteProductCategoryProperty(Long id) { + // 删除 + productCategoryPropertyMapper.deleteById(id); + } + + @Override + public ProductCategoryPropertyDO getProductCategoryProperty(Long id) { + return productCategoryPropertyMapper.selectById(id); + } + + @Override + public PageResult getProductCategoryPropertyPage(ProductCategoryPropertyPageReqVO pageReqVO) { + return productCategoryPropertyMapper.selectPage(pageReqVO); + } + + @Override + public List getByProductCategoryId(Long productCategoryId) { + return productCategoryPropertyMapper.selectList(new LambdaQueryWrapper() + .eq(ProductCategoryPropertyDO::getProductCategoryId, productCategoryId)); + } + + @Override + public List getByProductCategoryIds(List productCategoryIds) { + if (productCategoryIds.isEmpty()) { + return Collections.emptyList(); + } + return productCategoryPropertyMapper.selectList(new LambdaQueryWrapper() + .in(ProductCategoryPropertyDO::getProductCategoryId, productCategoryIds)); + } + +} diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategory/IndustryCategoryMapper.xml b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategory/IndustryCategoryMapper.xml new file mode 100644 index 00000000..0afa96b7 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategory/IndustryCategoryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategoryproperty/IndustryCategoryPropertyMapper.xml b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategoryproperty/IndustryCategoryPropertyMapper.xml new file mode 100644 index 00000000..393fc3ff --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/industrycategoryproperty/IndustryCategoryPropertyMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategory/ProductCategoryMapper.xml b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategory/ProductCategoryMapper.xml new file mode 100644 index 00000000..42f41477 --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategory/ProductCategoryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategoryproperty/ProductCategoryPropertyMapper.xml b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategoryproperty/ProductCategoryPropertyMapper.xml new file mode 100644 index 00000000..46b3cf2e --- /dev/null +++ b/yudao-module-wms/yudao-module-wms-biz/src/main/resources/mapper/productcategoryproperty/ProductCategoryPropertyMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file