<?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="cn.wisenergy.mapper.CultivatingPrizeMapper">
    <resultMap id="bankMap" type="cn.wisenergy.model.app.CultivatingPrize">
        <id column="id" property="id"/>
        <result column="user_level" property="userLevel"/>
        <result column="cultivating_prize" property="cultivatingPrize"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="table">
        cultivating_prize
    </sql>

    <sql id="cols_all">
        id,
        <include refid="cols_exclude_id"/>
    </sql>

    <sql id="cols_exclude_id">
        user_level,cultivating_prize,create_time,update_time
    </sql>

    <sql id="vals">
        #{userLevel},#{cultivatingPrize},now(),now()
    </sql>

    <sql id="updateCondition">
        <if test="userLevel != null">user_level = #{userLevel},</if>
        <if test="cultivatingPrize != null">cultivating_prize = #{cultivatingPrize},</if>
        update_time =now()
    </sql>

    <sql id="criteria">
        <if test="id != null">id = #{id}</if>
        <if test="userLevel != null">and user_level = #{userLevel}</if>
        <if test="cultivatingPrize != null">and cultivating_prize = #{cultivatingPrize}</if>
        <if test="createTime != null">and create_time &gt;= #{createTime}</if>
        <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
    </sql>

    <select id="getcultivatingPrizeByUserLevel" resultType="cn.wisenergy.model.app.CultivatingPrize">
        select
        <include refid="cols_all"/>
        from
        <include refid="table"/>
        <where>
            user_level = #{userLevel}
        </where>
    </select>

</mapper>