我寫下了下面的代碼。我知道這是錯誤的,但我不知道如何做同樣的事情。我會感謝任何幫助。用if創建一個Mybatis查詢
<select id="getSeqTempByRulesCabN3" resultType="java.lang.Integer" >
select templat.seq_temp
from re_t_vp_voucher_template templat, re_t_vp_voucher_rules rules_t, re_t_vp_voucher_rules_pais pais
where templat.seq_temp = rules_t.seq_temp
and rules_t.SEQ_RULE = PAIS.SEQ_RULE
<if test="(select count(*) as cuenta
from re_t_vp_voucher_template templat, re_t_vp_voucher_rules rules_t, re_t_vp_voucher_rules_pais pais
where templat.seq_temp = rules_t.seq_temp
and rules_t.SEQ_RULE = PAIS.SEQ_RULE
AND rules_t.seq_rec is not null
and rules_t.seq_rec = #{seqRec, jdbcType=DECIMAL}
group by templat.seq_temp, rules_t.fec_desde_res, rules_t.cod_idioma) != 0">
and rules_t.seq_rec = #{seqRec, jdbcType=DECIMAL}
</if>
and rules_t.seq_ttoo = #{seqTtoo, jdbcType=DECIMAL}
group by templat.seq_temp, rules_t.fec_desde_res, rules_t.cod_idioma
</select>
您可以添加錯誤日誌在這裏呢?另外,從沒有向select標籤傳入任何參數,從哪裏獲取值#{seqRec}和#{seqTtoo}? – Akhil 2014-09-23 19:57:51