MybatisPlusCRUD接口使用

embedded/2025/2/12 10:50:42/

1. MybatisPlus的CRUD接口

MybatisPlus提供了很多CRUD接口,可以直接使用这些接口来操作数据库。而不用像Mybatis那样写大量的XML文件及SQL语句。

Mapper CRUD接口 

主要关键是继承BaseMapper<T>,其中T是实体类。

使用案例

 Mapper层继承BaseMapper接口

java">@Mapper
public interface StudentMapper extends BaseMapper<StudentPO> {}

测试使用

java">@SpringBootTest
@Slf4j
public class TestController {@Autowiredprivate StudentMapper studentMapper;@Testpublic void testQueryStudentList(){List<StudentPO> studentList = studentMapper.selectList(null);log.info("studentList========>"+studentList);}
}

BaseMapper接口中定义了足够我们CRUD的操作方法: Insert、Delete、Update、Select。

 

1.1 Insert

java">// 插入一条记录
int insert(T entity);

案例

java">@SpringBootTest
public class TestController {@Autowiredprivate StudentMapper studentMapper;@Testpublic void testInsert(){studentMapper.insert(new StudentPO(null,"ls",20,"", SexEnum.WOMAN,1,null));}
}

1.2 Delete

java">// 根据 entity 条件,删除记录
int delete(@Param(Constants.WRAPPER) Wrapper<T> wrapper);
// 删除(根据ID 批量删除)
int deleteBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);
// 根据 ID 删除
int deleteById(Serializable id);
// 根据 columnMap 条件,删除记录
int deleteByMap(@Param(Constants.COLUMN_MAP) Map<String, Object> columnMap);

案例

java">@Test
public void testDelete(){// 根据 entity 条件,删除记录Wrapper<StudentPO> wrapper = new QueryWrapper<StudentPO>().eq("name", "ls");studentMapper.delete(wrapper);// 删除(根据ID 批量删除)List<String> ids = new ArrayList<>();ids.add("1");ids.add("2");studentMapper.deleteBatchIds(ids);// 根据 ID 删除studentMapper.deleteById("1746460971291541505");// 根据 columnMap 条件,删除记录Map<String, Object> map = new HashMap<>();map.put("name","Tom");map.put("id",3);studentMapper.deleteByMap(map);
}

1.3 Update

java">// 根据 whereWrapper 条件,更新记录
int update(@Param(Constants.ENTITY) T updateEntity, @Param(Constants.WRAPPER) Wrapper<T> whereWrapper);
// 根据 ID 修改
int updateById(@Param(Constants.ENTITY) T entity);

案例 

java">@Test
public void testUpdate(){StudentPO studentPO = new StudentPO();studentPO.setId(3L);studentPO.setName("sss");studentMapper.updateById(studentPO);studentMapper.update(studentPO,new QueryWrapper<StudentPO>().eq("id",4));
}

1.4 Select

java">// 根据 ID 查询
T selectById(Serializable id);
// 根据 entity 条件,查询一条记录
T selectOne(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper);// 查询(根据ID 批量查询)
List<T> selectBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);
// 根据 entity 条件,查询全部记录
List<T> selectList(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper);
// 查询(根据 columnMap 条件)
List<T> selectByMap(@Param(Constants.COLUMN_MAP) Map<String, Object> columnMap);
// 根据 Wrapper 条件,查询全部记录
List<Map<String, Object>> selectMaps(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper);
// 根据 Wrapper 条件,查询全部记录。注意: 只返回第一个字段的值
List<Object> selectObjs(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper);// 根据 entity 条件,查询全部记录(并翻页)
IPage<T> selectPage(IPage<T> page, @Param(Constants.WRAPPER) Wrapper<T> queryWrapper);
// 根据 Wrapper 条件,查询全部记录(并翻页)
IPage<Map<String, Object>> selectMapsPage(IPage<T> page, @Param(Constants.WRAPPER) Wrapper<T> queryWrapper);
// 根据 Wrapper 条件,查询总记录数
Integer selectCount(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper);

2. Service CRUD 接口

Service CRUD 封装IService (opens new window ) 接口,进一步封装 CRUD 采用 get 查询单行 remove 删除 list 查询集合 page分页 前缀命名方式区分 Mapper 层避免混淆

