https://github.com/deng-hb/dbhelper
📣一个简单易用可对象操作基于Spring JdbcTemplate可替代MyBatis、Hibernate的JDBC ORM工具包
https://github.com/deng-hb/dbhelper
dbhelper hibernate jdbctemplate mybatis spring-jdbctemplate
Last synced: 6 months ago
JSON representation
📣一个简单易用可对象操作基于Spring JdbcTemplate可替代MyBatis、Hibernate的JDBC ORM工具包
- Host: GitHub
- URL: https://github.com/deng-hb/dbhelper
- Owner: deng-hb
- Created: 2016-06-30T11:06:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T08:46:58.000Z (over 7 years ago)
- Last Synced: 2025-03-22T01:24:55.284Z (7 months ago)
- Topics: dbhelper, hibernate, jdbctemplate, mybatis, spring-jdbctemplate
- Language: Java
- Homepage: http://denghb.com/
- Size: 48.8 KB
- Stars: 11
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dbhelper
##### 一个简单的基于Spring JdbcTemplate帮助包 (暂时只支持mysql)
1、Maven
```xmlcom.denghb
dbhelper
3.0.6```
Or
```
git clone https://github.com/deng-hb/dbhelper.git
```2、配置
SpringBoot
参考[spring-boot-dbhelper-demo](https://github.com/deng-hb/spring-boot-dbhelper-demo)在Spring配置文件(applicationContext.xml)中增加
```xml
```
Or 下载源码使用注解(jdbcTemplate需要在配置中)
```java
@Repository
public class DbHelperImpl implements DbHelper {@Repository
private JdbcTemplate jdbcTemplate;
```
Logging配置(application.properties/log4j.properties):
```
logging.level.com.denghb=DEBUG
```3、使用
```java
/**
* 创建一条纪录
*
* @param object
* @return
*/
public boolean insert(Object object);/**
* 更新一条纪录
*
* @param object
* @return
*/
public boolean updateById(Object object);/**
* 执行一条SQL
*
* @param sql
* @param args
* @return
*/
public int execute(String sql, Object... args);/**
* 查询列表
*
* @param sql
* @param clazz
* @param args
* @return
*/
public List list(String sql, Class clazz, Object... args);/**
* 查询并分页
*
* @param sql
* @param clazz
* @param paging
* @param
* @return
*/
public PagingResult list(StringBuffer sql, Class clazz, Paging paging);/**
* 指定参数查询返回对象
*
* @param sql
* @param clazz
* @param args
* @return
*/
public T queryForObject(String sql, Class clazz, Object... args);/**
* 查询一条纪录
*
* @param clazz
* @param id
* @return
*/
public T queryById(Class clazz, Object id);/**
* 删除
*
* @param clazz
* @param id
* @return
*/
public boolean deleteById(Class clazz, Object id);
```4、兼容 spring-jdbc 3.1.0.RELEASE 及以上版本
5、数据库表生成对应实体[dbhelper-client](https://github.com/deng-hb/dbhelper-client)
6、欢迎拍砖([issues](https://github.com/deng-hb/dbhelper/issues)||i#denghb.com)#->@
7、License
```
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```