当前位置: 首页 > news >正文

MoreTable 方法selectWithFun,count 使用实例

ORM Bee,

example for MoreTable methods:selectWithFun,count 

ORM Bee时, MoreTable 方法selectWithFun,count 使用实例

package org.teasoft.exam.bee.osql;import org.teasoft.bee.osql.BeeException;
import org.teasoft.bee.osql.FunctionType;
import org.teasoft.bee.osql.api.Condition;
import org.teasoft.bee.osql.api.MoreTable;
import org.teasoft.exam.bee.osql.moretable.entity.Assignexam;
import org.teasoft.honey.osql.core.BeeFactory;
import org.teasoft.honey.osql.core.BeeFactoryHelper;
import org.teasoft.honey.osql.core.Logger;
import org.teasoft.honey.osql.shortcut.BF;/*** example for MoreTable methods:selectWithFun,count * @author Kingstar*/
public class MoreTableFun {public static void main(String[] args) {test();}public static void test() {try {MoreTable moreTable = BeeFactory.getHoneyFactory().getMoreTable();Condition distinctCondition0 = BeeFactoryHelper.getCondition();distinctCondition0.selectDistinctField("assignexam.id")//	.selectFun(FunctionType.MAX, "assignexam.id")//	.selectField("assignexam.id");
//			 List<Assignexam> list=moreTable.select(new Assignexam(), distinctCondition0);
//			 Printer.printList(list);//V2.4.0Condition funCondition =BF.getCondition();
//			 funCondition.selectFun(FunctionType.COUNT, "Assignexam.id", "count1");
//			 funCondition.selectFun(FunctionType.MIN, "Assignexam.id", "count1");
//			 funCondition.selectFun(FunctionType.COUNT, "*", "count1");funCondition.selectFun(FunctionType.COUNT, "*");String fun0= moreTable.selectWithFun(new Assignexam(),funCondition);Logger.info(fun0);funCondition.selectFun(FunctionType.COUNT, "*");String fun= moreTable.selectWithFun(new Assignexam(),BF.getCondition().selectFun(FunctionType.MAX, "Assignexam.id"));int fun2= moreTable.count(new Assignexam());Logger.info(fun2);int fun4= moreTable.count(new Assignexam(),BF.getCondition());Logger.info(fun4);//			 moreTable.selectWithFun(new Assignexam(),BF.getCondition()); //test exception
//			 Condition c3=BF.getCondition();
//			 c3.selectFun(FunctionType.COUNT, "*");
//			 c3.selectFun(FunctionType.MAX, "Assignexam.id");
//			 moreTable.selectWithFun(new Assignexam(),c3);  //test exception} catch (BeeException e) {e.printStackTrace();Logger.error("In MoreTableFun (BeeException):" + e.getMessage());} catch (Exception e) {Logger.error("In MoreTableFun (Exception):" + e.getMessage());e.printStackTrace();}}}

日志:

[Bee] LoggerFactory Use the Logger is : org.teasoft.honey.logging.SystemLogger
[Bee] The current Level in SystemLogger is :debug
[INFO] [Bee] ========= BeeInitPreLoadService initLoad...
[INFO] [Bee] ========= Preload class PreLoadInit, load...
[INFO] [Bee] ========= Preload class ExtPreLoadInit, load...
[INFO] [Bee] -------- Bee    2.4.0 -------- 
[INFO] [Bee] -------- Honey  2.4.0 -------- 
[INFO] [Bee] -------- BeeExt 2.4.0 -------- 
[DEBUG] [Bee] ========= Bee    buildId  2.4.0.6
[DEBUG] [Bee] ========= Honey  buildId  2.4.0.6
[DEBUG] [Bee] ========= BeeExt buildId  2.4.0.6
[DEBUG] The name is '*' , does not conform to naming conventions!
[INFO] [Bee] ========= get the dbName via url is: MySQL
[WARN] Do not set the database info: bee.db.driverName do not config; 
[DEBUG] Use OriginalConn!
[INFO] [Bee] select SQL: select count(*) from assignexam,assigncourse where assignexam.classno=assigncourse.classno and assignexam.term=assigncourse.term and assignexam.subjectno=assigncourse.subjectno
[INFO] 2
[DEBUG] The name is '*' , does not conform to naming conventions!
[INFO] [Bee] select SQL: select max(Assignexam.id) from assignexam,assigncourse where assignexam.classno=assigncourse.classno and assignexam.term=assigncourse.term and assignexam.subjectno=assigncourse.subjectno
[DEBUG] The name is '*' , does not conform to naming conventions!
[INFO] [Bee] ==========get from Cache.
[INFO] [Bee] select SQL: select count(*) from assignexam,assigncourse where assignexam.classno=assigncourse.classno and assignexam.term=assigncourse.term and assignexam.subjectno=assigncourse.subjectno
[INFO] 2
[DEBUG] The name is '*' , does not conform to naming conventions!
[INFO] [Bee] ==========get from Cache.
[INFO] [Bee] select SQL: select count(*) from assignexam,assigncourse where assignexam.classno=assigncourse.classno and assignexam.term=assigncourse.term and assignexam.subjectno=assigncourse.subjectno
[INFO] 2

http://www.lryc.cn/news/369111.html

相关文章:

  • 【SpringBoot】在Spring中使用自定义条件类在Java声明Bean时实现条件注入
  • 网卡聚合链路配置
  • PlantSimulation导入cad图作为背景
  • 【大模型】个人对大模型选择的见解
  • java的反射和python的鸭子类型
  • 爬虫工具yt-dlp
  • 【代码随想录训练营】【Day 50】【动态规划-9】| Leetcode 198, 213, 337
  • 源码讲解kafka 如何使用零拷贝技术(zero-copy)
  • Ubuntu20.04配置qwen0.5B记录
  • java自学阶段二:JavaWeb开发--day80(项目实战2之苍穹外卖)
  • HPUX系统Oracle RAC如何添加ASM磁盘
  • Jmeter 压力测测试的简单入门
  • N叉树的层序遍历-力扣
  • 解决阿里云的端口添加安全组仍然无法扫描到
  • 【因果推断python】26_双重稳健估计1
  • C语言 图形化界面方式连接MySQL【C/C++】【图形化界面组件分享】
  • Unity DOTS技术(十五) 物理系统
  • Java线程安全
  • Solidity选择使用 require 语句还是条件语句结合手动触发 revert 操作?回滚交易和抛出异常如何选择?
  • SpringCloud 网关配置websocket
  • 基于JavaScript 实现近邻算法以及优化方案
  • 移动端适配和响应式页面中的常用单位
  • 麒麟v10系统arm64架构openssh9.7p1的rpm包
  • 刚刚❗️德勤2025校招暑期实习测评笔试SHL测评题库已发(答案)
  • python对视频进行帧处理以及裁减部分区域
  • Python栈的编程题目
  • ROS云课三分钟外传之CoppeliaSim_Edu_V4_1_0_Ubuntu16_04
  • day28回溯算法part04| 93.复原IP地址 78.子集 90.子集II
  • SpringBoot项目启动时“jar中没有主清单属性”异常
  • vAttention:用于在没有Paged Attention的情况下Serving LLM