使用案例 

新增StuentService接口及实现类

接口继承 IService<T>, 泛型为 StudentPO

java">public interface StudentService extends IService<StudentPO> {
}

实现类继承ServiceImpl,并指定Mapper和实体类。

java">@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, StudentPO> implements StudentService {}

测试使用

注入StudentServiceImpl,并调用Service CRUD 接口中的方法,用法和Mapper CRUD 接口中差不多。

java">@SpringBootTest
@Slf4j
public class TestController {@Autowiredprivate StudentServiceImpl studentService;@Testpublic void testQuery(){List<StudentPO> list = studentService.list();log.info("studentList========>"+list);}
}

2.1 Save

java">// 插入一条记录(选择字段,策略插入)
boolean save(T entity);
// 插入(批量)
boolean saveBatch(Collection<T> entityList);
// 插入(批量)
boolean saveBatch(Collection<T> entityList, int batchSize);

2.2 SaveOrUpdate

java">// TableId 注解存在更新记录,否插入一条记录
boolean saveOrUpdate(T entity);
// 根据updateWrapper尝试更新,否继续执行saveOrUpdate(T)方法
boolean saveOrUpdate(T entity, Wrapper<T> updateWrapper);
// 批量修改插入
boolean saveOrUpdateBatch(Collection<T> entityList);
// 批量修改插入
boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);

2.3 Remove

java">// 根据 queryWrapper 设置的条件,删除记录
boolean remove(Wrapper<T> queryWrapper);
// 根据 ID 删除
boolean removeById(Serializable id);
// 根据 columnMap 条件,删除记录
boolean removeByMap(Map<String, Object> columnMap);
// 删除(根据ID 批量删除)
boolean removeByIds(Collection<? extends Serializable> idList);

2.4 Update

java">// 根据 UpdateWrapper 条件,更新记录 需要设置sqlset
boolean update(Wrapper<T> updateWrapper);
// 根据 whereWrapper 条件,更新记录
boolean update(T updateEntity, Wrapper<T> whereWrapper);
// 根据 ID 选择修改
boolean updateById(T entity);
// 根据ID 批量更新
boolean updateBatchById(Collection<T> entityList);
// 根据ID 批量更新
boolean updateBatchById(Collection<T> entityList, int batchSize);

2.5 Get

java">// 根据 ID 查询
T getById(Serializable id);
// 根据 Wrapper,查询一条记录。结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")
T getOne(Wrapper<T> queryWrapper);
// 根据 Wrapper,查询一条记录
T getOne(Wrapper<T> queryWrapper, boolean throwEx);
// 根据 Wrapper,查询一条记录
Map<String, Object> getMap(Wrapper<T> queryWrapper);
// 根据 Wrapper,查询一条记录
<V> V getObj(Wrapper<T> queryWrapper, Function<? super Object, V> mapper);

2.6 List

java">// 查询所有
List<T> list();
// 查询列表
List<T> list(Wrapper<T> queryWrapper);
// 查询(根据ID 批量查询)
Collection<T> listByIds(Collection<? extends Serializable> idList);
// 查询(根据 columnMap 条件)
Collection<T> listByMap(Map<String, Object> columnMap);
// 查询所有列表
List<Map<String, Object>> listMaps();
// 查询列表
List<Map<String, Object>> listMaps(Wrapper<T> queryWrapper);
// 查询全部记录
List<Object> listObjs();
// 查询全部记录
<V> List<V> listObjs(Function<? super Object, V> mapper);
// 根据 Wrapper 条件,查询全部记录
List<Object> listObjs(Wrapper<T> queryWrapper);
// 根据 Wrapper 条件,查询全部记录
<V> List<V> listObjs(Wrapper<T> queryWrapper, Function<? super Object, V> mapper);

2.7 Page

java">// 无条件分页查询
IPage<T> page(IPage<T> page);
// 条件分页查询
IPage<T> page(IPage<T> page, Wrapper<T> queryWrapper);
// 无条件分页查询
IPage<Map<String, Object>> pageMaps(IPage<T> page);
// 条件分页查询
IPage<Map<String, Object>> pageMaps(IPage<T> page, Wrapper<T> queryWrapper);

