mirror of
https://gitee.com/gz-yami/mall4j.git
synced 2026-03-22 09:17:16 +08:00
修复【状态修改为“下线”后, 表格数据状态还是显示“正常”】的bug
This commit is contained in:
@@ -109,6 +109,15 @@ public class CategoryController {
|
||||
if(categoryName != null){
|
||||
throw new YamiShopBindException("类目名称已存在!");
|
||||
}
|
||||
Category categoryDB = categoryService.getById(category.getCategoryId());
|
||||
// 如果从下线改成正常,则需要判断上级的状态
|
||||
if (Objects.equals(categoryDB.getStatus(),0) && Objects.equals(category.getStatus(),1) && !Objects.equals(category.getParentId(),0L)){
|
||||
Category parentCategory = categoryService.getOne(new LambdaQueryWrapper<Category>().eq(Category::getCategoryId, category.getParentId()));
|
||||
if(Objects.isNull(parentCategory) || Objects.equals(parentCategory.getStatus(),0)){
|
||||
// 修改失败,上级分类不存在或者不为正常状态
|
||||
throw new YamiShopBindException("修改失败,上级分类不存在或者不为正常状态");
|
||||
}
|
||||
}
|
||||
categoryService.updateCategroy(category);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</select>
|
||||
|
||||
<select id="tableCategory" resultType="com.yami.shop.bean.model.Category">
|
||||
select category_id ,parent_id ,category_name,pic,seq from tz_category where shop_id = #{shopId} order by seq
|
||||
select category_id ,parent_id ,category_name,pic,seq,status from tz_category where shop_id = #{shopId} order by seq
|
||||
</select>
|
||||
|
||||
<select id="listCategoryAndProdByShopId" resultMap="categoryProdMap">
|
||||
|
||||
Reference in New Issue
Block a user