<?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.ruoyi.mall.mapper.MallTargetMapper">
    
    <resultMap type="MallTarget" id="MallTargetResult">
        <result property="monthTarget"    column="month_target"    />
        <result property="yearTarget"    column="year_target"    />
        <result property="updateAt"    column="update_at"    />
        <result property="id"    column="id"    />
    </resultMap>

    <sql id="selectMallTargetVo">
        select month_target, year_target, update_at, id from mall_target
    </sql>

    <select id="selectMallTargetList" parameterType="MallTarget" resultMap="MallTargetResult">
        <include refid="selectMallTargetVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectMallTargetById" parameterType="Integer" resultMap="MallTargetResult">
        <include refid="selectMallTargetVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMallTarget" parameterType="MallTarget" useGeneratedKeys="true" keyProperty="id">
        insert into mall_target
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="monthTarget != null">month_target,</if>
            <if test="yearTarget != null">year_target,</if>
            <if test="updateAt != null">update_at,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="monthTarget != null">#{monthTarget},</if>
            <if test="yearTarget != null">#{yearTarget},</if>
            <if test="updateAt != null">#{updateAt},</if>
         </trim>
    </insert>

    <update id="updateMallTarget" parameterType="MallTarget">
        update mall_target
        <trim prefix="SET" suffixOverrides=",">
            <if test="monthTarget != null">month_target = #{monthTarget},</if>
            <if test="yearTarget != null">year_target = #{yearTarget},</if>
            <if test="updateAt != null">update_at = #{updateAt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMallTargetById" parameterType="Integer">
        delete from mall_target where id = #{id}
    </delete>

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