Bean Searcher 发布 v3.1.3 版本
Bean Searcher 发布 v3.1.3版本,具体更新内容如下: Bean Searcher 无@DbIgnore也自动忽略实体类中的静态字段 Bean Searcher Boot Starter 使用 Searcher 类型注入检索器时,默认注入 MapSearcher,不再报错 提高兼容性,SpringBoot 最低版本支持到 v1.4+
经过了将近 4 个月,我终于又有了一点点闲置的时间,刚好趁这波机会 将项目进行了一次大升级,所以版本号也是飞跃式的上升,从1.1.17 直接升级到2.0。
Magician 除了底层大换血,全部改成了Netty,其他基本没变,只是少了一个UDP的支持,从使用者的角度来看 基本没啥变化
Magician-Web只是配合Magician进行的一次小小的调整,所以几乎没变化。
重点在Magician-JDBC
依然保留了多数据源的支持,其他变化如下
ParamPO paramPO = new ParamPO();
paramPO.setUserName("a");
paramPO.setUserEmail("test@qq.com");
int result = JDBCTemplate.get().insert("表名", paramPO);
// 构建修改条件
List<Condition> conditionList = new ArrayList<>();
conditionList.add(Condition.get("id = ?", 4));
// 构建修改数据
ParamPO paramPO = new ParamPO();
paramPO.setUserName("a");
paramPO.setUserEmail("test@qq.com");
// 执行修改
int result = JDBCTemplate.get().update("表名", paramPO, conditionList);
// 构建删除条件
List<Condition> conditionList = new ArrayList<>();
conditionList.add(Condition.get("id = ?", 42));
// 执行删除
int result = JDBCTemplate.get().delete("表名", conditionList);
// 构建查询条件
List<Condition> conditionList = new ArrayList<>();
conditionList.add(Condition.get("id > ?", 10));
conditionList.add(Condition.get("and user_name != ?", "a"));
conditionList.add(Condition.get("order by create_time desc", Condition.NOT_WHERE));
// 执行查询
List<ParamPO> result = JDBCTemplate.get().select("xt_message_board", conditionList, ParamPO.class);
ParamPO paramPO = new ParamPO();
paramPO.setUserName("testTx222");
paramPO.setUserEmail("testTx222@qq.com");
paramPO.setId(4);
// 采用{}占位符的写法
int result = JDBCTemplate.get().exec("update xt_message_board set user_name = {user_name} , user_email = {user_email} where id = {id}", paramPO);
// 采用 ? 占位符的写法
int result = JDBCTemplate.get().exec("update xt_message_board set user_name = ? , user_email = ? where id = ?", new Object[]{"testTx222","testTx222@qq.com", 4});
ParamPO paramPO = new ParamPO();
paramPO.setId(5);
paramPO.setUserName("a");
// 采用{}占位符的写法
List<ParamPO> result = JDBCTemplate.get("dataSource").selectList("select * from xt_message_board where id > {id} and user_name != {user_name}", paramPO, ParamPO.class);
// 采用 ? 占位符的写法
List<ParamPO> result = JDBCTemplate.get("dataSource").selectList("select * from xt_message_board where id > ? and user_name != ?", new Object[]{5, "a"}, ParamPO.class);
// 查询条件
ParamPO paramPO = new ParamPO();
paramPO.setId(5);
paramPO.setUserName("a");
// 查询参数
PageParamModel pageParamModel = new PageParamModel();
pageParamModel.setCurrentPage(1);
pageParamModel.setPageSize(10);
pageParamModel.setParam(paramPO);
// 使用默认countSql查询
PageModel<ParamPO> pageModel = JDBCTemplate.get().selectPage("select * from xt_message_board where id > {id} and user_name != {user_name}", pageParamModel, ParamPO.class);
// 使用自定义countSql查询
String countSql = "自己定义countSql";
PageModel<ParamPO> pageModel = JDBCTemplate.get().selectPageCustomCountSql("select * from xt_message_board where id > {id} and user_name != {user_name}", countSql, pageParamModel, ParamPO.class);
// 开启事务
TransactionManager.beginTraction();
try {
ParamPO paramPO = new ParamPO();
paramPO.setUserName("testTx222");
paramPO.setUserEmail("testTx222@qq.com");
paramPO.setId(4);
int result = JDBCTemplate.get().exec("update xt_message_board set user_name = {user_name} , user_email = {user_email} where id = {id}", paramPO);
// 提交
TransactionManager.commit();
} catch(Execption e){
// 回滚
TransactionManager.rollback();
}
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。
Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。
Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。
Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。