<?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="com.flossom.common.core.mapper.IntegralGlobalMapper">

    <resultMap type="IntegralGlobal" id="IntegralGlobalResult">
        <result property="id"    column="id"    />
        <result property="integral"    column="integral"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectIntegralGlobalVo">
        select id, integral, create_time, create_by, update_by, update_time from integral_global
    </sql>

    <select id="selectIntegralGlobalList" parameterType="IntegralGlobal" resultMap="IntegralGlobalResult">
        <include refid="selectIntegralGlobalVo"/>
        <where>
            <if test="integral != null "> and integral = #{integral}</if>
        </where>
    </select>

    <select id="selectIntegralGlobalById" parameterType="Long" resultMap="IntegralGlobalResult">
        <include refid="selectIntegralGlobalVo"/>
        where id = #{id}
    </select>

    <insert id="insertIntegralGlobal" parameterType="IntegralGlobal">
        insert into integral_global
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="integral != null">integral,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="integral != null">#{integral},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateIntegralGlobal" parameterType="IntegralGlobal">
        update integral_global
        <trim prefix="SET" suffixOverrides=",">
            <if test="integral != null">integral = #{integral},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIntegralGlobalById" parameterType="Long">
        delete from integral_global where id = #{id}
    </delete>

    <delete id="deleteIntegralGlobalByIds" parameterType="String">
        delete from integral_global where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
