文章目录

  • 1.左侧菜单查询
    • 1.1 数据库设计
    • 1.2 pojo层
    • 1.3 Mapper接口
    • 1.4 Mapper.xml
    • 1.5 ServiceImpl层
    • 1.6 Controller层
  • 2.显示
    • 2.0 数据库
    • 2.1 前端页面分析
      • 2.1.1 生命周期函数
      • 2.1.2 获取数据函数
    • 2.2 接口文档
    • 2.3 实现
      • 2.3.1 Controller层
      • 2.3.2 Service层
      • 2.3.3 ServiceImpl层
      • 2.3.4 pojo层
  • 3.删除
    • 3.1 前端页面分析
    • 3.2 接口文档
    • 4.3 实现
      • 4.3.1 Controller层
      • 4.3.2 ServiceImpl层
  • 4.修改
    • 4.1 前端页面分析
    • 4.2 接口文档
    • 4.3 实现
      • 4.3.1 Controller层
      • 4.3.2 ServiceImpl层

1.左侧菜单查询

1.1 数据库设计

1.2 pojo层

package com.ap.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;import java.util.List;@Data
@Accessors(chain = true)
@TableName("car")
public class Car extends BasePojo{@TableId(type = IdType.AUTO)//主键自增private Integer id;private String name;private Integer parentId;private String path;private Integer level;private String path1;private Boolean status;private String no1;private String no2;private String no3;@TableField(exist = false)     //属性不是表字段private List<Shop> children; //不是表格固有属性
}

1.3 Mapper接口

package com.ap.mapper;import com.ap.pojo.Car;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;import java.util.List;public interface CarMapper extends BaseMapper<Car> {List<Car> getShopList();
}

1.4 Mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ap.mapper.CarMapper"><select id="getShopList" resultMap="rightsRM">SELECT  p.id,p.name,p.parent_id,p.path,p.level,p.created,p.updated,p.path1,c.id c_id,c.name c_name,c.parent_id c_parent_id,c.path c_path,c.level c_level,c.created c_created,c.updated c_updated,c.path1 c_path1  FROM(SELECT * FROM car WHERE parent_id = 0)pLEFT JOINcar cONp.id = c.parent_id</select><!--完成左侧菜单列表的数据封装 1-2级--><resultMap id="rightsRM" type="Car" autoMapping="true"><id property="id" column="id"></id><!--封装一对多数据--><collection property="children" ofType="Car"><id property="id" column="c_id"/><result property="name" column="c_name"/><result property="parentId" column="c_parent_id"/><result property="path" column="c_path"/><result property="level" column="c_level"/><result property="created" column="c_created"/><result property="updated" column="c_updated"/><result property="path1" column="c_path1"/></collection></resultMap>
</mapper>

1.5 ServiceImpl层

package com.ap.service;import com.ap.mapper.CarMapper;
import com.ap.pojo.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class CarServiceImpl implements CarService{@Autowiredprivate CarMapper carMapper;@Overridepublic List<Car> getShopList() {return carMapper.getShopList();}
}

1.6 Controller层

package com.ap.controller;import com.ap.pojo.Car;
import com.ap.service.CarService;
import com.ap.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RestController
@CrossOrigin
@RequestMapping("car")
public class CarController {@Autowiredprivate CarService carService;@GetMapping("/getShopList")public SysResult getShopList(){List<Car> car=carService.getShopList();return SysResult.success(car);}
}

2.显示

2.0 数据库

2.1 前端页面分析

2.1.1 生命周期函数
updated() {if(this.i !== this.queryItemInfo.id){this.queryItemInfo.id = this.ithis.getItemList()}},
2.1.2 获取数据函数
//实现商品信息分页查询//2.调用this.getItemList()async getItemList() {const {data: result} = await this.$http.get("/car/getItemList", {params: this.queryItemInfo  //将分页对象传给后台})if (result.status !== 200) return this.$message.error("商品列表查询失败")this.itemList = result.data.rows //获取商品列表信息,将其传给itemListthis.total = result.data.total   //获取商品列表中数据的总数},