2.8 Count

java">// 查询总记录数
int count();
// 根据 Wrapper 条件,查询总记录数
int count(Wrapper<T> queryWrapper);

2.9 Chain

Chain为链式封装

query (查询)

java">// 链式查询 普通
QueryChainWrapper<T> query();
// 链式查询 lambda 式。注意:不支持 Kotlin
LambdaQueryChainWrapper<T> lambdaQuery();

使用案例

以下四个查询效果相等,只是写法不同。

java">@Test
public void testQuery2(){List<StudentPO> list1 = studentService.list(new QueryWrapper<StudentPO>().eq("name", "ls").eq("age", 20));log.info("studentList========>"+list1);List<StudentPO> list2 = studentService.list(new LambdaQueryWrapper<StudentPO>().eq(StudentPO::getName, "ls").eq(StudentPO::getAge, 20));log.info("studentList========>"+list2);List<StudentPO> list3 = new QueryChainWrapper<>(studentMapper).eq("name", "ls").eq("age", 20).list();log.info("studentList========>"+list3);List<StudentPO> list4 = new LambdaQueryChainWrapper<>(studentMapper).eq(StudentPO::getName, "ls").eq(StudentPO::getAge, 20).list();log.info("studentList========>"+list4);
}

update(更新)

java">// 链式更改 普通
UpdateChainWrapper<T> update();
// 链式更改 lambda 式。注意:不支持 Kotlin
LambdaUpdateChainWrapper<T> lambdaUpdate();

使用案例

以下四个更新效果相等,只是写法不同。

java">@Test
public void testUpdate2(){StudentPO studentPO = new StudentPO();studentPO.setId(3L);studentPO.setName("sss");studentService.update(studentPO,new QueryWrapper<StudentPO>().eq("name", "ls").eq("age", 20));studentService.update(studentPO,new LambdaQueryWrapper<StudentPO>().eq(StudentPO::getName, "ls").eq(StudentPO::getAge, 20));new UpdateChainWrapper<>(studentMapper).eq("name", "ls").eq("age", 20).update(studentPO);new LambdaUpdateChainWrapper<>(studentMapper).eq(StudentPO::getName, "ls").eq(StudentPO::getAge, 20).update(studentPO);
}

3. ActiveRecord 模式

  • 实体类只需继承 Model 类即可进行强大的CRUD 操作
  • 需要项目中已注入对应实体的BaseMapper

 使用案例

继承Model类

java">@Data
@TableName(value = "student",excludeProperty = {"age"})
public class StudentPO extends Model<StudentPO> {@OrderBy(sort = 1)@TableId(value = "id",type = IdType.ASSIGN_ID)private Long id;@OrderBy(asc = true,sort = 2)@TableField(value = "name",condition = SqlCondition.LIKE)private String name;private Integer age;@TableField(exist = false)private String email;private SexEnum sex;@Versionprivate Integer version;@TableField("is_delete")@TableLogic(value = "0",delval = "1")private Integer isDelete = 0;
}

调用CRUD方法

java">@Test
public void testActiveRecord(){StudentPO studentPO = new StudentPO(null,"ls",20,"", SexEnum.WOMAN,1,null);studentPO.insert();studentPO.insert();studentPO.selectAll();studentPO.updateById();studentPO.deleteById();
}

4. SImpleQuery 工具类

  • 对selectList查询后的结果用Stream流进行了一些封装,使其可以返回一些指定结果,简洁了api的调用
  • 需要项目中已注入对应实体的BaseMapper

 

4.1 keyMap

java">// 查询表内记录,封装返回为Map<属性,实体>
Map<A, E> keyMap(LambdaQueryWrapper<E> wrapper, SFunction<E, A> sFunction, Consumer<E>... peeks);
// 查询表内记录,封装返回为Map<属性,实体>,考虑了并行流的情况
Map<A, E> keyMap(LambdaQueryWrapper<E> wrapper, SFunction<E, A> sFunction, boolean isParallel, Consumer<E>... peeks);

使用案例

