diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/controller/BrandController.java b/ruoyi-mall/src/main/java/com/cyl/pms/controller/BrandController.java new file mode 100644 index 0000000..e36a70a --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/controller/BrandController.java @@ -0,0 +1,93 @@ +package com.cyl.pms.controller; + +import java.util.List; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Page; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.enums.BusinessType; +import com.cyl.pms.convert.BrandConvert; +import com.cyl.pms.domain.Brand; +import com.cyl.pms.pojo.query.BrandQuery; +import com.cyl.pms.service.BrandService; +import com.cyl.pms.pojo.vo.BrandVO; +import com.ruoyi.common.utils.poi.ExcelUtil; +/** + * 品牌管理Controller + * + * @author zcc + * @date 2022-11-18 + */ +@Api(description ="品牌管理接口列表") +@RestController +@RequestMapping("/pms/brand") +public class BrandController extends BaseController { + @Autowired + private BrandService service; + @Autowired + private BrandConvert convert; + + @ApiOperation("查询品牌管理列表") + @PreAuthorize("@ss.hasPermi('pms:brand:list')") + @PostMapping("/list") + public ResponseEntity> list(@RequestBody BrandQuery query, Pageable page) { + List list = service.selectList(query, page); + return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal())); + } + + @ApiOperation("导出品牌管理列表") + @PreAuthorize("@ss.hasPermi('pms:brand:export')") + @Log(title = "品牌管理", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public ResponseEntity export(BrandQuery query) { + List list = service.selectList(query, null); + ExcelUtil util = new ExcelUtil<>(BrandVO.class); + return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "品牌管理数据")); + } + + @ApiOperation("获取品牌管理详细信息") + @PreAuthorize("@ss.hasPermi('pms:brand:query')") + @GetMapping(value = "/{id}") + public ResponseEntity getInfo(@PathVariable("id") Long id) { + return ResponseEntity.ok(service.selectById(id)); + } + + @ApiOperation("新增品牌管理") + @PreAuthorize("@ss.hasPermi('pms:brand:add')") + @Log(title = "品牌管理", businessType = BusinessType.INSERT) + @PostMapping + public ResponseEntity add(@RequestBody Brand brand) { + return ResponseEntity.ok(service.insert(brand)); + } + + @ApiOperation("修改品牌管理") + @PreAuthorize("@ss.hasPermi('pms:brand:edit')") + @Log(title = "品牌管理", businessType = BusinessType.UPDATE) + @PutMapping + public ResponseEntity edit(@RequestBody Brand brand) { + return ResponseEntity.ok(service.update(brand)); + } + + @ApiOperation("删除品牌管理") + @PreAuthorize("@ss.hasPermi('pms:brand:remove')") + @Log(title = "品牌管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public ResponseEntity remove(@PathVariable Long[] ids) { + return ResponseEntity.ok(service.deleteByIds(ids)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductCategoryController.java b/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductCategoryController.java new file mode 100644 index 0000000..5004705 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductCategoryController.java @@ -0,0 +1,93 @@ +package com.cyl.pms.controller; + +import java.util.List; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Page; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.enums.BusinessType; +import com.cyl.pms.convert.ProductCategoryConvert; +import com.cyl.pms.domain.ProductCategory; +import com.cyl.pms.pojo.query.ProductCategoryQuery; +import com.cyl.pms.service.ProductCategoryService; +import com.cyl.pms.pojo.vo.ProductCategoryVO; +import com.ruoyi.common.utils.poi.ExcelUtil; +/** + * 商品分类Controller + * + * @author zcc + * @date 2022-11-18 + */ +@Api(description ="商品分类接口列表") +@RestController +@RequestMapping("/pms/productCategory") +public class ProductCategoryController extends BaseController { + @Autowired + private ProductCategoryService service; + @Autowired + private ProductCategoryConvert convert; + + @ApiOperation("查询商品分类列表") + @PreAuthorize("@ss.hasPermi('pms:productCategory:list')") + @PostMapping("/list") + public ResponseEntity> list(@RequestBody ProductCategoryQuery query, Pageable page) { + List list = service.selectList(query, page); + return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal())); + } + + @ApiOperation("导出商品分类列表") + @PreAuthorize("@ss.hasPermi('pms:productCategory:export')") + @Log(title = "商品分类", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public ResponseEntity export(ProductCategoryQuery query) { + List list = service.selectList(query, null); + ExcelUtil util = new ExcelUtil<>(ProductCategoryVO.class); + return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "商品分类数据")); + } + + @ApiOperation("获取商品分类详细信息") + @PreAuthorize("@ss.hasPermi('pms:productCategory:query')") + @GetMapping(value = "/{id}") + public ResponseEntity getInfo(@PathVariable("id") Long id) { + return ResponseEntity.ok(service.selectById(id)); + } + + @ApiOperation("新增商品分类") + @PreAuthorize("@ss.hasPermi('pms:productCategory:add')") + @Log(title = "商品分类", businessType = BusinessType.INSERT) + @PostMapping + public ResponseEntity add(@RequestBody ProductCategory productCategory) { + return ResponseEntity.ok(service.insert(productCategory)); + } + + @ApiOperation("修改商品分类") + @PreAuthorize("@ss.hasPermi('pms:productCategory:edit')") + @Log(title = "商品分类", businessType = BusinessType.UPDATE) + @PutMapping + public ResponseEntity edit(@RequestBody ProductCategory productCategory) { + return ResponseEntity.ok(service.update(productCategory)); + } + + @ApiOperation("删除商品分类") + @PreAuthorize("@ss.hasPermi('pms:productCategory:remove')") + @Log(title = "商品分类", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public ResponseEntity remove(@PathVariable Long[] ids) { + return ResponseEntity.ok(service.deleteByIds(ids)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductController.java b/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductController.java new file mode 100644 index 0000000..9ca0695 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/controller/ProductController.java @@ -0,0 +1,93 @@ +package com.cyl.pms.controller; + +import java.util.List; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Page; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.enums.BusinessType; +import com.cyl.pms.convert.ProductConvert; +import com.cyl.pms.domain.Product; +import com.cyl.pms.pojo.query.ProductQuery; +import com.cyl.pms.service.ProductService; +import com.cyl.pms.pojo.vo.ProductVO; +import com.ruoyi.common.utils.poi.ExcelUtil; +/** + * 商品信息Controller + * + * @author zcc + * @date 2022-11-18 + */ +@Api(description ="商品信息接口列表") +@RestController +@RequestMapping("/pms/product") +public class ProductController extends BaseController { + @Autowired + private ProductService service; + @Autowired + private ProductConvert convert; + + @ApiOperation("查询商品信息列表") + @PreAuthorize("@ss.hasPermi('pms:product:list')") + @PostMapping("/list") + public ResponseEntity> list(@RequestBody ProductQuery query, Pageable page) { + List list = service.selectList(query, page); + return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal())); + } + + @ApiOperation("导出商品信息列表") + @PreAuthorize("@ss.hasPermi('pms:product:export')") + @Log(title = "商品信息", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public ResponseEntity export(ProductQuery query) { + List list = service.selectList(query, null); + ExcelUtil util = new ExcelUtil<>(ProductVO.class); + return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "商品信息数据")); + } + + @ApiOperation("获取商品信息详细信息") + @PreAuthorize("@ss.hasPermi('pms:product:query')") + @GetMapping(value = "/{id}") + public ResponseEntity getInfo(@PathVariable("id") Long id) { + return ResponseEntity.ok(service.selectById(id)); + } + + @ApiOperation("新增商品信息") + @PreAuthorize("@ss.hasPermi('pms:product:add')") + @Log(title = "商品信息", businessType = BusinessType.INSERT) + @PostMapping + public ResponseEntity add(@RequestBody Product product) { + return ResponseEntity.ok(service.insert(product)); + } + + @ApiOperation("修改商品信息") + @PreAuthorize("@ss.hasPermi('pms:product:edit')") + @Log(title = "商品信息", businessType = BusinessType.UPDATE) + @PutMapping + public ResponseEntity edit(@RequestBody Product product) { + return ResponseEntity.ok(service.update(product)); + } + + @ApiOperation("删除商品信息") + @PreAuthorize("@ss.hasPermi('pms:product:remove')") + @Log(title = "商品信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public ResponseEntity remove(@PathVariable Long[] ids) { + return ResponseEntity.ok(service.deleteByIds(ids)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/controller/SkuController.java b/ruoyi-mall/src/main/java/com/cyl/pms/controller/SkuController.java new file mode 100644 index 0000000..95a8663 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/controller/SkuController.java @@ -0,0 +1,93 @@ +package com.cyl.pms.controller; + +import java.util.List; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Page; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.enums.BusinessType; +import com.cyl.pms.convert.SkuConvert; +import com.cyl.pms.domain.Sku; +import com.cyl.pms.pojo.query.SkuQuery; +import com.cyl.pms.service.SkuService; +import com.cyl.pms.pojo.vo.SkuVO; +import com.ruoyi.common.utils.poi.ExcelUtil; +/** + * sku信息Controller + * + * @author zcc + * @date 2022-11-18 + */ +@Api(description ="sku信息接口列表") +@RestController +@RequestMapping("/pms/sku") +public class SkuController extends BaseController { + @Autowired + private SkuService service; + @Autowired + private SkuConvert convert; + + @ApiOperation("查询sku信息列表") + @PreAuthorize("@ss.hasPermi('pms:sku:list')") + @PostMapping("/list") + public ResponseEntity> list(@RequestBody SkuQuery query, Pageable page) { + List list = service.selectList(query, page); + return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal())); + } + + @ApiOperation("导出sku信息列表") + @PreAuthorize("@ss.hasPermi('pms:sku:export')") + @Log(title = "sku信息", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public ResponseEntity export(SkuQuery query) { + List list = service.selectList(query, null); + ExcelUtil util = new ExcelUtil<>(SkuVO.class); + return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "sku信息数据")); + } + + @ApiOperation("获取sku信息详细信息") + @PreAuthorize("@ss.hasPermi('pms:sku:query')") + @GetMapping(value = "/{id}") + public ResponseEntity getInfo(@PathVariable("id") Long id) { + return ResponseEntity.ok(service.selectById(id)); + } + + @ApiOperation("新增sku信息") + @PreAuthorize("@ss.hasPermi('pms:sku:add')") + @Log(title = "sku信息", businessType = BusinessType.INSERT) + @PostMapping + public ResponseEntity add(@RequestBody Sku sku) { + return ResponseEntity.ok(service.insert(sku)); + } + + @ApiOperation("修改sku信息") + @PreAuthorize("@ss.hasPermi('pms:sku:edit')") + @Log(title = "sku信息", businessType = BusinessType.UPDATE) + @PutMapping + public ResponseEntity edit(@RequestBody Sku sku) { + return ResponseEntity.ok(service.update(sku)); + } + + @ApiOperation("删除sku信息") + @PreAuthorize("@ss.hasPermi('pms:sku:remove')") + @Log(title = "sku信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public ResponseEntity remove(@PathVariable Long[] ids) { + return ResponseEntity.ok(service.deleteByIds(ids)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/convert/BrandConvert.java b/ruoyi-mall/src/main/java/com/cyl/pms/convert/BrandConvert.java new file mode 100644 index 0000000..0fe7772 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/convert/BrandConvert.java @@ -0,0 +1,16 @@ +package com.cyl.pms.convert; + +import org.mapstruct.Mapper; +import com.cyl.pms.domain.Brand; +import com.cyl.pms.pojo.vo.BrandVO; +import java.util.List; +/** + * 品牌管理 DO <=> DTO <=> VO / BO / Query + * + * @author zcc + */ +@Mapper(componentModel = "spring") +public interface BrandConvert { + + List dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductCategoryConvert.java b/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductCategoryConvert.java new file mode 100644 index 0000000..8665933 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductCategoryConvert.java @@ -0,0 +1,16 @@ +package com.cyl.pms.convert; + +import org.mapstruct.Mapper; +import com.cyl.pms.domain.ProductCategory; +import com.cyl.pms.pojo.vo.ProductCategoryVO; +import java.util.List; +/** + * 商品分类 DO <=> DTO <=> VO / BO / Query + * + * @author zcc + */ +@Mapper(componentModel = "spring") +public interface ProductCategoryConvert { + + List dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductConvert.java b/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductConvert.java new file mode 100644 index 0000000..10f4494 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/convert/ProductConvert.java @@ -0,0 +1,16 @@ +package com.cyl.pms.convert; + +import org.mapstruct.Mapper; +import com.cyl.pms.domain.Product; +import com.cyl.pms.pojo.vo.ProductVO; +import java.util.List; +/** + * 商品信息 DO <=> DTO <=> VO / BO / Query + * + * @author zcc + */ +@Mapper(componentModel = "spring") +public interface ProductConvert { + + List dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/convert/SkuConvert.java b/ruoyi-mall/src/main/java/com/cyl/pms/convert/SkuConvert.java new file mode 100644 index 0000000..4b1460f --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/convert/SkuConvert.java @@ -0,0 +1,16 @@ +package com.cyl.pms.convert; + +import org.mapstruct.Mapper; +import com.cyl.pms.domain.Sku; +import com.cyl.pms.pojo.vo.SkuVO; +import java.util.List; +/** + * sku信息 DO <=> DTO <=> VO / BO / Query + * + * @author zcc + */ +@Mapper(componentModel = "spring") +public interface SkuConvert { + + List dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/domain/Brand.java b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Brand.java new file mode 100644 index 0000000..a2fffd4 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Brand.java @@ -0,0 +1,42 @@ +package com.cyl.pms.domain; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +/** + * 品牌管理对象 pms_brand + * + * @author zcc + */ +@ApiModel(description="品牌管理对象") +@Data +@TableName("pms_brand") +public class Brand extends BaseAudit { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("NAME") + @Excel(name = "NAME") + private String name; + + @ApiModelProperty("SORT") + @Excel(name = "SORT") + private Integer sort; + + @ApiModelProperty("SHOW_STATUS") + @Excel(name = "SHOW_STATUS") + private Integer showStatus; + + @ApiModelProperty("品牌logo") + @Excel(name = "品牌logo") + private String logo; + + @ApiModelProperty("删除标识") + private Integer delFlag; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/domain/Product.java b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Product.java new file mode 100644 index 0000000..2eec023 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Product.java @@ -0,0 +1,87 @@ +package com.cyl.pms.domain; + +import java.math.BigDecimal; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +/** + * 商品信息对象 pms_product + * + * @author zcc + */ +@ApiModel(description="商品信息对象") +@Data +@TableName("pms_product") +public class Product extends BaseAudit { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("BRAND_ID") + @Excel(name = "BRAND_ID") + private Long brandId; + + @ApiModelProperty("CATEGORY_ID") + @Excel(name = "CATEGORY_ID") + private Long categoryId; + + @ApiModelProperty("商品编码") + @Excel(name = "商品编码") + private String outProductId; + + @ApiModelProperty("NAME") + @Excel(name = "NAME") + private String name; + + @ApiModelProperty("主图") + @Excel(name = "主图") + private String pic; + + @ApiModelProperty("画册图片,连产品图片限制为5张,以逗号分割") + @Excel(name = "画册图片,连产品图片限制为5张,以逗号分割") + private String albumPics; + + @ApiModelProperty("上架状态:0->下架;1->上架") + @Excel(name = "上架状态:0->下架;1->上架") + private Integer publishStatus; + + @ApiModelProperty("排序") + @Excel(name = "排序") + private Integer sort; + + @ApiModelProperty("PRICE") + @Excel(name = "PRICE") + private BigDecimal price; + + @ApiModelProperty("单位") + @Excel(name = "单位") + private String unit; + + @ApiModelProperty("商品重量,默认为克") + @Excel(name = "商品重量,默认为克") + private BigDecimal weight; + + @ApiModelProperty("产品详情网页内容") + @Excel(name = "产品详情网页内容") + private String detailHtml; + + @ApiModelProperty("移动端网页详情") + @Excel(name = "移动端网页详情") + private String detailMobileHtml; + + @ApiModelProperty("品牌名称") + @Excel(name = "品牌名称") + private String brandName; + + @ApiModelProperty("商品分类名称") + @Excel(name = "商品分类名称") + private String productCategoryName; + + @ApiModelProperty("删除标识") + private Integer delFlag; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/domain/ProductCategory.java b/ruoyi-mall/src/main/java/com/cyl/pms/domain/ProductCategory.java new file mode 100644 index 0000000..7b6dd46 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/domain/ProductCategory.java @@ -0,0 +1,50 @@ +package com.cyl.pms.domain; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +/** + * 商品分类对象 pms_product_category + * + * @author zcc + */ +@ApiModel(description="商品分类对象") +@Data +@TableName("pms_product_category") +public class ProductCategory extends BaseAudit { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("上机分类的编号:0表示一级分类") + @Excel(name = "上机分类的编号:0表示一级分类") + private Long parentId; + + @ApiModelProperty("NAME") + @Excel(name = "NAME") + private String name; + + @ApiModelProperty("分类级别:0->1级;1->2级") + @Excel(name = "分类级别:0->1级;1->2级") + private Integer level; + + @ApiModelProperty("显示状态:0->不显示;1->显示") + @Excel(name = "显示状态:0->不显示;1->显示") + private Integer showStatus; + + @ApiModelProperty("SORT") + @Excel(name = "SORT") + private Integer sort; + + @ApiModelProperty("图标") + @Excel(name = "图标") + private String icon; + + @ApiModelProperty("删除标识") + private Integer delFlag; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/domain/Sku.java b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Sku.java new file mode 100644 index 0000000..0053d82 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/domain/Sku.java @@ -0,0 +1,47 @@ +package com.cyl.pms.domain; + +import java.math.BigDecimal; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +import com.baomidou.mybatisplus.annotation.TableName; +/** + * sku信息对象 pms_sku + * + * @author zcc + */ +@ApiModel(description="sku信息对象") +@Data +@TableName("pms_sku") +public class Sku extends BaseAudit { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("PRODUCT_ID") + @Excel(name = "PRODUCT_ID") + private Long productId; + + @ApiModelProperty("sku编码") + @Excel(name = "sku编码") + private String outSkuId; + + @ApiModelProperty("PRICE") + @Excel(name = "PRICE") + private BigDecimal price; + + @ApiModelProperty("展示图片") + @Excel(name = "展示图片") + private String pic; + + @ApiModelProperty("商品销售属性,json格式") + @Excel(name = "商品销售属性,json格式") + private String spData; + + @ApiModelProperty("删除标识") + private Integer delFlag; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/mapper/BrandMapper.java b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/BrandMapper.java new file mode 100644 index 0000000..e8c278c --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/BrandMapper.java @@ -0,0 +1,28 @@ +package com.cyl.pms.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import com.cyl.pms.domain.Brand; + +/** + * 品牌管理Mapper接口 + * + * @author zcc + */ +public interface BrandMapper extends BaseMapper { + /** + * 查询品牌管理列表 + * + * @param brand 品牌管理 + * @return 品牌管理集合 + */ + List selectByEntity(Brand brand); + + /** + * 批量软删除 + * @param ids + * @return + */ + int updateDelFlagByIds(@Param("ids") Long[] ids); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductCategoryMapper.java b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductCategoryMapper.java new file mode 100644 index 0000000..220cf8d --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductCategoryMapper.java @@ -0,0 +1,28 @@ +package com.cyl.pms.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import com.cyl.pms.domain.ProductCategory; + +/** + * 商品分类Mapper接口 + * + * @author zcc + */ +public interface ProductCategoryMapper extends BaseMapper { + /** + * 查询商品分类列表 + * + * @param productCategory 商品分类 + * @return 商品分类集合 + */ + List selectByEntity(ProductCategory productCategory); + + /** + * 批量软删除 + * @param ids + * @return + */ + int updateDelFlagByIds(@Param("ids") Long[] ids); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductMapper.java b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductMapper.java new file mode 100644 index 0000000..ad871ac --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/ProductMapper.java @@ -0,0 +1,28 @@ +package com.cyl.pms.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import com.cyl.pms.domain.Product; + +/** + * 商品信息Mapper接口 + * + * @author zcc + */ +public interface ProductMapper extends BaseMapper { + /** + * 查询商品信息列表 + * + * @param product 商品信息 + * @return 商品信息集合 + */ + List selectByEntity(Product product); + + /** + * 批量软删除 + * @param ids + * @return + */ + int updateDelFlagByIds(@Param("ids") Long[] ids); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/mapper/SkuMapper.java b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/SkuMapper.java new file mode 100644 index 0000000..2d91142 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/mapper/SkuMapper.java @@ -0,0 +1,28 @@ +package com.cyl.pms.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import com.cyl.pms.domain.Sku; + +/** + * sku信息Mapper接口 + * + * @author zcc + */ +public interface SkuMapper extends BaseMapper { + /** + * 查询sku信息列表 + * + * @param sku sku信息 + * @return sku信息集合 + */ + List selectByEntity(Sku sku); + + /** + * 批量软删除 + * @param ids + * @return + */ + int updateDelFlagByIds(@Param("ids") Long[] ids); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/BrandQuery.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/BrandQuery.java new file mode 100644 index 0000000..8b4316d --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/BrandQuery.java @@ -0,0 +1,27 @@ +package com.cyl.pms.pojo.query; + +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * 品牌管理 查询 对象 + * + * @author zcc + */ +@ApiModel(description="品牌管理 查询 对象") +@Data +public class BrandQuery { + @ApiModelProperty("NAME 精确匹配") + private String nameLike; + + @ApiModelProperty("SORT 精确匹配") + private Integer sort; + + @ApiModelProperty("SHOW_STATUS 精确匹配") + private Integer showStatus; + + @ApiModelProperty("品牌logo 精确匹配") + private String logo; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductCategoryQuery.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductCategoryQuery.java new file mode 100644 index 0000000..63c1f0f --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductCategoryQuery.java @@ -0,0 +1,33 @@ +package com.cyl.pms.pojo.query; + +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * 商品分类 查询 对象 + * + * @author zcc + */ +@ApiModel(description="商品分类 查询 对象") +@Data +public class ProductCategoryQuery { + @ApiModelProperty("上机分类的编号:0表示一级分类 精确匹配") + private Long parentId; + + @ApiModelProperty("NAME 精确匹配") + private String nameLike; + + @ApiModelProperty("分类级别:0->1级;1->2级 精确匹配") + private Integer level; + + @ApiModelProperty("显示状态:0->不显示;1->显示 精确匹配") + private Integer showStatus; + + @ApiModelProperty("SORT 精确匹配") + private Integer sort; + + @ApiModelProperty("图标 精确匹配") + private String icon; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductQuery.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductQuery.java new file mode 100644 index 0000000..5bc534a --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/ProductQuery.java @@ -0,0 +1,61 @@ +package com.cyl.pms.pojo.query; + +import java.math.BigDecimal; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * 商品信息 查询 对象 + * + * @author zcc + */ +@ApiModel(description="商品信息 查询 对象") +@Data +public class ProductQuery { + @ApiModelProperty("BRAND_ID 精确匹配") + private Long brandId; + + @ApiModelProperty("CATEGORY_ID 精确匹配") + private Long categoryId; + + @ApiModelProperty("商品编码 精确匹配") + private String outProductId; + + @ApiModelProperty("NAME 精确匹配") + private String nameLike; + + @ApiModelProperty("主图 精确匹配") + private String pic; + + @ApiModelProperty("画册图片,连产品图片限制为5张,以逗号分割 精确匹配") + private String albumPics; + + @ApiModelProperty("上架状态:0->下架;1->上架 精确匹配") + private Integer publishStatus; + + @ApiModelProperty("排序 精确匹配") + private Integer sort; + + @ApiModelProperty("PRICE 精确匹配") + private BigDecimal price; + + @ApiModelProperty("单位 精确匹配") + private String unit; + + @ApiModelProperty("商品重量,默认为克 精确匹配") + private BigDecimal weight; + + @ApiModelProperty("产品详情网页内容 精确匹配") + private String detailHtml; + + @ApiModelProperty("移动端网页详情 精确匹配") + private String detailMobileHtml; + + @ApiModelProperty("品牌名称 精确匹配") + private String brandNameLike; + + @ApiModelProperty("商品分类名称 精确匹配") + private String productCategoryNameLike; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/SkuQuery.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/SkuQuery.java new file mode 100644 index 0000000..676e5aa --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/query/SkuQuery.java @@ -0,0 +1,31 @@ +package com.cyl.pms.pojo.query; + +import java.math.BigDecimal; +import lombok.Data; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * sku信息 查询 对象 + * + * @author zcc + */ +@ApiModel(description="sku信息 查询 对象") +@Data +public class SkuQuery { + @ApiModelProperty("PRODUCT_ID 精确匹配") + private Long productId; + + @ApiModelProperty("sku编码 精确匹配") + private String outSkuId; + + @ApiModelProperty("PRICE 精确匹配") + private BigDecimal price; + + @ApiModelProperty("展示图片 精确匹配") + private String pic; + + @ApiModelProperty("商品销售属性,json格式 精确匹配") + private String spData; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/BrandVO.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/BrandVO.java new file mode 100644 index 0000000..f3ac386 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/BrandVO.java @@ -0,0 +1,28 @@ +package com.cyl.pms.pojo.vo; + +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +/** + * 品牌管理 数据视图对象 + * + * @author zcc + */ +@Data +public class BrandVO extends BaseAudit { + /** ID */ + private Long id; + /** NAME */ + @Excel(name = "NAME") + private String name; + /** SORT */ + @Excel(name = "SORT") + private Integer sort; + /** SHOW_STATUS */ + @Excel(name = "SHOW_STATUS") + private Integer showStatus; + /** 品牌logo */ + @Excel(name = "品牌logo") + private String logo; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductCategoryVO.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductCategoryVO.java new file mode 100644 index 0000000..8d587ce --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductCategoryVO.java @@ -0,0 +1,34 @@ +package com.cyl.pms.pojo.vo; + +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +/** + * 商品分类 数据视图对象 + * + * @author zcc + */ +@Data +public class ProductCategoryVO extends BaseAudit { + /** ID */ + private Long id; + /** 上机分类的编号:0表示一级分类 */ + @Excel(name = "上机分类的编号:0表示一级分类") + private Long parentId; + /** NAME */ + @Excel(name = "NAME") + private String name; + /** 分类级别:0->1级;1->2级 */ + @Excel(name = "分类级别:0->1级;1->2级") + private Integer level; + /** 显示状态:0->不显示;1->显示 */ + @Excel(name = "显示状态:0->不显示;1->显示") + private Integer showStatus; + /** SORT */ + @Excel(name = "SORT") + private Integer sort; + /** 图标 */ + @Excel(name = "图标") + private String icon; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductVO.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductVO.java new file mode 100644 index 0000000..b7c37b3 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/ProductVO.java @@ -0,0 +1,62 @@ +package com.cyl.pms.pojo.vo; + +import java.math.BigDecimal; +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +/** + * 商品信息 数据视图对象 + * + * @author zcc + */ +@Data +public class ProductVO extends BaseAudit { + /** ID */ + private Long id; + /** BRAND_ID */ + @Excel(name = "BRAND_ID") + private Long brandId; + /** CATEGORY_ID */ + @Excel(name = "CATEGORY_ID") + private Long categoryId; + /** 商品编码 */ + @Excel(name = "商品编码") + private String outProductId; + /** NAME */ + @Excel(name = "NAME") + private String name; + /** 主图 */ + @Excel(name = "主图") + private String pic; + /** 画册图片,连产品图片限制为5张,以逗号分割 */ + @Excel(name = "画册图片,连产品图片限制为5张,以逗号分割") + private String albumPics; + /** 上架状态:0->下架;1->上架 */ + @Excel(name = "上架状态:0->下架;1->上架") + private Integer publishStatus; + /** 排序 */ + @Excel(name = "排序") + private Integer sort; + /** PRICE */ + @Excel(name = "PRICE") + private BigDecimal price; + /** 单位 */ + @Excel(name = "单位") + private String unit; + /** 商品重量,默认为克 */ + @Excel(name = "商品重量,默认为克") + private BigDecimal weight; + /** 产品详情网页内容 */ + @Excel(name = "产品详情网页内容") + private String detailHtml; + /** 移动端网页详情 */ + @Excel(name = "移动端网页详情") + private String detailMobileHtml; + /** 品牌名称 */ + @Excel(name = "品牌名称") + private String brandName; + /** 商品分类名称 */ + @Excel(name = "商品分类名称") + private String productCategoryName; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/SkuVO.java b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/SkuVO.java new file mode 100644 index 0000000..895bf38 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/pojo/vo/SkuVO.java @@ -0,0 +1,32 @@ +package com.cyl.pms.pojo.vo; + +import java.math.BigDecimal; +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.domain.BaseAudit; +import lombok.Data; +/** + * sku信息 数据视图对象 + * + * @author zcc + */ +@Data +public class SkuVO extends BaseAudit { + /** ID */ + private Long id; + /** PRODUCT_ID */ + @Excel(name = "PRODUCT_ID") + private Long productId; + /** sku编码 */ + @Excel(name = "sku编码") + private String outSkuId; + /** PRICE */ + @Excel(name = "PRICE") + private BigDecimal price; + /** 展示图片 */ + @Excel(name = "展示图片") + private String pic; + /** 商品销售属性,json格式 */ + @Excel(name = "商品销售属性,json格式") + private String spData; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/service/BrandService.java b/ruoyi-mall/src/main/java/com/cyl/pms/service/BrandService.java new file mode 100644 index 0000000..43e479b --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/service/BrandService.java @@ -0,0 +1,111 @@ +package com.cyl.pms.service; + +import java.util.Arrays; +import java.util.List; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import com.cyl.pms.mapper.BrandMapper; +import com.cyl.pms.domain.Brand; +import com.cyl.pms.pojo.query.BrandQuery; + +/** + * 品牌管理Service业务层处理 + * + * + * @author zcc + */ +@Service +public class BrandService { + @Autowired + private BrandMapper brandMapper; + + /** + * 查询品牌管理 + * + * @param id 品牌管理主键 + * @return 品牌管理 + */ + public Brand selectById(Long id) { + return brandMapper.selectById(id); + } + + /** + * 查询品牌管理列表 + * + * @param query 查询条件 + * @param page 分页条件 + * @return 品牌管理 + */ + public List selectList(BrandQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("del_flag",0); + String nameLike = query.getNameLike(); + if (!StringUtils.isEmpty(nameLike)) { + qw.like("name", nameLike); + } + Integer sort = query.getSort(); + if (sort != null) { + qw.eq("sort", sort); + } + Integer showStatus = query.getShowStatus(); + if (showStatus != null) { + qw.eq("show_status", showStatus); + } + String logo = query.getLogo(); + if (!StringUtils.isEmpty(logo)) { + qw.eq("logo", logo); + } + return brandMapper.selectList(qw); + } + + /** + * 新增品牌管理 + * + * @param brand 品牌管理 + * @return 结果 + */ + public int insert(Brand brand) { + brand.setDelFlag(0); + brand.setCreateTime(LocalDateTime.now()); + return brandMapper.insert(brand); + } + + /** + * 修改品牌管理 + * + * @param brand 品牌管理 + * @return 结果 + */ + public int update(Brand brand) { + return brandMapper.updateById(brand); + } + + /** + * 批量删除品牌管理 + * + * @param ids 需要删除的品牌管理主键 + * @return 结果 + */ + public int deleteByIds(Long[] ids) { + return brandMapper.updateDelFlagByIds(ids); + } + + /** + * 删除品牌管理信息 + * + * @param id 品牌管理主键 + * @return 结果 + */ + public int deleteById(Long id) { + Long[] ids = {id}; + return brandMapper.updateDelFlagByIds(ids); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductCategoryService.java b/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductCategoryService.java new file mode 100644 index 0000000..98f979d --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductCategoryService.java @@ -0,0 +1,119 @@ +package com.cyl.pms.service; + +import java.util.Arrays; +import java.util.List; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import com.cyl.pms.mapper.ProductCategoryMapper; +import com.cyl.pms.domain.ProductCategory; +import com.cyl.pms.pojo.query.ProductCategoryQuery; + +/** + * 商品分类Service业务层处理 + * + * + * @author zcc + */ +@Service +public class ProductCategoryService { + @Autowired + private ProductCategoryMapper productCategoryMapper; + + /** + * 查询商品分类 + * + * @param id 商品分类主键 + * @return 商品分类 + */ + public ProductCategory selectById(Long id) { + return productCategoryMapper.selectById(id); + } + + /** + * 查询商品分类列表 + * + * @param query 查询条件 + * @param page 分页条件 + * @return 商品分类 + */ + public List selectList(ProductCategoryQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("del_flag",0); + Long parentId = query.getParentId(); + if (parentId != null) { + qw.eq("parent_id", parentId); + } + String nameLike = query.getNameLike(); + if (!StringUtils.isEmpty(nameLike)) { + qw.like("name", nameLike); + } + Integer level = query.getLevel(); + if (level != null) { + qw.eq("level", level); + } + Integer showStatus = query.getShowStatus(); + if (showStatus != null) { + qw.eq("show_status", showStatus); + } + Integer sort = query.getSort(); + if (sort != null) { + qw.eq("sort", sort); + } + String icon = query.getIcon(); + if (!StringUtils.isEmpty(icon)) { + qw.eq("icon", icon); + } + return productCategoryMapper.selectList(qw); + } + + /** + * 新增商品分类 + * + * @param productCategory 商品分类 + * @return 结果 + */ + public int insert(ProductCategory productCategory) { + productCategory.setDelFlag(0); + productCategory.setCreateTime(LocalDateTime.now()); + return productCategoryMapper.insert(productCategory); + } + + /** + * 修改商品分类 + * + * @param productCategory 商品分类 + * @return 结果 + */ + public int update(ProductCategory productCategory) { + return productCategoryMapper.updateById(productCategory); + } + + /** + * 批量删除商品分类 + * + * @param ids 需要删除的商品分类主键 + * @return 结果 + */ + public int deleteByIds(Long[] ids) { + return productCategoryMapper.updateDelFlagByIds(ids); + } + + /** + * 删除商品分类信息 + * + * @param id 商品分类主键 + * @return 结果 + */ + public int deleteById(Long id) { + Long[] ids = {id}; + return productCategoryMapper.updateDelFlagByIds(ids); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductService.java b/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductService.java new file mode 100644 index 0000000..5ba193b --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/service/ProductService.java @@ -0,0 +1,156 @@ +package com.cyl.pms.service; + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.List; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import com.cyl.pms.mapper.ProductMapper; +import com.cyl.pms.domain.Product; +import com.cyl.pms.pojo.query.ProductQuery; + +/** + * 商品信息Service业务层处理 + * + * + * @author zcc + */ +@Service +public class ProductService { + @Autowired + private ProductMapper productMapper; + + /** + * 查询商品信息 + * + * @param id 商品信息主键 + * @return 商品信息 + */ + public Product selectById(Long id) { + return productMapper.selectById(id); + } + + /** + * 查询商品信息列表 + * + * @param query 查询条件 + * @param page 分页条件 + * @return 商品信息 + */ + public List selectList(ProductQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("del_flag",0); + Long brandId = query.getBrandId(); + if (brandId != null) { + qw.eq("brand_id", brandId); + } + Long categoryId = query.getCategoryId(); + if (categoryId != null) { + qw.eq("category_id", categoryId); + } + String outProductId = query.getOutProductId(); + if (!StringUtils.isEmpty(outProductId)) { + qw.eq("out_product_id", outProductId); + } + String nameLike = query.getNameLike(); + if (!StringUtils.isEmpty(nameLike)) { + qw.like("name", nameLike); + } + String pic = query.getPic(); + if (!StringUtils.isEmpty(pic)) { + qw.eq("pic", pic); + } + String albumPics = query.getAlbumPics(); + if (!StringUtils.isEmpty(albumPics)) { + qw.eq("album_pics", albumPics); + } + Integer publishStatus = query.getPublishStatus(); + if (publishStatus != null) { + qw.eq("publish_status", publishStatus); + } + Integer sort = query.getSort(); + if (sort != null) { + qw.eq("sort", sort); + } + BigDecimal price = query.getPrice(); + if (price != null) { + qw.eq("price", price); + } + String unit = query.getUnit(); + if (!StringUtils.isEmpty(unit)) { + qw.eq("unit", unit); + } + BigDecimal weight = query.getWeight(); + if (weight != null) { + qw.eq("weight", weight); + } + String detailHtml = query.getDetailHtml(); + if (!StringUtils.isEmpty(detailHtml)) { + qw.eq("detail_html", detailHtml); + } + String detailMobileHtml = query.getDetailMobileHtml(); + if (!StringUtils.isEmpty(detailMobileHtml)) { + qw.eq("detail_mobile_html", detailMobileHtml); + } + String brandNameLike = query.getBrandNameLike(); + if (!StringUtils.isEmpty(brandNameLike)) { + qw.like("brand_name", brandNameLike); + } + String productCategoryNameLike = query.getProductCategoryNameLike(); + if (!StringUtils.isEmpty(productCategoryNameLike)) { + qw.like("product_category_name", productCategoryNameLike); + } + return productMapper.selectList(qw); + } + + /** + * 新增商品信息 + * + * @param product 商品信息 + * @return 结果 + */ + public int insert(Product product) { + product.setDelFlag(0); + product.setCreateTime(LocalDateTime.now()); + return productMapper.insert(product); + } + + /** + * 修改商品信息 + * + * @param product 商品信息 + * @return 结果 + */ + public int update(Product product) { + return productMapper.updateById(product); + } + + /** + * 批量删除商品信息 + * + * @param ids 需要删除的商品信息主键 + * @return 结果 + */ + public int deleteByIds(Long[] ids) { + return productMapper.updateDelFlagByIds(ids); + } + + /** + * 删除商品信息信息 + * + * @param id 商品信息主键 + * @return 结果 + */ + public int deleteById(Long id) { + Long[] ids = {id}; + return productMapper.updateDelFlagByIds(ids); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/pms/service/SkuService.java b/ruoyi-mall/src/main/java/com/cyl/pms/service/SkuService.java new file mode 100644 index 0000000..3072b3e --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/pms/service/SkuService.java @@ -0,0 +1,116 @@ +package com.cyl.pms.service; + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.List; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import com.cyl.pms.mapper.SkuMapper; +import com.cyl.pms.domain.Sku; +import com.cyl.pms.pojo.query.SkuQuery; + +/** + * sku信息Service业务层处理 + * + * + * @author zcc + */ +@Service +public class SkuService { + @Autowired + private SkuMapper skuMapper; + + /** + * 查询sku信息 + * + * @param id sku信息主键 + * @return sku信息 + */ + public Sku selectById(Long id) { + return skuMapper.selectById(id); + } + + /** + * 查询sku信息列表 + * + * @param query 查询条件 + * @param page 分页条件 + * @return sku信息 + */ + public List selectList(SkuQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("del_flag",0); + Long productId = query.getProductId(); + if (productId != null) { + qw.eq("product_id", productId); + } + String outSkuId = query.getOutSkuId(); + if (!StringUtils.isEmpty(outSkuId)) { + qw.eq("out_sku_id", outSkuId); + } + BigDecimal price = query.getPrice(); + if (price != null) { + qw.eq("price", price); + } + String pic = query.getPic(); + if (!StringUtils.isEmpty(pic)) { + qw.eq("pic", pic); + } + String spData = query.getSpData(); + if (!StringUtils.isEmpty(spData)) { + qw.eq("sp_data", spData); + } + return skuMapper.selectList(qw); + } + + /** + * 新增sku信息 + * + * @param sku sku信息 + * @return 结果 + */ + public int insert(Sku sku) { + sku.setDelFlag(0); + sku.setCreateTime(LocalDateTime.now()); + return skuMapper.insert(sku); + } + + /** + * 修改sku信息 + * + * @param sku sku信息 + * @return 结果 + */ + public int update(Sku sku) { + return skuMapper.updateById(sku); + } + + /** + * 批量删除sku信息 + * + * @param ids 需要删除的sku信息主键 + * @return 结果 + */ + public int deleteByIds(Long[] ids) { + return skuMapper.updateDelFlagByIds(ids); + } + + /** + * 删除sku信息信息 + * + * @param id sku信息主键 + * @return 结果 + */ + public int deleteById(Long id) { + Long[] ids = {id}; + return skuMapper.updateDelFlagByIds(ids); + } +} diff --git a/ruoyi-mall/src/main/resources/mapper/pms/BrandMapper.xml b/ruoyi-mall/src/main/resources/mapper/pms/BrandMapper.xml new file mode 100644 index 0000000..5948c0d --- /dev/null +++ b/ruoyi-mall/src/main/resources/mapper/pms/BrandMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + select id, name, sort, show_status, logo, del_flag, create_by, create_time, update_by, update_time from pms_brand + + + + + + update pms_brand set del_flag=1 + + id in #{it} + + + diff --git a/ruoyi-mall/src/main/resources/mapper/pms/ProductCategoryMapper.xml b/ruoyi-mall/src/main/resources/mapper/pms/ProductCategoryMapper.xml new file mode 100644 index 0000000..3402f8d --- /dev/null +++ b/ruoyi-mall/src/main/resources/mapper/pms/ProductCategoryMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select id, parent_id, name, level, show_status, sort, icon, del_flag, create_by, create_time, update_by, update_time from pms_product_category + + + + + + update pms_product_category set del_flag=1 + + id in #{it} + + + diff --git a/ruoyi-mall/src/main/resources/mapper/pms/ProductMapper.xml b/ruoyi-mall/src/main/resources/mapper/pms/ProductMapper.xml new file mode 100644 index 0000000..6ee7251 --- /dev/null +++ b/ruoyi-mall/src/main/resources/mapper/pms/ProductMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, brand_id, category_id, out_product_id, name, pic, album_pics, publish_status, sort, price, unit, weight, detail_html, detail_mobile_html, brand_name, product_category_name, del_flag, create_by, create_time, update_by, update_time from pms_product + + + + + + update pms_product set del_flag=1 + + id in #{it} + + + diff --git a/ruoyi-mall/src/main/resources/mapper/pms/SkuMapper.xml b/ruoyi-mall/src/main/resources/mapper/pms/SkuMapper.xml new file mode 100644 index 0000000..a81c612 --- /dev/null +++ b/ruoyi-mall/src/main/resources/mapper/pms/SkuMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, product_id, out_sku_id, price, pic, sp_data, del_flag, create_by, create_time, update_by, update_time from pms_sku + + + + + + update pms_sku set del_flag=1 + + id in #{it} + + + diff --git a/sql/pms/brand.sql b/sql/pms/brand.sql new file mode 100644 index 0000000..ac580c9 --- /dev/null +++ b/sql/pms/brand.sql @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理', '3', '1', 'brand', 'pms/brand/index', 1, 0, 'C', '0', '0', 'pms:brand:list', '#', 1, sysdate(), '', null, '品牌管理菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:brand:query', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:brand:add', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:brand:edit', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:brand:remove', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('品牌管理导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:brand:export', '#', 1, sysdate(), '', null, ''); diff --git a/sql/pms/product.sql b/sql/pms/product.sql new file mode 100644 index 0000000..5e86304 --- /dev/null +++ b/sql/pms/product.sql @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息', '3', '1', 'product', 'pms/product/index', 1, 0, 'C', '0', '0', 'pms:product:list', '#', 1, sysdate(), '', null, '商品信息菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:product:query', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:product:add', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:product:edit', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:product:remove', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品信息导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:product:export', '#', 1, sysdate(), '', null, ''); diff --git a/sql/pms/productCategory.sql b/sql/pms/productCategory.sql new file mode 100644 index 0000000..2a14b59 --- /dev/null +++ b/sql/pms/productCategory.sql @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类', '3', '1', 'productCategory', 'pms/productCategory/index', 1, 0, 'C', '0', '0', 'pms:productCategory:list', '#', 1, sysdate(), '', null, '商品分类菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:productCategory:query', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:productCategory:add', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:productCategory:edit', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:productCategory:remove', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('商品分类导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:productCategory:export', '#', 1, sysdate(), '', null, ''); diff --git a/sql/pms/sku.sql b/sql/pms/sku.sql new file mode 100644 index 0000000..32b7c08 --- /dev/null +++ b/sql/pms/sku.sql @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息', '3', '1', 'sku', 'pms/sku/index', 1, 0, 'C', '0', '0', 'pms:sku:list', '#', 1, sysdate(), '', null, 'sku信息菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:sku:query', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:sku:add', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:sku:edit', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:sku:remove', '#', 1, sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('sku信息导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:sku:export', '#', 1, sysdate(), '', null, '');