From 347909bae241fff128b628ea6d12992d7e5b4b10 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Fri, 30 May 2025 18:35:43 +0800 Subject: [PATCH] 响应信息主体 --- oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreController.java | 68 ++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreController.java b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreController.java new file mode 100644 index 0000000..a53cf9c --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreController.java @@ -0,0 +1,68 @@ +package com.oying.modules.pc.store.rest; + +import com.oying.utils.R; +import com.oying.modules.pc.common.id.StoreIdGenerator; +import com.oying.modules.pc.store.domain.Store; +import com.oying.modules.pc.store.domain.dto.*; +import com.oying.modules.pc.store.service.StoreService; +import com.oying.utils.SecurityUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.time.ZonedDateTime; + +/** + * 店铺 + * + * @author lzp + * @date 2025-04-22 + */ +@RestController +@RequestMapping("/api/pc/store") +@RequiredArgsConstructor +public class StoreController { + + private final StoreService storeService; + + @GetMapping(value = "/page") + public R<?> getStoresByPage(@RequestBody StoreQueryCriteria criteria) { + return R.success(storeService.queryByPage(criteria)); + } + + @GetMapping(value = "/list") + public R<?> getStores(@RequestBody StoreQueryCriteria criteria) { + return R.success(storeService.queryAll(criteria)); + } + + @GetMapping(value = "/{storeId}") + public R<?> getStoreById(@PathVariable("storeId") Long storeId) { + return R.success(storeService.getById(storeId)); + } + + @GetMapping(value = "/{storeId}/details") + public R<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) { + return R.success(storeService.getById(storeId)); + } + + @PostMapping(value = "/createEmpty") + public R<?> createEmpty(@RequestBody StoreCreateRequest request) { + Store store = new Store(); + store.setStoreId(StoreIdGenerator.getId()); + store.setMerchantId(SecurityUtils.getCurrentUserId()); + store.setCreateBy(SecurityUtils.getCurrentUserId()); + store.setCreateTime(ZonedDateTime.now()); + storeService.save(store); + return R.success(); + } + + /** + * 修改店铺信息 + */ + @PostMapping(value = "/{storeId}") + public R<?> update(@PathVariable("storeId") Long storeId, @RequestBody Store store) { + store.setStoreId(storeId); + storeService.updateById(store); + return R.success(); + } + +} -- Gitblit v1.9.3