java">@Test
public void testQuery3(){Map<String, StudentPO> map = SimpleQuery.keyMap(new LambdaQueryWrapper<StudentPO>().in(StudentPO::getName,"Tom","Sandy"),StudentPO::getName);log.info("map========>"+map);
}/*** 输出结果:map========>* {*      Tom=StudentPO(id=3, name=Tom, age=null, email=null, sex=null, version=null, isDelete=0), *      Sandy=StudentPO(id=4, name=Sandy, age=null, email=null, sex=null, version=null, isDelete=0)* }*/

4.2 map

java">// 查询表内记录,封装返回为Map<属性,属性>
Map<A, P> map(LambdaQueryWrapper<E> wrapper, SFunction<E, A> keyFunc, SFunction<E, P> valueFunc, Consumer<E>... peeks);
// 查询表内记录,封装返回为Map<属性,属性>,考虑了并行流的情况
Map<A, P> map(LambdaQueryWrapper<E> wrapper, SFunction<E, A> keyFunc, SFunction<E, P> valueFunc, boolean isParallel, Consumer<E>... peeks);

使用案例

java">@Test
public void testQuery4(){Map<Long, String> map = SimpleQuery.map(new LambdaQueryWrapper<StudentPO>().in(StudentPO::getName,"Tom","Sandy"),StudentPO::getId,StudentPO::getName);log.info("map========>"+map);
}
// 输出结果:map========>{3=Tom, 4=Sandy}

4.3 group

java">// 查询表内记录,封装返回为Map<属性,List<实体>>
Map<K, List<T>> group(LambdaQueryWrapper<T> wrapper, SFunction<T, A> sFunction, Consumer<T>... peeks);
// 查询表内记录,封装返回为Map<属性,List<实体>>,考虑了并行流的情况
Map<K, List<T>> group(LambdaQueryWrapper<T> wrapper, SFunction<T, K> sFunction, boolean isParallel, Consumer<T>... peeks);
// 查询表内记录,封装返回为Map<属性,分组后对集合进行的下游收集器>
M group(LambdaQueryWrapper<T> wrapper, SFunction<T, K> sFunction, Collector<? super T, A, D> downstream, Consumer<T>... peeks);
// 查询表内记录,封装返回为Map<属性,分组后对集合进行的下游收集器>,考虑了并行流的情况
M group(LambdaQueryWrapper<T> wrapper, SFunction<T, K> sFunction, Collector<? super T, A, D> downstream, boolean isParallel, Consumer<T>... peeks);

使用案例

java">@Test
public void testQuery5(){Map<Long, List<StudentPO>> map = SimpleQuery.group(new LambdaQueryWrapper<StudentPO>().in(StudentPO::getName,"Tom","Sandy"),StudentPO::getId);log.info("map========>"+map);
}
/*** 输出结果:map========>* {*      3=[StudentPO(id=3, name=Tom, age=null, email=null, sex=null, version=null, isDelete=0)], *      4=[StudentPO(id=4, name=Sandy, age=null, email=null, sex=null, version=null, isDelete=0)]* }*/

4.4 list

java">// 查询表内记录,封装返回为List<属性>
List<A> list(LambdaQueryWrapper<E> wrapper, SFunction<E, A> sFunction, Consumer<E>... peeks);
// 查询表内记录,封装返回为List<属性>,考虑了并行流的情况
List<A> list(LambdaQueryWrapper<E> wrapper, SFunction<E, A> sFunction, boolean isParallel, Consumer<E>... peeks);

使用案例

java">@Test
public void testQuery6(){List<SexEnum> list = SimpleQuery.list(new LambdaQueryWrapper<StudentPO>(),StudentPO::getSex);log.info("list========>"+list);
}// 输出结果:list========>[WOMAN, WOMAN, null, null, null, null, WOMAN, MAN]@Test
public void testQuery7(){List<SexEnum> list = SimpleQuery.list(new LambdaQueryWrapper<StudentPO>(), StudentPO::getSex, new Consumer<StudentPO>() {@Overridepublic void accept(StudentPO studentPO) {// 如果性别为空,则设置为MANstudentPO.setSex(Optional.ofNullable(studentPO.getSex()).orElse(SexEnum.MAN));}});log.info("list========>"+list);
}// 输出结果:list========>[WOMAN, WOMAN, MAN, MAN, MAN, MAN, WOMAN, MAN]

5. Db类

  • 使用静态调用的方式,执行CRUD方法,避免Spring环境下Service循环注入,简洁代码,提升效率
  • 需要项目中已注入对应实体的BaseMapper

 Db类所有静态方法

java">public static <T> boolean save(T entity);public static <T> boolean saveBatch(Collection<T> entityList);public static <T> boolean saveBatch(Collection<T> entityList, int batchSize);public static <T> boolean saveOrUpdateBatch(Collection<T> entityList);public static <T> boolean saveOrUpdateBatch(Collection<T> entityList, int batchSize);public static <T> boolean removeById(Serializable id, Class<T> entityClass);public static <T> boolean removeById(T entity);public static <T> boolean remove(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> boolean updateById(T entity);public static <T> boolean update(AbstractWrapper<T, ?, ?> updateWrapper);public static <T> boolean update(T entity, AbstractWrapper<T, ?, ?> updateWrapper);public static <T> boolean updateBatchById(Collection<T> entityList);public static <T> boolean updateBatchById(Collection<T> entityList, int batchSize);public static <T> boolean removeByIds(Collection<? extends Serializable> list, Class<T> entityClass);public static <T> boolean removeByMap(Map<String, Object> columnMap, Class<T> entityClass);public static <T> boolean saveOrUpdate(T entity);public static <T> T getById(Serializable id, Class<T> entityClass);public static <T> T getOne(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> T getOne(T entity);public static <T> T getOne(T entity, boolean throwEx);public static <T> T getOne(AbstractWrapper<T, ?, ?> queryWrapper, boolean throwEx);public static <T> List<T> listByMap(Map<String, Object> columnMap, Class<T> entityClass);public static <T> List<T> listByIds(Collection<? extends Serializable> idList, Class<T> entityClass);public static <T> Map<String, Object> getMap(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> Map<String, Object> getMap(T entity);public static <T> long count(Class<T> entityClass);public static <T> long count(T entity);public static <T> long count(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> List<T> list(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> List<T> list(IPage<T> page, AbstractWrapper<T, ?, ?> queryWrapper);public static <T> List<T> list(Class<T> entityClass);public static <T> List<T> list(IPage<T> page, Class<T> entityClass);public static <T> List<T> list(T entity);public static <T> List<T> list(IPage<T> page, T entity);
public static <T> List<Map<String, Object>> listMaps(AbstractWrapper<T, ?, ?> queryWrapper);public static <T> List<Map<String, Object>> listMaps(IPage<? extends Map<String, Object>> page, AbstractWrapper<T, ?, ?> queryWrapper);public static <T> List<Map<String, Object>> listMaps(Class<T> entityClass);public static <T> List<Map<String, Object>> listMaps(IPage<? extends Map<String, Object>> page, Class<T> entityClass);public static <T> List<Map<String, Object>> listMaps(T entity);
public static <T> List<Map<String, Object>> listMaps(IPage<? extends Map<String, Object>> page, T entity);public static <T> List<T> listObjs(Class<T> entityClass);public static <E, T> List<E> listObjs(AbstractWrapper<T, ?, ?> queryWrapper);public static <T, V> List<V> listObjs(AbstractWrapper<T, ?, ?> queryWrapper, SFunction<? super T, V> mapper);public static <T, V> List<V> listObjs(Class<T> entityClass, SFunction<? super T, V> mapper);public static <T, E extends IPage<Map<String, Object>>> E pageMaps(E page, Class<T> entityClass);public static <T, E extends IPage<Map<String, Object>>> E pageMaps(E page, AbstractWrapper<T, ?, ?> queryWrapper);public static <T> IPage<T> page(IPage<T> page, Class<T> entityClass);public static <T> IPage<T> page(IPage<T> page, AbstractWrapper<T, ?, ?> queryWrapper);public static <T> QueryChainWrapper<T> query(Class<T> entityClass);public static <T> KtQueryChainWrapper<T> ktQuery(Class<T> entityClass);public static <T> LambdaQueryChainWrapper<T> lambdaQuery(Class<T> entityClass);public static <T> UpdateChainWrapper<T> update(Class<T> entityClass);public static <T> KtUpdateChainWrapper<T> ktUpdate(Class<T> entityClass);public static <T> LambdaUpdateChainWrapper<T> lambdaUpdate(Class<T> entityClass);public static <T> boolean saveOrUpdate(T entity, AbstractWrapper<T, ?, ?> updateWrapper);public static <T, V> V getObj(AbstractWrapper<T, ?, ?> queryWrapper, SFunction<? super T, V> mapper);protected static <T> Class<T> getEntityClass(Collection<T> entityList);protected static <T> Class<T> getEntityClass(AbstractWrapper<T, ?, ?> queryWrapper);protected static <T> Class<T> getEntityClass(T entity);protected static <T> TableInfo getTableInfo(Class<T> entityClass);

使用案例

java">@Test
public void testQuery8(){List<StudentPO> list = Db.list(Wrappers.lambdaQuery(StudentPO.class).in(StudentPO::getName,"Tom","Sandy"));log.info("list========>"+list);StudentPO byId = Db.getById(1, StudentPO.class);log.info("byId========>"+byId);
}


http://www.ppmy.cn/embedded/161573.html

相关文章

【自学笔记】GitHub的重点知识点-持续更新

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 GitHub使用指南详细知识点一、GitHub基础与账户管理1. GitHub简介2. 创建与管理GitHub账户3. 创建与配置仓库&#xff08;Repository&#xff09; 二、Git基础与Git…

团结引擎高性能ECS架构(下)

PPT下载链接&#xff1a;https://u3d.sharepoint.cn/:f:/s/UnityChinaResources/EiiiMzsuiL1FouTNpSkE5qABHBR69kSzmePA1FGkAvSCwA?ea0BlzX 在 2024 年 12 月 6 日 Unity 技术开放日厦门站&#xff0c;Unity 中国 DOTS 技术主管李中元带来分享《团结引擎高性能 ECS 架构》&…

[C#].net顶级语句省略main方法内容

.net顶级语句省略main方法 内容复制自&#xff1a;docs.microsoft.com/zh-cn/dotnet/csharp/whats-new/tutorials/top-level-statements 先决条件 需要将计算机设置为运行 .NET 6&#xff0c;其中包括 C# 10 编译器。 自 Visual Studio 2022 或 .NET 6 SDK 起&#xff0c;开…

使用服务器部署DeepSeek-R1模型【详细版】

文章目录 引言deepseek-r1IDE或者终端工具算力平台体验deepseek-r1模型总结 引言 在现代的机器学习和深度学习应用中&#xff0c;模型部署和服务化是每个开发者面临的重要任务。无论是用于智能推荐、自然语言处理还是图像识别&#xff0c;如何高效、稳定地将深度学习模型部署到…

【R语言】获取数据

R语言自带2种数据存储格式&#xff1a;*.RData和*.rds。 这两者的区别是&#xff1a;前者既可以存储数据&#xff0c;也可以存储当前工作空间中的所有变量&#xff0c;属于非标准化存储&#xff1b;后者仅用于存储单个R对象&#xff0c;且存储时可以创建标准化档案&#xff0c…

【含文档+PPT+源码】基于微信小程序的社交摄影约拍平台的设计与实现

项目介绍 本课程演示的是一款基于微信小程序的社交摄影约拍平台的设计与实现&#xff0c;主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的 Java 学习者。 1.包含&#xff1a;项目源码、项目文档、数据库脚本、软件工具等所有资料 2.带你从零开始部署运行本套系…

微信小程序登陆鉴权最佳实现

文章目录 一、使用步骤1.创建鉴权组件auth2.app.json中注册全局组件3.页面使用组件4. 读取本地存储的 token 数据&#xff0c;用于判断是否曾登录过5. 检测登录状态&#xff0c;要求未登录时不显示页面中的内容且跳转到登录页面 一、使用步骤 1.创建鉴权组件auth 2.app.json中…

接口测试Day12-持续集成、git简介和安装、Gitee远程仓库、jenkins集成

持续集成 概念&#xff1a; 团队成员将自己的工作成果&#xff0c;持续集成到一个公共平台的过程。成员可以每天集成一次&#xff0c;也可以一天集成多 次。 相关工具&#xff1a; 本地代码管理&#xff1a;git远程代码管理&#xff1a;gitee(国内)、github(国外)、gitlib(公司…