<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.zjk.mapper.ZjkPointRewardMapper">

    <resultMap id="BaseResultMap" type="org.dromara.zjk.domain.ZjkPointReward">
            <result property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="rewardName" column="reward_name" jdbcType="VARCHAR"/>
            <result property="rewardType" column="reward_type" jdbcType="OTHER"/>
            <result property="rewardContent" column="reward_content" jdbcType="VARCHAR"/>
            <result property="rewardObj" column="reward_obj" jdbcType="OTHER"/>
            <result property="effectFlag" column="effect_flag" jdbcType="OTHER"/>
            <result property="effectStandard" column="effect_standard" jdbcType="NUMERIC"/>
            <result property="rewardUntil" column="reward_until" jdbcType="TIMESTAMP"/>
            <result property="isForever" column="is_forever" jdbcType="VARCHAR"/>
            <result property="createDept" column="create_dept" jdbcType="VARCHAR"/>
            <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
            <result property="status" column="status" jdbcType="OTHER"/>
            <result property="createBy" column="CREATE_BY" jdbcType="BIGINT"/>
            <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
            <result property="updateBy" column="UPDATE_BY" jdbcType="BIGINT"/>
            <result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        ID,reward_name,reward_type,
        reward_content,reward_obj,effect_flag,
        effect_standard,reward_until,is_forever,
        create_dept,tenant_id,status,
        CREATE_BY,CREATE_TIME,UPDATE_BY,
        UPDATE_TIME
    </sql>
    <select id="getAbleReward" resultType="org.dromara.zjk.domain.ZjkPointReward">
        select * from zjk_point_reward where status=1 and (is_forever=1 or reward_until >= CURRENT_DATE)
    </select>
</mapper>