2.2 接口文档

  • 请求路径:/car/getItemList?query=&pageNum=1&pageSize=10
  • 请求类型:Get
  • 请求参数:使用pageResult对象接收
参数名称 参数说明 备注信息
query 用户查询的数据 可为null
pageNum 分页查询的页数 不能为null
pageSize 分页查询的条数 不能为null
  • 业务说明:查询三级分类菜单数据,要求三层嵌套结构
  • 返回值:SysResult对象
参数名称 参数说明 备注信息
status 状态信息 200表示服务器请求成功,201表示服务器异常
msg 服务器返回的提示信息 能为null
data 服务器返回的业务权限 3级商品分类信息

2.3 实现

2.3.1 Controller层
package com.ap.controller;import com.ap.pojo.ItemCopy;
import com.ap.service.ItemCopyService;
import com.ap.vo.PageResult;
import com.ap.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/*汽车具体数据*/
@RestController
@CrossOrigin
@RequestMapping("/car/")
public class ItemCopyController {@Autowiredprivate ItemCopyService itemCopyService;/*** 请求路径:/car/getItemList?query=&pageNum=1&pageSize=10* 请求类型:Get* 请求参数:使用pageResult对象接收*/@GetMapping("/getItemList")public SysResult getItemList(PageResult pageResult){pageResult=itemCopyService.getItemList(pageResult);return SysResult.success(pageResult);}}
2.3.2 Service层
package com.ap.service;import com.ap.vo.PageResult;public interface ItemCopyService {PageResult getItemList(PageResult pageResult);
}
2.3.3 ServiceImpl层
package com.ap.service;import com.ap.mapper.ItemCopyMapper;
import com.ap.pojo.Item;
import com.ap.pojo.ItemCopy;
import com.ap.vo.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;import java.util.List;@Service
public class ItemCopyServiceImpl implements ItemCopyService{@Autowiredprivate ItemCopyMapper itemCopyMapper;/*** 要求:3+2(总记录数,分页结果)* 参数1:page MP提供的分页对象* 参数2:条件构造器*/@Overridepublic PageResult getItemList(PageResult pageResult) {//1.构建分页对象,参数1:第几页,参数2:多少条Page<ItemCopy> page=new Page<>(pageResult.getPageNum(),pageResult.getPageSize());//2.准备条件构造器QueryWrapper<ItemCopy> queryWrapper = new QueryWrapper();String query=pageResult.getQuery();boolean flag = StringUtils.hasLength(query);queryWrapper.eq("item_cat_id", pageResult.getId());queryWrapper.like(flag,"title",query);//3.根据MP查询 实现分页数据的自动封装page=itemCopyMapper.selectPage(page, queryWrapper);//4.获取数据,返回分页对象long total = page.getTotal();//获取分页结果List<ItemCopy> rows = page.getRecords();return pageResult.setTotal(total).setRows(rows);}}
2.3.4 pojo层
package com.ap.pojo;import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;@Data
@Accessors(chain = true)
@TableName("item_copy")
public class ItemCopy extends BasePojo{@TableId(type = IdType.AUTO)private Integer id;         //商品Id号private String title;       //商品标题信息private String sellPoint;   //卖点信息private Integer price;      //商品价格private Integer pricerow;      //商品原价private Integer num;        //商品数量private String images;       //商品图片private Integer itemCatId;  //商品分类ID号private Boolean status;     //状态信息    0 下架 1 上架private Boolean display;private String title2;private String title3;private String images2;       //商品图片private String images3;       //商品图片
}

3.删除

3.1 前端页面分析

