Skip to content

Commit

Permalink
2024-11-15 修改renren-ui 的category.vue页面, 新增: 点击添加按钮 跳出添加类目详情对话框(el-dia…
Browse files Browse the repository at this point in the history
…log), 添加完成后调用 mallproduct/category/save接口保存数据
  • Loading branch information
iCanDoAllThingszz committed Nov 14, 2024
1 parent e8a9a67 commit e367def
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
22 changes: 21 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ spring:
- 访问 localhost:9995/?url=baidu, 成功路由到百度; 访问 localhost:9995/?url=taobao, 成功路由到淘宝

# 四、业务开发
前端模版服务: renren-ui (需要使用node v12.22.12 -> nvm use 12.22.12 否则报错)
前端模版服务: renren-ui (需要使用node v16.0.0 -> nvm use 16.0.0 否则报错)

后端模版服务: renren-security

Expand Down Expand Up @@ -992,6 +992,26 @@ spring:

![img_29.png](img_29.png)

### 1.6 删除类别数据
1. 修改renren-ui 的category.vue页面, 新增: 添加删除按钮(附带展示逻辑); 新增复选框

2. CategoryController -> delete 批量删除接口, 使用Postman测试/mallproduct/category/delete接口 <br/>
为CategoryEntity类新增逻辑删除判断字段isDeleted, 默认值为0, 删除时更新为1, 同时为pms_category表新增is_Deleted字段

3. 修改 CategoryController -> delete 接口逻辑

4. 修改renren-ui, 新增点击 添加/删除按钮后的逻辑 **element-ui组件库只兼容vue2, 我们使用的是vue3, 所以需要安装element-plus 为了使用其中的elmessagebox, elmessage组件; node版本适用v16.0.0**

5. 完成类别删除功能

### 1.7 新增类别信息

> element-plus组件库地址: https://element-plus.org/zh-CN

1. 修改renren-ui 的category.vue页面, 新增: 点击添加按钮 跳出添加类目详情对话框(el-dialog), 添加完成后调用 mallproduct/category/save接口保存数据

2. 完成类别新增功能



## 2. 基础业务
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ public R update(@RequestBody CategoryEntity category){
}

/**
* 删除
* 批量删除
*/
@RequestMapping("/delete")
//@RequiresPermissions("mallproduct:category:delete")
public R delete(@RequestBody Long[] catIds){
categoryService.removeByIds(Arrays.asList(catIds));
//categoryService.removeByIds(Arrays.asList(catIds));

categoryService.removeCategoryByIds(Arrays.asList(catIds));

return R.ok();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
Expand Down Expand Up @@ -66,4 +67,8 @@ public class CategoryEntity implements Serializable {
@TableField(exist = false)
private List<CategoryEntity> childrens;

@TableLogic
@TableField("isDelete")
private Integer isDelete;

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ public interface CategoryService extends IService<CategoryEntity> {
PageUtils queryPage(Map<String, Object> params);

List<CategoryEntity> queryPageTree(Map<String, Object> params);

void removeCategoryByIds(List<Long> catIds);
}

Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,16 @@ private List<CategoryEntity> getCategoryChildrens(CategoryEntity category, List<
return collect;
}

/**
* @description 根据catIds删除类别信息
* @param catIds 目录id主键
* */
public void removeCategoryByIds(List<Long> catIds) {
// 1.检查类别数据是否在其他业务中使用
// todo 其他服务就绪后补充此步骤

// 2.逻辑删除 注意不要使用 this.removeCategoryByIds(catIds), 否则自己调自己, 事务失效
categoryDao.deleteBatchIds(catIds);
}

}

0 comments on commit e367def

Please sign in to comment.