Merge branch 'dev' into frx
This commit is contained in:
commit
3cab76d582
@ -173,7 +173,7 @@
|
||||
and b.type = #{dto.type}
|
||||
</if>
|
||||
<if test="dto.deptId != null">
|
||||
and b.dept_id = #{deptId}
|
||||
and b.dept_id = #{dto.deptId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
@ -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<Long> createIndustryCategory(@Valid @RequestBody IndustryCategorySaveReqVO createReqVO) {
|
||||
return success(industryCategoryService.createIndustryCategory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新行业分类")
|
||||
@PreAuthorize("@ss.hasPermission('wms:industry-category:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<IndustryCategoryRespVO> getIndustryCategory(@RequestParam("id") Long id) {
|
||||
IndustryCategoryDO industryCategory = industryCategoryService.getIndustryCategory(id);
|
||||
IndustryCategoryRespVO vo = BeanUtils.toBean(industryCategory, IndustryCategoryRespVO.class);
|
||||
List<IndustryCategoryPropertyDO> industryCategoryPropertyList = industryCategoryPropertyService.getByIndustryCategoryId(id);
|
||||
List<IndustryCategoryPropertyRespVO> 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<PageResult<IndustryCategoryRespVO>> getIndustryCategoryPage(@Valid IndustryCategoryPageReqVO pageReqVO) {
|
||||
PageResult<IndustryCategoryDO> 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<IndustryCategoryDO> list = industryCategoryService.getIndustryCategoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "行业分类.xls", "数据", IndustryCategoryRespVO.class,
|
||||
BeanUtils.toBean(list, IndustryCategoryRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<IndustryCategoryPropertyRespVO> items;
|
||||
|
||||
}
|
@ -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<IndustryCategoryPropertySaveReqVO> items;
|
||||
}
|
@ -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<Long> createIndustryCategoryProperty(@Valid @RequestBody IndustryCategoryPropertySaveReqVO createReqVO) {
|
||||
return success(industryCategoryPropertyService.createIndustryCategoryProperty(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新行业分类属性")
|
||||
@PreAuthorize("@ss.hasPermission('wms:industry-category-property:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<IndustryCategoryPropertyRespVO> 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<PageResult<IndustryCategoryPropertyRespVO>> getIndustryCategoryPropertyPage(@Valid IndustryCategoryPropertyPageReqVO pageReqVO) {
|
||||
PageResult<IndustryCategoryPropertyDO> 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<IndustryCategoryPropertyDO> list = industryCategoryPropertyService.getIndustryCategoryPropertyPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "行业分类属性.xls", "数据", IndustryCategoryPropertyRespVO.class,
|
||||
BeanUtils.toBean(list, IndustryCategoryPropertyRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<Long> createProductCategory(@Valid @RequestBody ProductCategorySaveReqVO createReqVO) {
|
||||
return success(productCategoryService.createProductCategory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品分类")
|
||||
@PreAuthorize("@ss.hasPermission('wms:product-category:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<ProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
|
||||
ProductCategoryDO productCategory = productCategoryService.getProductCategory(id);
|
||||
ProductCategoryRespVO vo = BeanUtils.toBean(productCategory, ProductCategoryRespVO.class);
|
||||
List<ProductCategoryPropertyDO> productCategoryPropertyDOS = productCategoryPropertyService.getByProductCategoryId(id);
|
||||
List<ProductCategoryPropertyRespVO> 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<List<ProductCategoryRespVO>> getByIndustryCategoryId(@RequestParam("industryCategoryId") Long industryCategoryId) {
|
||||
List<ProductCategoryDO> productCategoryDOList = productCategoryService.getByIndustryCategoryId(industryCategoryId);
|
||||
List<ProductCategoryRespVO> vos = BeanUtils.toBean(productCategoryDOList, ProductCategoryRespVO.class);
|
||||
List<Long> productCategoryIds = new ArrayList<>();
|
||||
if (!vos.isEmpty()) {
|
||||
productCategoryIds = vos.stream().map(ProductCategoryRespVO::getId).collect(Collectors.toList());
|
||||
}
|
||||
List<ProductCategoryPropertyDO> productCategoryPropertyDOS = productCategoryPropertyService.getByProductCategoryIds(productCategoryIds);
|
||||
if (!productCategoryPropertyDOS.isEmpty()) {
|
||||
Map<Long, List<ProductCategoryPropertyDO>> map = productCategoryPropertyDOS.stream().collect(Collectors.groupingBy(ProductCategoryPropertyDO::getProductCategoryId, Collectors.toList()));
|
||||
for (ProductCategoryRespVO vo : vos) {
|
||||
List<ProductCategoryPropertyDO> items = map.get(vo.getId());
|
||||
List<ProductCategoryPropertyRespVO> 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<PageResult<ProductCategoryRespVO>> getProductCategoryPage(@Valid ProductCategoryPageReqVO pageReqVO) {
|
||||
PageResult<ProductCategoryDO> 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<ProductCategoryDO> list = productCategoryService.getProductCategoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品分类.xls", "数据", ProductCategoryRespVO.class,
|
||||
BeanUtils.toBean(list, ProductCategoryRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<ProductCategoryPropertyRespVO> items;
|
||||
|
||||
|
||||
}
|
@ -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<ProductCategoryPropertySaveReqVO> items;
|
||||
|
||||
}
|
@ -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<Long> createProductCategoryProperty(@Valid @RequestBody ProductCategoryPropertySaveReqVO createReqVO) {
|
||||
return success(productCategoryPropertyService.createProductCategoryProperty(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品分类属性")
|
||||
@PreAuthorize("@ss.hasPermission('wms:product-category-property:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<ProductCategoryPropertyRespVO> 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<PageResult<ProductCategoryPropertyRespVO>> getProductCategoryPropertyPage(@Valid ProductCategoryPropertyPageReqVO pageReqVO) {
|
||||
PageResult<ProductCategoryPropertyDO> 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<ProductCategoryPropertyDO> list = productCategoryPropertyService.getProductCategoryPropertyPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品分类属性.xls", "数据", ProductCategoryPropertyRespVO.class,
|
||||
BeanUtils.toBean(list, ProductCategoryPropertyRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<IndustryCategoryDO> {
|
||||
|
||||
default PageResult<IndustryCategoryDO> selectPage(IndustryCategoryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<IndustryCategoryDO>()
|
||||
.likeIfPresent(IndustryCategoryDO::getName, reqVO.getName())
|
||||
.eqIfPresent(IndustryCategoryDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(IndustryCategoryDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(IndustryCategoryDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<IndustryCategoryPropertyDO> {
|
||||
|
||||
default PageResult<IndustryCategoryPropertyDO> selectPage(IndustryCategoryPropertyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<IndustryCategoryPropertyDO>()
|
||||
.eqIfPresent(IndustryCategoryPropertyDO::getIndustryCategoryId, reqVO.getIndustryCategoryId())
|
||||
.likeIfPresent(IndustryCategoryPropertyDO::getName, reqVO.getName())
|
||||
.betweenIfPresent(IndustryCategoryPropertyDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(IndustryCategoryPropertyDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<ProductCategoryDO> {
|
||||
|
||||
default PageResult<ProductCategoryDO> selectPage(ProductCategoryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductCategoryDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
@ -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<ProductCategoryPropertyDO> {
|
||||
|
||||
default PageResult<ProductCategoryPropertyDO> selectPage(ProductCategoryPropertyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductCategoryPropertyDO>()
|
||||
.eqIfPresent(ProductCategoryPropertyDO::getProductCategoryId, reqVO.getProductCategoryId())
|
||||
.likeIfPresent(ProductCategoryPropertyDO::getName, reqVO.getName())
|
||||
.betweenIfPresent(ProductCategoryPropertyDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductCategoryPropertyDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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<IndustryCategoryDO> getIndustryCategoryPage(IndustryCategoryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -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<IndustryCategoryPropertyDO> 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<IndustryCategoryPropertyDO> list = BeanUtils.toBean(updateReqVO.getItems(), IndustryCategoryPropertyDO.class);
|
||||
// -- 查询旧的
|
||||
List<IndustryCategoryPropertyDO> oldList = industryCategoryPropertyMapper.selectList(
|
||||
new LambdaQueryWrapper<IndustryCategoryPropertyDO>().eq(IndustryCategoryPropertyDO::getIndustryCategoryId, updateObj.getId())
|
||||
);
|
||||
List<Long> oldIds = oldList.stream().map(IndustryCategoryPropertyDO::getId).collect(Collectors.toList());
|
||||
List<Long> newIds = list.stream().map(IndustryCategoryPropertyDO::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<Long> delIds = CollectionUtil.subtractToList(oldIds, newIds);
|
||||
if (!delIds.isEmpty()) {
|
||||
industryCategoryPropertyMapper.deleteBatchIds(delIds);
|
||||
}
|
||||
List<IndustryCategoryPropertyDO> 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<IndustryCategoryPropertyDO>()
|
||||
.eq(IndustryCategoryPropertyDO::getIndustryCategoryId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndustryCategoryDO getIndustryCategory(Long id) {
|
||||
return industryCategoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<IndustryCategoryDO> getIndustryCategoryPage(IndustryCategoryPageReqVO pageReqVO) {
|
||||
return industryCategoryMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -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<IndustryCategoryPropertyDO> getIndustryCategoryPropertyPage(IndustryCategoryPropertyPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据行业分类id查询行业分类属性
|
||||
* @param industryCategoryId
|
||||
* @return
|
||||
*/
|
||||
List<IndustryCategoryPropertyDO> getByIndustryCategoryId(Long industryCategoryId);
|
||||
}
|
@ -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<IndustryCategoryPropertyDO> getIndustryCategoryPropertyPage(IndustryCategoryPropertyPageReqVO pageReqVO) {
|
||||
return industryCategoryPropertyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IndustryCategoryPropertyDO> getByIndustryCategoryId(Long industryCategoryId) {
|
||||
return industryCategoryPropertyMapper.selectList(new LambdaQueryWrapper<IndustryCategoryPropertyDO>()
|
||||
.eq(IndustryCategoryPropertyDO::getIndustryCategoryId, industryCategoryId));
|
||||
}
|
||||
|
||||
}
|
@ -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<ProductCategoryDO> getProductCategoryPage(ProductCategoryPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据行业分类id获取产品分类列表
|
||||
*
|
||||
* @param industryCategoryId
|
||||
* @return
|
||||
*/
|
||||
List<ProductCategoryDO> getByIndustryCategoryId(Long industryCategoryId);
|
||||
}
|
@ -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<ProductCategoryPropertyDO> 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<ProductCategoryPropertyDO> list = BeanUtils.toBean(updateReqVO.getItems(), ProductCategoryPropertyDO.class);
|
||||
// -- 查询旧的
|
||||
List<ProductCategoryPropertyDO> oldList = productCategoryPropertyMapper.selectList(
|
||||
new LambdaQueryWrapper<ProductCategoryPropertyDO>().eq(ProductCategoryPropertyDO::getProductCategoryId, updateObj.getId())
|
||||
);
|
||||
List<Long> oldIds = oldList.stream().map(ProductCategoryPropertyDO::getId).collect(Collectors.toList());
|
||||
List<Long> newIds = list.stream().map(ProductCategoryPropertyDO::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<Long> delIds = CollectionUtil.subtractToList(oldIds, newIds);
|
||||
if (!delIds.isEmpty()) {
|
||||
productCategoryPropertyMapper.deleteBatchIds(delIds);
|
||||
}
|
||||
List<ProductCategoryPropertyDO> 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<ProductCategoryPropertyDO>()
|
||||
.eq(ProductCategoryPropertyDO::getProductCategoryId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductCategoryDO getProductCategory(Long id) {
|
||||
return productCategoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProductCategoryDO> getProductCategoryPage(ProductCategoryPageReqVO pageReqVO) {
|
||||
return productCategoryMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductCategoryDO> getByIndustryCategoryId(Long industryCategoryId) {
|
||||
return productCategoryMapper.selectList(new LambdaQueryWrapper<ProductCategoryDO>()
|
||||
.eq(ProductCategoryDO::getIndustryCategoryId, industryCategoryId));
|
||||
}
|
||||
|
||||
}
|
@ -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<ProductCategoryPropertyDO> getProductCategoryPropertyPage(ProductCategoryPropertyPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 根据产品分类id获取产品属性列表
|
||||
*
|
||||
* @param productCategoryId
|
||||
* @return
|
||||
*/
|
||||
List<ProductCategoryPropertyDO> getByProductCategoryId(Long productCategoryId);
|
||||
|
||||
/**
|
||||
* 根据产品分类ids获取产品属性列表
|
||||
*
|
||||
* @param productCategoryIds
|
||||
* @return
|
||||
*/
|
||||
List<ProductCategoryPropertyDO> getByProductCategoryIds(List<Long> productCategoryIds);
|
||||
}
|
@ -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<ProductCategoryPropertyDO> getProductCategoryPropertyPage(ProductCategoryPropertyPageReqVO pageReqVO) {
|
||||
return productCategoryPropertyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductCategoryPropertyDO> getByProductCategoryId(Long productCategoryId) {
|
||||
return productCategoryPropertyMapper.selectList(new LambdaQueryWrapper<ProductCategoryPropertyDO>()
|
||||
.eq(ProductCategoryPropertyDO::getProductCategoryId, productCategoryId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductCategoryPropertyDO> getByProductCategoryIds(List<Long> productCategoryIds) {
|
||||
if (productCategoryIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return productCategoryPropertyMapper.selectList(new LambdaQueryWrapper<ProductCategoryPropertyDO>()
|
||||
.in(ProductCategoryPropertyDO::getProductCategoryId, productCategoryIds));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.wms.dal.mysql.industrycategory.IndustryCategoryMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.wms.dal.mysql.industrycategoryproperty.IndustryCategoryPropertyMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.wms.dal.mysql.productcategory.ProductCategoryMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.wms.dal.mysql.productcategoryproperty.ProductCategoryPropertyMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user