<select id="getSumByAcctCodeAndDate" resultType="com.bestpay.accountsystem.job.vo.DealAmountVO">
select NVL( SUM (CASE WHEN DEAL_TYPE=${@com.bestpay.accountsystem.common.DealTypeEnum@EXPENSES.getType()} THEN TRS_AMOUNT
ELSE 0
END),0) sumExpenses,
NVL( SUM (CASE WHEN DEAL_TYPE=${@com.bestpay.accountsystem.common.DealTypeEnum@INCOME.getType()} THEN TRS_AMOUNT
ELSE 0
END),0) sumIncome
from T_EBK_DEALLOG_SNAPSHOT
where ACCT_CODE = #{acctCode,jdbcType=VARCHAR}
and SNAPSHOT_DAY = #{snapshotDate,jdbcType=VARCHAR}
</select>
第二种
public class TrainGroup extends AbstractEntity
private EnumTrainGroupType type;//0教研组 1协作组
映射和查询条件中不用任何特殊处理即可使用枚举。
<resultMap id="BaseResultMap" type="cn.com.teacher.cistus.dt.entity.TrainGroup" >
<result column="TYPE" property="type" jdbcType="INTEGER" />
。。。
<if test="type != null" >
TYPE = #{type,jdbcType=INTEGER},
</if>