|
@@ -7,11 +7,13 @@ import com.cdf.common.LogInfoKey;
|
|
import com.cdf.common.PageInfo;
|
|
import com.cdf.common.PageInfo;
|
|
import com.cdf.common.ResultCode;
|
|
import com.cdf.common.ResultCode;
|
|
import com.cdf.common.ResultData;
|
|
import com.cdf.common.ResultData;
|
|
|
|
+import com.cdf.entity.Shop;
|
|
import com.cdf.entity.ShopCategory;
|
|
import com.cdf.entity.ShopCategory;
|
|
import com.cdf.exception.BusinessException;
|
|
import com.cdf.exception.BusinessException;
|
|
import com.cdf.request.BaseRequest;
|
|
import com.cdf.request.BaseRequest;
|
|
import com.cdf.service.ILogService;
|
|
import com.cdf.service.ILogService;
|
|
import com.cdf.service.IShopCategoryService;
|
|
import com.cdf.service.IShopCategoryService;
|
|
|
|
+import com.cdf.service.IShopService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -28,6 +30,8 @@ public class ShopCategoryController extends BaseLogController{
|
|
private IShopCategoryService shopCategoryService;
|
|
private IShopCategoryService shopCategoryService;
|
|
@Autowired
|
|
@Autowired
|
|
private ILogService logService;
|
|
private ILogService logService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IShopService shopService;
|
|
|
|
|
|
@PostMapping("/saveOrUpdate")
|
|
@PostMapping("/saveOrUpdate")
|
|
public ResultData saveOrUpdate(@RequestBody ShopCategory shopCategory){
|
|
public ResultData saveOrUpdate(@RequestBody ShopCategory shopCategory){
|
|
@@ -48,6 +52,10 @@ public class ShopCategoryController extends BaseLogController{
|
|
if(shopCategory.getId() == null){
|
|
if(shopCategory.getId() == null){
|
|
throw new BusinessException(ResultCode.PARAM_MISS);
|
|
throw new BusinessException(ResultCode.PARAM_MISS);
|
|
}
|
|
}
|
|
|
|
+ List<Shop> shops = shopService.getByCategory(shopCategory.getId());
|
|
|
|
+ if(shops.size() >0){
|
|
|
|
+ throw new BusinessException(ResultCode.DEL_SHOP_CATEGORY_ERROR);
|
|
|
|
+ }
|
|
ShopCategory shopCategory1 = shopCategoryService.getById(shopCategory.getId());
|
|
ShopCategory shopCategory1 = shopCategoryService.getById(shopCategory.getId());
|
|
if(shopCategory1!=null){
|
|
if(shopCategory1!=null){
|
|
shopCategoryService.removeById(shopCategory.getId());
|
|
shopCategoryService.removeById(shopCategory.getId());
|