Commit 80e558ea authored by 王晓旭's avatar 王晓旭
parents a6e13349 3f6ca8fe
......@@ -14,6 +14,7 @@ import com.mortals.xhx.module.product.model.ProductCategoryQuery;
import com.mortals.xhx.module.product.service.ProductCategoryService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -80,8 +81,13 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product
protected int editAfter(Long id, Map<String, Object> model, ProductEntity entity, Context context) throws AppException {
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(entity.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(entity.getId())).stream().map(i -> i.getProductId().toString()).collect(Collectors.joining(","));
entity.setCompanyId(companyIds);
entity.setCategoryId(categoryIds);
if (!ObjectUtils.isEmpty(categoryIds)) {
entity.setCategoryId(categoryIds);
}
if (!ObjectUtils.isEmpty(companyIds)) {
entity.setCompanyId(companyIds);
}
return super.editAfter(id, model, entity, context);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment