# lowbaits **Repository Path**: rushbnm/lowbaits ## Basic Information - **Project Name**: lowbaits - **Description**: lowbatis是基于dom4j解析xml的仿mybatis用法的ORM框架,功能并不完善。 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-09-11 - **Last Updated**: 2024-05-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # lowbaits #### 介绍 lowbatis是基于dom4j解析xml的仿mybatis用法的ORM框架,重点在于体会框架开发思想,功能并不完善。虽然预留了各种数据源和事务管理器的实现,但仅支持UNPOOLED数据源和JDBC事务管理器,请勿修改为其他方式。目前仅支持字符串格式,数据库请使用varchar类型进行映射,可以使用该框架进行新增单条记录,根据id查询单条记录,根据id进行修改,根据id进行删除操作。**仅供学习参考使用,请勿使用于生产环境,否则造成的后果自负。** #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. 导入jar包 2. 在resources资源目录下导入lowbatis-config.xml和xxxMapper.xml lowbatis-config.xml ```xml ``` xxxMapper.xml ```xml insert into user(id,name,age) values(#{id},#{name},#{age}) update user set age=#{age} where id=#{id} delete from user where id=#{id} ``` 3. 编写测试pojo类 ```java package com.exmaple.pojo; public class User { private String id; private String name; private String age; @Override public String toString() { return "User{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", age='" + age + '\'' + '}'; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public User() { } public User(String id, String name, String age) { this.id = id; this.name = name; this.age = age; } } ``` 4. 编写测试程序进行测试 ```java package com.test; import com.exmaple.pojo.User; import org.junit.Test; import org.low.ibatis.core.SqlSession; import org.low.ibatis.core.SqlSessionFactory; import org.low.ibatis.core.SqlSessionFactoryBuilder; import org.low.ibatis.utils.Resources; public class TestLowbatis { @Test public void testLowbatis(){ SqlSessionFactoryBuilder sqlSessionFactoryBuilder = new SqlSessionFactoryBuilder(); SqlSessionFactory sqlSessionFactory = sqlSessionFactoryBuilder.build(Resources.getResourceAsStream("lowbatis-config.xml")); SqlSession sqlSession = sqlSessionFactory.openSession(); // sqlSession.insert("user.insertUser",new User("11","zs","25")); // User user = new User(); // user.setId("11"); // user.setAge("35"); // sqlSession.updateById("user.updateUser",user); // Object o = sqlSession.selectOneById("user.selectUserById", "11"); // System.out.println(o); sqlSession.deleteById("user.deleteUser","11"); sqlSession.commit(); sqlSession.close(); } } ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)