mybatis部分语法速查自用

choose-when

<choose>
		<when test="state == null">
			and type = 1
		</when>
		<when test="state != null">
			and type = 2
		</when>
		<otherwise>
			and type = 3
		</otherwise>
</choose>

加标签
<choose>
    <when test="param.moneyChargeDescList != null and param.moneyChargeDescList.size() > 0">
        AND(
        <trim prefixOverrides="or">
            <if test="param.moneyChargeDescList.contains('a')">
                (TEMP.process_type = 10 or TEMP.process_type is null)
            </if>
            <if test="param.moneyChargeDescList.contains('b')">
                or (TEMP.money_charge = 20 AND TEMP.process_type IN (20, 40))
            </if>
            <if test="param.moneyChargeDescList.contains('c')">
                or (TEMP.process_type = 30 or TEMP.process_type = 50)
            </if>
        </trim>
        )
    </when>
    <otherwise>
        AND NOT (TEMP.money_charge = 10 AND TEMP.process_type IN (20, 40))
    </otherwise>
</choose>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值