使用ORM Bee时, Condition, SuidRich的方法中, 字段是否支持使用Orders::getName的形式,避免使用静态字段串写死字段值

202 篇文章 0 订阅
165 篇文章 2 订阅

使用ORM Bee时, Condition, SuidRich的方法中, 字段是否支持使用Orders::getName的形式,避免使用静态字段串写死字段值.

可以使用V2.4.0 的ConditionExt和SuidRichExt

需要引用BeeExt.

示例代码如下:

package org.teasoft.exam.bee.osql.ext24;

import org.teasoft.bee.osql.Op;
import org.teasoft.bee.osql.api.SuidRich;
import org.teasoft.beex.osql.api.ConditionExt;
import org.teasoft.beex.osql.api.SuidRichExt;
import org.teasoft.beex.osql.shortcut.BFX;
import org.teasoft.exam.bee.osql.entity.Orders;
import org.teasoft.honey.osql.shortcut.BF;

/**
 * @author Kingstar
 * @since  2.4.0
 */
public class TestBFX {
	
	public static void main(String[] args) {
		ConditionExt conditionExt=BFX.getConditionExt();
		conditionExt.op(Orders::getAbc, Op.eq, "value11");
		SuidRich suidRich=BF.getSuidRich();
		suidRich.count(new Orders(), conditionExt);
		
		conditionExt.selectField(Orders::getAbc,Orders::getRemark);
		suidRich.select(new Orders(), conditionExt);
		
		
		SuidRichExt suidRichExt=BFX.getSuidRichExt();
		suidRichExt.select(new Orders(),Orders::getAbc,Orders::getRemark);
		
	}
	

}

日志:

[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
[INFO] [Bee] ========= get the dbName via url is: MySQL
[INFO] [Bee] select fun SQL : select count(*) from orders where abc=?   [values]: value11(String)
[INFO] [Bee] select fun SQL :  ( ExecutableSql )
select count(*) from orders where abc='value11' ;
[WARN] Do not set the database info: bee.db.driverName do not config; 
[DEBUG] Use OriginalConn!
[INFO] [Bee] select SQL: select abc, remark from orders where abc=?   [values]: value11(String)
[INFO] [Bee] select SQL:  ( ExecutableSql )
select abc, remark from orders where abc='value11' ;
[INFO] [Bee]  | <--  select rows: 0
[INFO] [Bee] select SQL(selectFields) : select abc, remark from orders   [values]: 
[INFO] [Bee] select SQL(selectFields) :  ( ExecutableSql )
select abc, remark from orders
[INFO] [Bee]  | <--  select rows: 2

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值