no message

This commit is contained in:
cb 2025-06-16 16:43:07 +08:00
parent dfcf26d976
commit 7a2a155938
5 changed files with 27 additions and 22 deletions

View File

@ -143,6 +143,10 @@
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ghy</groupId>
<artifactId>ghy-shop</artifactId>
</dependency>
</dependencies>

View File

@ -1,9 +1,11 @@
package com.ghy.web.controller;
import com.ghy.common.core.controller.BaseController;
import com.ghy.shop.domain.Shop;
import com.ghy.shop.service.ShopService;
import com.ghy.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -12,38 +14,34 @@ import java.util.List;
*/
@RestController
@RequestMapping("/shop")
public class ShopController {
public class ShopController extends BaseController {
@Autowired
private ShopService shopService;
@PostMapping("/add")
public ResponseEntity<Shop> addShop(@RequestBody Shop shop) {
Shop result = shopService.addShop(shop);
return ResponseEntity.ok(result);
public AjaxResult addShop(@RequestBody Shop shop) {
return toAjax(shopService.addShop(shop));
}
@GetMapping("/list")
public ResponseEntity<List<Shop>> listShops() {
return ResponseEntity.ok(shopService.listShops());
public AjaxResult listShops() {
List<Shop> list = shopService.listShops();
return AjaxResult.success(list);
}
@GetMapping("/{id}")
public ResponseEntity<Shop> getShop(@PathVariable Long id) {
public AjaxResult getShop(@PathVariable Long id) {
Shop shop = shopService.getShop(id);
if (shop == null) return ResponseEntity.notFound().build();
return ResponseEntity.ok(shop);
return shop != null ? AjaxResult.success(shop) : AjaxResult.error("未找到店铺");
}
@PostMapping("/update")
public ResponseEntity<Shop> updateShop(@RequestBody Shop shop) {
Shop result = shopService.updateShop(shop);
if (result == null) return ResponseEntity.notFound().build();
return ResponseEntity.ok(result);
public AjaxResult updateShop(@RequestBody Shop shop) {
return toAjax(shopService.updateShop(shop));
}
@DeleteMapping("/delete/{id}")
public ResponseEntity<Void> deleteShop(@PathVariable Long id) {
shopService.deleteShop(id);
return ResponseEntity.ok().build();
@PostMapping("/delete/{id}")
public AjaxResult deleteShop(@PathVariable Long id) {
return toAjax(shopService.deleteShop(id));
}
}

View File

@ -283,6 +283,7 @@ public class ShiroConfig
filterChainDefinitionMap.put("/special/skill/**", "anon");
filterChainDefinitionMap.put("/customer/**", "anon");
filterChainDefinitionMap.put("/goods/**", "anon");
filterChainDefinitionMap.put("/shop/**", "anon");
filterChainDefinitionMap.put("/financial/**", "anon");
filterChainDefinitionMap.put("/tool/**", "anon");
filterChainDefinitionMap.put("/adapay/**", "anon");

View File

@ -30,6 +30,12 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.9</version>
<scope>compile</scope>
</dependency>
<!-- 其他依赖可根据需要添加 -->
</dependencies>

View File

@ -1,7 +1,5 @@
package com.ghy.shop.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@ -9,9 +7,7 @@ import java.io.Serializable;
* 店铺信息实体类
*/
@Data
@TableName("shop")
public class Shop implements Serializable {
@TableId
private Long shopId; // 店铺ID
private String shopName; // 店铺名称
private String imageUrl; // 店铺图片