用户端商品缓存+商品信息修改缓存自动清空
This commit is contained in:
@@ -5,12 +5,14 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableTransactionManagement
|
||||
@EnableDubbo
|
||||
@MapperScan("com.czg.service.product.mapper")
|
||||
public class ProductApplication {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.czg.product.param.ProductIsSoldOutParam;
|
||||
import com.czg.product.service.ProdConsRelationService;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.ValidatorUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
@@ -70,6 +71,8 @@ public class ProductController {
|
||||
for (ProdSkuDTO prodSkuDTO : dto.getSkuList()) {
|
||||
ValidatorUtil.validateEntity(prodSkuDTO, DefaultGroup.class);
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
productService.addProduct(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
@@ -78,6 +81,8 @@ public class ProductController {
|
||||
@OperationLog("商品-修改")
|
||||
//@SaAdminCheckPermission("product:update")
|
||||
public CzgResult<Void> updateProduct(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProductDTO dto) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
productService.updateProduct(dto);
|
||||
return CzgResult.success();
|
||||
}
|
||||
@@ -88,7 +93,8 @@ public class ProductController {
|
||||
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
productService.deleteProduct(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
productService.deleteProduct(shopId, id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -99,6 +105,8 @@ public class ProductController {
|
||||
@OperationLog("商品-上下架")
|
||||
//@SaAdminCheckPermission("product:on-off")
|
||||
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
param.setShopId(shopId);
|
||||
productService.onOffProduct(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
@@ -110,6 +118,8 @@ public class ProductController {
|
||||
@OperationLog("商品-标记售罄")
|
||||
//@SaAdminCheckPermission("product:markIsSoldOut")
|
||||
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
param.setShopId(shopId);
|
||||
productService.markProductIsSoldOut(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.czg.product.vo.ShopProductInfoVo;
|
||||
import com.czg.product.vo.ShopProductSkuInfoVo;
|
||||
import com.czg.product.vo.ShopProductVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.ValidatorUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
@@ -36,7 +37,8 @@ public class UProductController {
|
||||
*/
|
||||
@GetMapping("/miniApp/hots/query")
|
||||
public CzgResult<List<ShopProductVo>> queryHotsProductList() {
|
||||
List<ShopProductVo> list = uProductService.queryHotsProductList();
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
List<ShopProductVo> list = uProductService.queryHotsProductList(shopId);
|
||||
return CzgResult.success(list);
|
||||
}
|
||||
|
||||
@@ -45,7 +47,8 @@ public class UProductController {
|
||||
*/
|
||||
@GetMapping("/miniApp/group/query")
|
||||
public CzgResult<List<ShopGroupProductVo>> queryGroupProductList() {
|
||||
List<ShopGroupProductVo> list = uProductService.queryGroupProductList();
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
List<ShopGroupProductVo> list = uProductService.queryGroupProductList(shopId);
|
||||
return CzgResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user