|
|
@@ -0,0 +1,67 @@
|
|
|
+package shop.alien.store.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import shop.alien.entity.result.R;
|
|
|
+import shop.alien.entity.store.dto.StoreBannerDto;
|
|
|
+import shop.alien.entity.store.vo.StoreBannerVo;
|
|
|
+import shop.alien.store.service.StoreBannerService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Banner表 前端控制器
|
|
|
+ *
|
|
|
+ * @author gpt
|
|
|
+ * @since 2025-12-16
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Api(tags = {"二期-Banner管理"})
|
|
|
+@ApiSort(20)
|
|
|
+@CrossOrigin
|
|
|
+@RestController
|
|
|
+@RequestMapping("/banner")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class StoreBannerController {
|
|
|
+
|
|
|
+ private final StoreBannerService storeBannerService;
|
|
|
+
|
|
|
+ @ApiOperation("新增或修改Banner")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @PostMapping("/saveOrUpdate")
|
|
|
+ public R<String> saveOrUpdate(@RequestBody StoreBannerDto storeBannerDto) {
|
|
|
+ log.info("StoreBannerController.saveOrUpdate?storeBannerDto={}", storeBannerDto);
|
|
|
+ return storeBannerService.saveBanner(storeBannerDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除Banner")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @PostMapping("/delete")
|
|
|
+ public R<String> delete(@RequestBody List<Integer> ids) {
|
|
|
+ log.info("StoreBannerController.delete?ids={}", ids);
|
|
|
+ return storeBannerService.removeByIds(ids) ? R.success("删除成功") : R.fail("删除失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("分页查询Banner列表")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "moduleCode", value = "模块编码", dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "moduleName", value = "模块名称", dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "status", value = "状态:1 启用,0 禁用", dataType = "String", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", paramType = "query", defaultValue = "1"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", defaultValue = "10")
|
|
|
+ })
|
|
|
+ @GetMapping("/page")
|
|
|
+ public R<IPage<StoreBannerVo>> page(String moduleCode,
|
|
|
+ String moduleName,
|
|
|
+ String status,
|
|
|
+ @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
+ log.info("StoreBannerController.page?moduleCode={}&moduleName={}&status={}&pageNum={}&pageSize={}", moduleCode, moduleName, status, pageNum, pageSize);
|
|
|
+ return R.data(storeBannerService.pageList(moduleCode, moduleName, status, pageNum, pageSize));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|