From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001 From: lee <4766465@qq.com> Date: Wed, 18 Dec 2024 13:27:00 +0800 Subject: [PATCH] init --- yami-shop-api/src/main/java/com/yami/shop/api/controller/IndexImgController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/controller/IndexImgController.java b/yami-shop-api/src/main/java/com/yami/shop/api/controller/IndexImgController.java new file mode 100644 index 0000000..edbba76 --- /dev/null +++ b/yami-shop-api/src/main/java/com/yami/shop/api/controller/IndexImgController.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ +package com.yami.shop.api.controller; + +import com.yami.shop.bean.app.dto.IndexImgDto; +import com.yami.shop.bean.model.IndexImg; +import com.yami.shop.common.response.ServerResponseEntity; +import com.yami.shop.service.IndexImgService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.Operation; +import ma.glasnost.orika.MapperFacade; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author LGH + */ +@RestController +@Tag(name = "首页轮播图接口") +public class IndexImgController { + + @Autowired + private MapperFacade mapperFacade; + + @Autowired + private IndexImgService indexImgService; + + @GetMapping("/indexImgs/{shopId}") + @Operation(summary = "首页轮播图" , description = "获取首页轮播图列表信息") + @Parameters({ + @Parameter(name = "shopId", description = "店铺id" , required = true), + @Parameter(name = "imgType", description = "图片类型" ) + }) + public ServerResponseEntity<List<IndexImgDto>> indexImgs(@PathVariable("shopId") Long shopId, + @RequestParam(required = false, defaultValue = "0") Integer imgType) { + List<IndexImg> indexImgList = indexImgService.listIndexImgsByShopId(shopId, imgType); + List<IndexImgDto> indexImgDtos = mapperFacade.mapAsList(indexImgList, IndexImgDto.class); + return ServerResponseEntity.success(indexImgDtos); + } +} -- Gitblit v1.9.3