       async deleteItemBtn(item) {//消息确认框this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(async () => {//根据id删除数据const {data: result} = await this.$http.delete("/car/deleteItemById", {params: {id: item.id}})if (result.status !== 200) return this.$message.error("商品删除失败")this.$message.success("商品删除成功")//重新获取商品列表信息this.getItemList()}).catch(() => {this.$message({type: 'info',message: '已取消删除'});});},

3.2 接口文档

  • 请求路径:/shop/deleteItemCat

  • 请求类型:DELETE

  • 请求参数:id

4.3 实现

4.3.1 Controller层
    /*** 请求路径:/car/deleteItemById* 请求类型:DELETE* 请求参数:用户ID*/@DeleteMapping("/deleteItemById")public SysResult deleteItemById(Integer id){itemCopyService.deleteItemById(id);return SysResult.success();}
4.3.2 ServiceImpl层
@Overridepublic void deleteItemById(Integer id) {itemCopyMapper.deleteById(id);}

4.修改

4.1 前端页面分析

//修改商品分类信息async updateItem(){let item= {}item.id=this.updateUserModel.iditem.title=this.updateUserModel.titleitem.title2=this.updateUserModel.title2item.title3=this.updateUserModel.title3item.sellPoint=this.updateUserModel.sellPointitem.price=this.updateUserModel.priceitem.pricerow=this.updateUserModel.pricerowitem.num=this.updateUserModel.numitem.images=this.updateUserModel.imagesitem.images2=this.updateUserModel.images2item.images3=this.updateUserModel.images3const {data: result} = await this.$http.put('/car/updateItem', item)if (result.status !== 200) return this.$message.error("更新商品失败")this.$message.success("更新商品成功")this.updateDialogVisible = falsethis.getItemList()}

4.2 接口文档

  • 请求路径:/car/updateItemCat
  • 请求类型:PUT
  • 请求参数:表单数据对象
  • 返回值:SysResult对象
参数名称 参数说明 备注信息
status 状态信息 200表示服务器请求成功,201表示服务器异常
msg 服务器返回的提示信息 能为null
data 服务器返回的业务权限 3级商品分类信息

4.3 实现

4.3.1 Controller层
/*** 请求路径:/yingliangbang1/updateItem* 需求:修改商品信息* 请求类型:PUT* 返回值:SysResult对象*/@PutMapping("/updateItem")public SysResult updateItem(@RequestBody ItemCopy itemCopy){itemCopyService.updateItem(itemCopy);return SysResult.success();}
4.3.2 ServiceImpl层
@Overridepublic void updateItem(ItemCopy itemCopy) {itemCopyMapper.updateById(itemCopy);}

【汽车配件管理系统-管理员-配件管理模块】配件管理分类相关推荐

  1. 【汽车配件管理系统-管理员-货物管理模块】货物管理分类

    文章目录 1.数据库 1.1 数据库设计 1.2 pojo层 1.3 编辑Shop的Mapper接口 2.显示 2.1 前端页面分析 2.1.1 生命周期函数 2.1.2 获取数据函数 2.2 接口文 ...

  2. 微服务模块综合管理(模块视图管理,自动化热部署,前端资源实时刷新......)

    一.微服务可视化整体管理 微服务模块太多,启动关闭等管理操作就会很复杂,用这种方法就会很方便管理 方法是 1 idea底下没有的找出services窗口 2 IDEA底边栏选services 2 选择 ...

  3. 数图互通高校房产管理模块周转房管理是怎样管理如合同、续租、到期提醒

    数图互通高校房产管理系统,管理比较全面,可以实现实现对承租公房和教师公寓.集体宿舍及时准确地掌握使用情况,并直观显示.包含功能: 1.租赁房屋定义 2.入住登记 3.缴费登记 4.合同生成和打印 5. ...

  4. 合同管理模块样板html,可配置合同模板的合同管理系统的制作方法

    技术特征: 1.可配置合同模板的合同管理系统,其特征在于,合同管理系统包括:合同模板管理模块,对数据库中的合同字段进行管理并创建多个合同模板,合同与模板采用多对多的数据关系存储于数据库,创建不同模板的 ...

  5. [Java开发]搭建人力资源管理系统——简历管理模块(附带下载链接)

    最近一位老哥让我给他的公司开发一套人力资源管理系统,并详细描述了这个系统的一些功能,我也查找了一些人力资源的资料.因为跟老哥关系不错,就答应了他.大家都知道,人力资源管理就是管人的,从给公司开始投递简 ...

  6. 拉勾教育后台管理系统(SSM)(课程管理模块开发)【学习笔记】

    文章目录 1.项目架构 1.1.项目介绍 1.2.技术选型 1.2.1.前端技术选型 1.2.2.后端技术选型 1.3.项目开发环境 2.Maven进阶使用(Maven聚合工程) 2.1.maven的 ...

  7. 06_04_任务一:拉勾教育后台管理系统[课程管理模块、图片上传、 BeanUtils封装实体类](SSM)

    拉勾教育后台管理系统(SSM) 1. 项目架构 1.1 项目介绍 ​ 拉勾教育后台管理系统,是提供给拉勾教育的相关业务人员使用的一个后台管理系统, 业务人员可以在 这个后台管理系统中,对课程信息.广告 ...

  8. 尚硅谷在线教育一:尚硅谷在线教育相关的基本搭建配置以及讲师管理模块

    文章目录 1.项目的总体说明 1.1项目的功能模块说明 1.2项目设计的技术 2创建一个名为guli的springboot的父项目 3. 在guli的项目下创建一个子模块common用于公共使用的模块 ...

  9. 统一项目管理平台(UMPlatForm.NET)-4.5 用户管理模块

    统一项目管理平台(UMPlatForm.NET)-4.5 用户管理模块 4.4 用户管理模块 用户管理模块主要是对可登录系统的用户进行管理.后续的工作如:用户归属角色.权限的分配.用户所拥有的相应功能 ...

最新文章

  1. Linux那些事儿 之 戏说USB(4)最终奥义
  2. 3438亿美元!互联网内容产业新机会
  3. Microbiome:揩老鼠皮毛揩来高分文章——野生哺乳动物的皮肤和肠道微生物对核污染的反应...
  4. 苹果被正式起诉!欧盟:滥用主导地位,利用App Store扭曲竞争
  5. 进阶学习(3.5) Singleton Pattern 单例模式
  6. uos系统断网怎么安装mysql_[学习笔记] UOS安装MySQL
  7. 适合新手的python书籍推荐_推荐一本适合初学者全面自学python的书(附赠电子书)...
  8. python 正则表达式判断字符串是否为回文_JS使用栈判断给定字符串是否是回文算法示例...
  9. logback logback.xml 常用配置详解
  10. html5比赛策划书,FashionAI 天池竞赛 - Top5 技术方案简汇
  11. 每天学点Shiro-say hello
  12. 【大数据采集技术与应用】【第一章】【大数据采集技术与应用概述】
  13. 华为计算机怎么算根号,华为手机计算器的根号是什?
  14. 入门必学 | R语言参数检验之t检验与方差分析
  15. PMP项目进度网络图详解——第3篇:CCPM关键链法
  16. 个人简历介绍自己怎么写? 我的优势如何表达
  17. python模拟商家抹零行为_2019-04-10
  18. 项目review会议的步骤_8个步骤,使您的下一次会议更有效率
  19. 关于science和nature
  20. Pythonic algorithm

热门文章

  1. 发展数字经济具有重要意义
  2. 苹果手机找回ID及密码经验
  3. Java枚举类与注解
  4. app冷启动与热启动原理,及启动优化
  5. placement new的标准用法及用途
  6. 白光干涉仪可以用于测量化妆品用的云母材料?
  7. 2023年十大流媒体发展趋势展望
  8. Tomcat部署到idea
  9. 关于如何设置收藏本站和设为首页
  10. 互动教程 for Xcode10 and Swift4.2