no message
This commit is contained in:
parent
dfcf26d976
commit
7a2a155938
|
|
@ -143,6 +143,10 @@
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ghy</groupId>
|
||||||
|
<artifactId>ghy-shop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package com.ghy.web.controller;
|
package com.ghy.web.controller;
|
||||||
|
|
||||||
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.shop.domain.Shop;
|
import com.ghy.shop.domain.Shop;
|
||||||
import com.ghy.shop.service.ShopService;
|
import com.ghy.shop.service.ShopService;
|
||||||
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -12,38 +14,34 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/shop")
|
@RequestMapping("/shop")
|
||||||
public class ShopController {
|
public class ShopController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopService shopService;
|
private ShopService shopService;
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public ResponseEntity<Shop> addShop(@RequestBody Shop shop) {
|
public AjaxResult addShop(@RequestBody Shop shop) {
|
||||||
Shop result = shopService.addShop(shop);
|
return toAjax(shopService.addShop(shop));
|
||||||
return ResponseEntity.ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public ResponseEntity<List<Shop>> listShops() {
|
public AjaxResult listShops() {
|
||||||
return ResponseEntity.ok(shopService.listShops());
|
List<Shop> list = shopService.listShops();
|
||||||
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Shop> getShop(@PathVariable Long id) {
|
public AjaxResult getShop(@PathVariable Long id) {
|
||||||
Shop shop = shopService.getShop(id);
|
Shop shop = shopService.getShop(id);
|
||||||
if (shop == null) return ResponseEntity.notFound().build();
|
return shop != null ? AjaxResult.success(shop) : AjaxResult.error("未找到店铺");
|
||||||
return ResponseEntity.ok(shop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseEntity<Shop> updateShop(@RequestBody Shop shop) {
|
public AjaxResult updateShop(@RequestBody Shop shop) {
|
||||||
Shop result = shopService.updateShop(shop);
|
return toAjax(shopService.updateShop(shop));
|
||||||
if (result == null) return ResponseEntity.notFound().build();
|
|
||||||
return ResponseEntity.ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@PostMapping("/delete/{id}")
|
||||||
public ResponseEntity<Void> deleteShop(@PathVariable Long id) {
|
public AjaxResult deleteShop(@PathVariable Long id) {
|
||||||
shopService.deleteShop(id);
|
return toAjax(shopService.deleteShop(id));
|
||||||
return ResponseEntity.ok().build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -283,6 +283,7 @@ public class ShiroConfig
|
||||||
filterChainDefinitionMap.put("/special/skill/**", "anon");
|
filterChainDefinitionMap.put("/special/skill/**", "anon");
|
||||||
filterChainDefinitionMap.put("/customer/**", "anon");
|
filterChainDefinitionMap.put("/customer/**", "anon");
|
||||||
filterChainDefinitionMap.put("/goods/**", "anon");
|
filterChainDefinitionMap.put("/goods/**", "anon");
|
||||||
|
filterChainDefinitionMap.put("/shop/**", "anon");
|
||||||
filterChainDefinitionMap.put("/financial/**", "anon");
|
filterChainDefinitionMap.put("/financial/**", "anon");
|
||||||
filterChainDefinitionMap.put("/tool/**", "anon");
|
filterChainDefinitionMap.put("/tool/**", "anon");
|
||||||
filterChainDefinitionMap.put("/adapay/**", "anon");
|
filterChainDefinitionMap.put("/adapay/**", "anon");
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis</artifactId>
|
||||||
|
<version>3.5.9</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<!-- 其他依赖可根据需要添加 -->
|
<!-- 其他依赖可根据需要添加 -->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.ghy.shop.domain;
|
package com.ghy.shop.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -9,9 +7,7 @@ import java.io.Serializable;
|
||||||
* 店铺信息实体类
|
* 店铺信息实体类
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("shop")
|
|
||||||
public class Shop implements Serializable {
|
public class Shop implements Serializable {
|
||||||
@TableId
|
|
||||||
private Long shopId; // 店铺ID
|
private Long shopId; // 店铺ID
|
||||||
private String shopName; // 店铺名称
|
private String shopName; // 店铺名称
|
||||||
private String imageUrl; // 店铺图片
|
private String imageUrl; // 店铺图片
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue