首页 > 编程语言 >mybatis OGNL表达式,xml查询中使用java的变量值

mybatis OGNL表达式,xml查询中使用java的变量值

时间:2023-04-02 17:36:28浏览次数:46  
标签:xml java ad space EAd mgt OGNL constant id

1、参考

struts2 ongl 访问静态变量与访问枚举

Ognl表达式基本原理和使用方法

2、java类

package org.jeecg.mgt.cms.constant;
public class EAd {
    public static final Integer show1 = 1;

    public static final class AA {
        public static final Integer show2 = 1;
    }
}

3、xml

@org.jeecg.mgt.cms.constant.EAd@show1

@全类名@变量名

@org.jeecg.mgt.cms.constant.EAd$AA@show2

@全类名$静态类名@变量名

	<select id="listQuery2" resultType="java.util.Map">
		SELECT
		ad_space.id AS id,
		ad_space.name AS name,
		ad_space.block AS block,
		ad_space.height,
		ad_space.width,
		ad_space.enable_channel_tag,
-- 		(SELECT COUNT(*) FROM ad WHERE ad.space_id = ad_space.id AND ad.display_state = ${@org.jeecg.mgt.cms.constant.EAd@show1}) AS showing_qty
		(SELECT COUNT(*) FROM ad WHERE ad.space_id = ad_space.id AND ad.display_state = ${@org.jeecg.mgt.cms.constant.EAd$AA@show2}) AS showing_qty
		FROM
		ad_space
		ORDER BY ad_space.sort,ad_space.id
	</select>

标签:xml,java,ad,space,EAd,mgt,OGNL,constant,id
From: https://www.cnblogs.com/kikyoqiang/p/17280831.html

相关文章