1.提交【管理后台】商品分类管理、商品香型管理、商品系列管理接口
2.提交 文件微服务华为云OBS文件上传接口
| | |
| | | package com.ruoyi.file.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.file.FileUtils; |
| | | import com.ruoyi.file.service.ISysFileService; |
| | | import com.ruoyi.file.utils.HuaWeiOBSUtil; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.file.FileUtils; |
| | | import com.ruoyi.file.service.ISysFileService; |
| | | import com.ruoyi.system.api.domain.SysFile; |
| | | |
| | | /** |
| | | * 文件请求处理 |
| | |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 文件上传请求 |
| | | */ |
| | | @ApiOperation(value = "obs文件上传", notes = "obs文件上传") |
| | | @PostMapping("/obs/upload") |
| | | public R<String> obsUpload(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | // 上传并返回访问地址 |
| | | String url = HuaWeiOBSUtil.obsUpload(file); |
| | | return R.ok(url); |
| | | } catch (Exception e) { |
| | | log.error("上传文件失败", e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 文件上传请求 |
| | | */ |
| | | @ApiOperation(value = "obs文件批量上传", notes = "obs文件批量上传") |
| | | @PostMapping("/obs/upload-batch") |
| | | public R<List<String>> obsUploadBatch(@RequestPart("file") MultipartFile[] file) { |
| | | List<String> urls = new ArrayList<>(); |
| | | try { |
| | | for (MultipartFile multipartFile : file) { |
| | | String url = HuaWeiOBSUtil.obsUpload(multipartFile); |
| | | urls.add(url); |
| | | } |
| | | // 上传并返回访问地址 |
| | | return R.ok(urls); |
| | | } catch (Exception e) { |
| | | log.error("上传文件失败", e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.file.utils; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | public class HuaWeiOBSUtil { |
| | | |
| | | //TODO 修改配置文件 |
| | | //OBS图片访问域名 |
| | | public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com"; |
| | | public static String accessKeyId = "IZB26ZHC7C5MWIOH1TGE"; |
| | | public static String accessKeySecret = "y5PXhFMDOHiPH0nnQMz4gkvA63oqKAC621zXzOPk"; |
| | | public static String bucketName = "mimishejiao"; |
| | | public static String oss_domain = "https://mimishejiao.obs.cn-southwest-2.myhuaweicloud.com/"; |
| | | |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(MultipartFile file) |
| | | throws IOException { |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if (file != null && !"".equals(file.getOriginalFilename()) |
| | | && file.getOriginalFilename() != null) { |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | fileName = |
| | | UUID.randomUUID().toString().replaceAll("-", "") + originalFilename.subSequence( |
| | | originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | obsClient.putObject(bucketName, fileName, content, meta);// 上传Object. |
| | | if (fileName != null && !"".equals(fileName)) { |
| | | System.out.println(fileName); |
| | | fileName = oss_domain + fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl = bucketUrl.replace(oss_domain, ""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | // obsClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | // } |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = -286811516688205647L; |
| | | |
| | | @ApiModelProperty(value = "商品品牌标题id", notes = "更新必传,新增不传") |
| | | @ApiModelProperty(value = "商品品牌id", notes = "更新必传,新增不传") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "品牌名称") |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/21 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "商品分类数据传输对象", description = "商品分类数据传输对象") |
| | | public class GoodsCategoryDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -340456108914762488L; |
| | | |
| | | @ApiModelProperty(value = "商品分类id", notes = "更新必传,新增不传") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | @NotBlank(message = "分类名称不能为空") |
| | | private String categoryName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "商品分类查询对象", description = "商品分类查询对象") |
| | | public class GoodsCategoryQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = 2265520959737199709L; |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | private String categoryName; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/20 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "商品香型传输对象", description = "商品香型数据传输对象") |
| | | public class GoodsFlavorTypeDTO implements Serializable { |
| | | |
| | | |
| | | private static final long serialVersionUID = -286811516688205647L; |
| | | |
| | | @ApiModelProperty(value = "商品香型id", notes = "更新必传,新增不传") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "香型名称") |
| | | @NotBlank(message = "香型名称不能为空") |
| | | private String flavorTypeName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/20 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "商品香型查询对象", description = "商品香型查询对象") |
| | | public class GoodsFlavorTypeQuery extends BasePage { |
| | | |
| | | |
| | | private static final long serialVersionUID = -196269784492900797L; |
| | | |
| | | @ApiModelProperty(value = "香型名称") |
| | | private String flavorTypeName; |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import javax.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/20 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "商品系列数据传输对象", description = "商品系列数据传输对象") |
| | | public class GoodsSeriesDTO implements Serializable { |
| | | |
| | | |
| | | private static final long serialVersionUID = -286811516688205647L; |
| | | |
| | | @ApiModelProperty(value = "商品系列id", notes = "更新必传,新增不传") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "系列名称") |
| | | @NotBlank(message = "系列名称不能为空") |
| | | private String seriesName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.goods.controller.mamagement.DTO; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/5/21 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "商品系列查询对象", description = "商品系列查询对象") |
| | | public class GoodsSeriesQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = 2265520959737199709L; |
| | | |
| | | @ApiModelProperty(value = "系列名称") |
| | | private String seriesName; |
| | | } |
| | |
| | | package com.ruoyi.goods.controller.mamagement; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsCategoryVO; |
| | | import com.ruoyi.goods.service.IGoodsCategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | * @since 2024-05-16 |
| | | */ |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | @Api(value = "管理后台商品分类相关接口", tags = {"管理后台接口"}) |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/mgt/goods-category") |
| | | @Api(value = "管理后台商品分类相关接口", tags = {"管理后台接口"}) |
| | | public class MgtGoodsCategoryController { |
| | | |
| | | private final IGoodsCategoryService goodsCategoryService; |
| | | |
| | | /** |
| | | * 获取商品分类列表的分页数据 |
| | | * |
| | | * @param query 商品分类查询条件,通过RequestBody接收前端传来的查询参数。 |
| | | * @return 返回一个包含商品分类分页数据的结果对象,其中数据部分为PageDTO<GoodsCategoryVO>类型。 |
| | | */ |
| | | @ApiOperation(value = " 获取商品分类列表的分页数据", notes = " 获取商品分类列表的分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<GoodsCategoryVO>> getGoodsCategoryPage( |
| | | @Validated @RequestBody GoodsCategoryQuery query) { |
| | | return R.ok(goodsCategoryService.getGoodsCategoryPage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 新增/编辑商品分类。 该接口用于接收前端发送的商品分类数据,通过商品分类数据传输对象(GoodsCategoryDTO)来新增或编辑商品分类信息。 |
| | | * |
| | | * @param dto 商品分类数据传输对象,包含商品分类的详细信息,通过RequestBody接收。 使用@Validated注解进行参数验证,确保数据的完整性和正确性。 |
| | | * @return 返回操作结果,使用R<Void>作为返回类型,其中R是自定义的结果封装类,Void表示操作不返回具体数据。 如果操作成功,返回R.ok(),表示操作成功。 |
| | | */ |
| | | @ApiOperation(value = "新增/编辑 商品分类", notes = "新增/编辑 商品分类") |
| | | @PostMapping("/save") |
| | | public R<Void> saveGoodsCategory(@Validated @RequestBody GoodsCategoryDTO dto) { |
| | | goodsCategoryService.saveGoodsCategory(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除商品分类 |
| | | * |
| | | * @param id 商品分类的唯一标识符 |
| | | * @return 返回操作结果,如果操作成功,则返回一个成功的标识 |
| | | */ |
| | | @ApiOperation(value = "删除商品分类", notes = "删除商品分类") |
| | | @DeleteMapping("/{id}") |
| | | public R<Void> deleteGoodsCategory(@Validated @PathVariable("id") Long id) { |
| | | goodsCategoryService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.goods.controller.mamagement; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsFlavorTypeVO; |
| | | import com.ruoyi.goods.service.IGoodsFlavorTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @Api(value = "管理后台商品香型相关接口", tags = {"管理后台接口"}) |
| | | public class MgtGoodsFlavorTypeController { |
| | | |
| | | private final IGoodsFlavorTypeService goodsFlavorTypeService; |
| | | |
| | | /** |
| | | * 获取商品香型列表的分页数据 |
| | | * |
| | | * @param query 商品香型查询条件,通过验证的请求体参数 |
| | | * @return 返回商品香型列表的分页数据,封装在R对象中,其中PageDTO包含分页信息和香型数据列表 |
| | | */ |
| | | @ApiOperation(value = "获取商品香型列表的分页数据", notes = "获取商品香型列表的分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<GoodsFlavorTypeVO>> getGoodsFlavorTypePage( |
| | | @Validated @RequestBody GoodsFlavorTypeQuery query) { |
| | | return R.ok(goodsFlavorTypeService.getGoodsFlavorTypePage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加/编辑 商品香型 |
| | | * |
| | | * @param dto 商品香型数据传输对象,通过验证的请求体参数 |
| | | * @return 返回添加/编辑操作的结果,封装在R对象中 |
| | | */ |
| | | @ApiOperation(value = "添加/编辑 商品香型", notes = "添加/编辑 商品香型") |
| | | @PostMapping("/save") |
| | | public R<Void> saveGoodsFlavorType(@Validated @RequestBody GoodsFlavorTypeDTO dto) { |
| | | goodsFlavorTypeService.saveGoodsFlavorType(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除商品香型 |
| | | * |
| | | * @param id 商品香型的ID,用于指定要删除的具体商品香型 |
| | | * @return 返回操作结果,如果删除成功,则返回一个成功的响应码 |
| | | */ |
| | | @ApiOperation(value = "删除商品香型", notes = "删除商品香型") |
| | | @DeleteMapping("/{id}") |
| | | public R<Void> deleteGoodsFlavorType(@PathVariable("id") Long id) { |
| | | goodsFlavorTypeService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.goods.controller.mamagement; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsSeriesVO; |
| | | import com.ruoyi.goods.service.IGoodsSeriesService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/mgt/goods-series") |
| | | @Api(value = "管理后台商品秒杀相关接口", tags = {"管理后台接口"}) |
| | | @Api(value = "管理后台商品系列相关接口", tags = {"管理后台接口"}) |
| | | public class MgtGoodsSeriesController { |
| | | |
| | | private final IGoodsSeriesService goodsSeriesService; |
| | | |
| | | /** |
| | | * 获取商品系列列表的分页数据 |
| | | * |
| | | * @param query 商品系列查询条件,用于筛选和排序等操作 |
| | | * @return 返回商品系列的分页数据,包含分页信息和商品系列列表 |
| | | */ |
| | | @ApiOperation(value = "获取商品系列列表的分页数据", notes = "获取商品系列列表的分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<GoodsSeriesVO>> getGoodsSeriesPage( |
| | | @Validated @RequestBody GoodsSeriesQuery query) { |
| | | return R.ok(goodsSeriesService.getGoodsSeriesPage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 新增/编辑商品系列。 该接口用于通过接收商品系列数据对象(GoodsSeriesDTO),来新增或编辑商品系列信息。 |
| | | * |
| | | * @param dto 商品系列数据传输对象,包含商品系列的详细信息,通过RequestBody接收。 需要进行合法性验证(@Validated)以确保数据的完整性和正确性。 |
| | | * @return R<Void> 返回一个结果对象,表示操作是否成功。如果操作成功,返回状态码200。 |
| | | */ |
| | | @ApiOperation(value = "新增/编辑 商品系列", notes = "新增/编辑 商品系列") |
| | | @PostMapping("/save") |
| | | public R<Void> saveGoodsSeries(@Validated @RequestBody GoodsSeriesDTO dto) { |
| | | goodsSeriesService.saveGoodsSeries(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除商品香型 |
| | | * |
| | | * @param id 商品香型的ID,用于指定要删除的具体商品香型 |
| | | * @return 返回操作结果,如果删除成功,则返回一个成功响应码 |
| | | */ |
| | | @ApiOperation(value = "删除商品香型", notes = "删除商品香型") |
| | | @DeleteMapping("/{id}") |
| | | public R<Void> deleteGoodsSeries(@PathVariable("id") Long id) { |
| | | goodsSeriesService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | * |
| | | * @return R<List < GoodsFlavorTypeVO>> 包含商品香型列表的响应对象。 |
| | | */ |
| | | @ApiOperation(value = "获取商品香型列表", notes = "获取商品香型列表") |
| | | @GetMapping("/flavor/list") |
| | | public R<List<GoodsFlavorTypeVO>> getGoodsFlavorTypeList() { |
| | | return R.ok(goodsFlavorTypeService.getGoodsFlavorTypeList()); |
| | |
| | | * @param dto 包含需要更新状态的商品信息的数据传输对象,类型为 ListStatusDTO。 |
| | | * @return 返回一个表示操作结果的 R<Void> 对象,如果操作成功,则 R<Void>.ok() 方法返回一个成功标记。 |
| | | */ |
| | | @ApiOperation(value = "下架/上架 商品") |
| | | @ApiOperation(value = "下架/上架 商品", notes = "下架/上架 商品") |
| | | @PutMapping("/upd-status") |
| | | public R<Void> updStatus(@RequestBody ListStatusDTO dto) { |
| | | goodsSkuService.updStatus(dto); |
| | |
| | | package com.ruoyi.goods.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsCategoryVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsCategory; |
| | | import java.util.List; |
| | |
| | | */ |
| | | public interface IGoodsCategoryService extends IService<GoodsCategory> { |
| | | |
| | | /** |
| | | * 获取商品类别列表。 |
| | | * <p>此方法不接受任何参数,它会调用 {@code list()} 方法获取当前类别列表的副本,并将其转换为 {@code GoodsCategoryVO} 类型的列表后返回。</p> |
| | | * |
| | | * @return 返回一个 {@code List<GoodsCategoryVO>},包含当前商品类别的所有信息的副本。 |
| | | */ |
| | | List<GoodsCategoryVO> getGoodsCategoryList(); |
| | | |
| | | /** |
| | | * 获取商品类别的分页信息 |
| | | * |
| | | * @param query 查询条件,包含页码、页大小和分类名称 |
| | | * @return 分页后的商品类别数据,包装在PageDTO中 |
| | | */ |
| | | PageDTO<GoodsCategoryVO> getGoodsCategoryPage(GoodsCategoryQuery query); |
| | | |
| | | /** |
| | | * 保存或更新商品类别信息。 |
| | | * |
| | | * @param dto 商品类别数据传输对象,包含商品类别的信息。 如果dto中的id为空,则认为是新纪录,执行保存操作; 如果id不为空,则认为是更新现有纪录。 |
| | | */ |
| | | void saveGoodsCategory(GoodsCategoryDTO dto); |
| | | } |
| | |
| | | package com.ruoyi.goods.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsFlavorTypeVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsFlavorType; |
| | | import java.util.List; |
| | |
| | | */ |
| | | public interface IGoodsFlavorTypeService extends IService<GoodsFlavorType> { |
| | | |
| | | /** |
| | | * 获取商品口味类型的列表。 |
| | | * <p>此方法通过调用 {@code list()} 方法获取原始列表,并使用 {@code BeanUtils.copyList} 方法将每个元素转换为 |
| | | * {@code GoodsFlavorTypeVO} 类型,最终返回转换后的列表。</p> |
| | | * |
| | | * @return 返回一个 {@code List<GoodsFlavorTypeVO>},包含转换后的商品口味类型信息。 |
| | | */ |
| | | List<GoodsFlavorTypeVO> getGoodsFlavorTypeList(); |
| | | |
| | | /** |
| | | * 获取商品口味类型分页数据 |
| | | * |
| | | * @param query 查询条件,包含页码、页大小和口味类型名称等 |
| | | * @return 返回口味类型分页数据传输对象(PageDTO),其中包含了分页信息和转换后的口味类型视图对象(GoodsFlavorTypeVO)列表 |
| | | */ |
| | | PageDTO<GoodsFlavorTypeVO> getGoodsFlavorTypePage(GoodsFlavorTypeQuery query); |
| | | |
| | | /** |
| | | * 保存或更新商品口味类型信息。 |
| | | * |
| | | * @param dto 商品口味类型数据传输对象,包含要保存或更新的信息。 如果dto中的id为空,则认为是新纪录,执行保存操作; 如果id不为空,则认为是更新现有纪录。 |
| | | */ |
| | | void saveGoodsFlavorType(GoodsFlavorTypeDTO dto); |
| | | } |
| | |
| | | package com.ruoyi.goods.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsSeriesVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsSeries; |
| | | import java.util.List; |
| | |
| | | */ |
| | | public interface IGoodsSeriesService extends IService<GoodsSeries> { |
| | | |
| | | /** |
| | | * 获取商品系列列表的视图对象。 |
| | | * |
| | | * <p>此方法不接受任何参数,它会调用 {@code list()} 方法获取原始列表, |
| | | * 然后使用 {@code BeanUtils.copyList} 将这些实体转换为视图对象。</p> |
| | | * |
| | | * @return 返回一个 {@link List} 类型的商品系列视图对象列表。每个视图对象代表一个商品系列的简要信息。 |
| | | */ |
| | | List<GoodsSeriesVO> getGoodsSeriesList(); |
| | | |
| | | /** |
| | | * 获取商品系列的分页信息 |
| | | * |
| | | * @param query 包含分页参数和查询条件的查询对象 |
| | | * @return 返回商品系列的分页数据传输对象(DTO),包含分页信息和商品系列列表 |
| | | */ |
| | | PageDTO<GoodsSeriesVO> getGoodsSeriesPage(GoodsSeriesQuery query); |
| | | |
| | | /** |
| | | * 保存或更新商品系列信息。 |
| | | * |
| | | * @param dto 商品系列数据传输对象,包含商品系列的详细信息。 如果商品系列ID为空,则视为新记录,进行保存; 如果商品系列ID不为空,则视为更新记录,进行更新。 |
| | | */ |
| | | void saveGoodsSeries(GoodsSeriesDTO dto); |
| | | } |
| | |
| | | .like(StringUtils.isNotEmpty(query.getBrandName()), GoodsBrand::getBrandName, |
| | | query.getBrandName()) |
| | | .page(new Page<GoodsBrand>(query.getPageCurr(), query.getPageSize())); |
| | | |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | | } |
| | | // 将查询结果转换为VO类的分页DTO |
| | | return PageDTO.of(page, GoodsBrandVO.class); |
| | | } |
| | |
| | | package com.ruoyi.goods.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsCategoryQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsCategoryVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsCategory; |
| | | import com.ruoyi.goods.mapper.GoodsCategoryMapper; |
| | |
| | | public class GoodsCategoryServiceImpl extends ServiceImpl<GoodsCategoryMapper, GoodsCategory> implements IGoodsCategoryService { |
| | | |
| | | /** |
| | | * 获取商品类别列表的副本。 |
| | | * <p>此方法不接受任何参数,它会调用 {@code list()} 方法获取当前类别列表的副本,并将其转换为 {@code GoodsCategoryVO} 类型的列表后返回。</p> |
| | | * 获取商品类别列表。 |
| | | * <p>此方法不接受任何参数,它会调用 {@code list()} 方法获取当前类别列表,并将其转换为 {@code GoodsCategoryVO} 类型的列表后返回。</p> |
| | | * |
| | | * @return 返回一个 {@code List<GoodsCategoryVO>},包含当前商品类别的所有信息的副本。 |
| | | * @return 返回一个 {@code List<GoodsCategoryVO>},包含当前商品类别的所有信息。 |
| | | */ |
| | | @Override |
| | | public List<GoodsCategoryVO> getGoodsCategoryList() { |
| | |
| | | return BeanUtils.copyList(this.list(), GoodsCategoryVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取商品类别的分页信息 |
| | | * |
| | | * @param query 查询条件,包含页码、页大小和分类名称 |
| | | * @return 分页后的商品类别数据,包装在PageDTO中 |
| | | */ |
| | | @Override |
| | | public PageDTO<GoodsCategoryVO> getGoodsCategoryPage(GoodsCategoryQuery query) { |
| | | Page<GoodsCategory> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getCategoryName()), |
| | | GoodsCategory::getCategoryName, query.getCategoryName()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | | } |
| | | return PageDTO.of(page, GoodsCategoryVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 保存或更新商品类别信息。 |
| | | * |
| | | * @param dto 商品类别数据传输对象,包含商品类别的信息。 如果dto中的id为空,则认为是新纪录,执行保存操作; 如果id不为空,则认为是更新现有纪录。 |
| | | */ |
| | | @Override |
| | | public void saveGoodsCategory(GoodsCategoryDTO dto) { |
| | | GoodsCategory goodsCategory = BeanUtils.copyBean(dto, GoodsCategory.class); |
| | | if (StringUtils.isNull(dto.getId())) { |
| | | this.save(goodsCategory); |
| | | } else { |
| | | this.updateById(goodsCategory); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.goods.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsFlavorTypeQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsFlavorTypeVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsFlavorType; |
| | | import com.ruoyi.goods.mapper.GoodsFlavorTypeMapper; |
| | |
| | | public List<GoodsFlavorTypeVO> getGoodsFlavorTypeList() { |
| | | return BeanUtils.copyList(this.list(), GoodsFlavorTypeVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取商品口味类型分页数据 |
| | | * |
| | | * @param query 查询条件,包含页码、页大小和口味类型名称等 |
| | | * @return 返回口味类型分页数据传输对象(PageDTO),其中包含了分页信息和转换后的口味类型视图对象(GoodsFlavorTypeVO)列表 |
| | | */ |
| | | @Override |
| | | public PageDTO<GoodsFlavorTypeVO> getGoodsFlavorTypePage(GoodsFlavorTypeQuery query) { |
| | | Page<GoodsFlavorType> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getFlavorTypeName()), |
| | | GoodsFlavorType::getFlavorTypeName, query.getFlavorTypeName()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | | } |
| | | return PageDTO.of(page, GoodsFlavorTypeVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 保存或更新商品口味类型信息。 |
| | | * |
| | | * @param dto 商品口味类型数据传输对象,包含要保存或更新的信息。 如果dto中的id为空,则认为是新纪录,执行保存操作; 如果id不为空,则认为是更新现有纪录。 |
| | | */ |
| | | @Override |
| | | public void saveGoodsFlavorType(GoodsFlavorTypeDTO dto) { |
| | | GoodsFlavorType goodsFlavorType = BeanUtils.copyBean(dto, GoodsFlavorType.class); |
| | | if (StringUtils.isNull(dto.getId())) { |
| | | this.save(goodsFlavorType); |
| | | } else { |
| | | this.updateById(goodsFlavorType); |
| | | } |
| | | } |
| | | } |
| | |
| | | .like(StringUtils.isNotEmpty(query.getTitleName()), GoodsInfoTitle::getTitleName, |
| | | query.getTitleName()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | | } |
| | | // 将查询结果转换为VO对象的分页DTO返回 |
| | | return PageDTO.of(page, GoodsInfoTitleVO.class); |
| | | } |
| | |
| | | package com.ruoyi.goods.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesDTO; |
| | | import com.ruoyi.goods.controller.mamagement.DTO.GoodsSeriesQuery; |
| | | import com.ruoyi.goods.controller.mamagement.VO.GoodsSeriesVO; |
| | | import com.ruoyi.goods.domain.pojo.GoodsSeries; |
| | | import com.ruoyi.goods.mapper.GoodsSeriesMapper; |
| | |
| | | return BeanUtils.copyList(this.list(), GoodsSeriesVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取商品系列的分页信息 |
| | | * |
| | | * @param query 包含分页参数和查询条件的查询对象 |
| | | * @return 返回商品系列的分页数据传输对象(DTO),包含分页信息和商品系列列表 |
| | | */ |
| | | @Override |
| | | public PageDTO<GoodsSeriesVO> getGoodsSeriesPage(GoodsSeriesQuery query) { |
| | | Page<GoodsSeries> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotEmpty(query.getSeriesName()), GoodsSeries::getSeriesName, |
| | | query.getSeriesName()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page.getTotal(), page.getPages()); |
| | | } |
| | | return PageDTO.of(page, GoodsSeriesVO.class); |
| | | } |
| | | |
| | | /** |
| | | * 保存或更新商品系列信息。 |
| | | * |
| | | * @param dto 商品系列数据传输对象,包含商品系列的详细信息。 如果商品系列ID为空,则视为新记录,进行保存; 如果商品系列ID不为空,则视为更新记录,进行更新。 |
| | | */ |
| | | @Override |
| | | public void saveGoodsSeries(GoodsSeriesDTO dto) { |
| | | GoodsSeries goodsSeries = BeanUtils.copyBean(dto, GoodsSeries.class); |
| | | if (StringUtils.isNull(goodsSeries.getId())) { |
| | | this.save(goodsSeries); |
| | | } else { |
| | | this.updateById(goodsSeries); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "会员id") |
| | | private Long memberId; |
| | | |
| | | @ApiModelProperty(value = "会员姓名") |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String phoneNumber; |
| | | |
| | | |
| | | @ApiModelProperty(value = "支付方式 1=微信 2=支付宝") |
| | | private PaymentMethodEnum paymentMethod; |
| | | |