<?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.ssm.manage.mapper.SmsTypeMapper">

    <resultMap type="com.ssm.manage.entity.SmsType" id="baseMap">
        <result property="rechargeTypeNum" column="recharge_type_num" jdbcType="VARCHAR"/>
        <result property="rechargeTypeName" column="recharge_type_name" jdbcType="VARCHAR"/>
        <result property="state" column="state" jdbcType="INTEGER"/>
        <result property="id" column="id" jdbcType="BIGINT"/>
        <result property="type" column="type" jdbcType="INTEGER"/>
        <result property="rechargeMoney" column="recharge_money" jdbcType="DECIMAL"/>
        <result property="smsNumber" column="sms_number" jdbcType="INTEGER"/>
        <result property="giftNumber" column="gift_number" jdbcType="INTEGER"/>
        <result property="smsPrice" column="sms_price" jdbcType="DECIMAL"/>
        <result property="smsType" column="sms_type" jdbcType="INTEGER"/>
        <result property="inputStaff" column="input_staff" jdbcType="VARCHAR"/>
        <result property="inputDate" column="input_date" jdbcType="TIMESTAMP"/>
        <result property="updateStaff" column="update_staff" jdbcType="VARCHAR"/>
        <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/>
        <result property="startDate" column="start_date" jdbcType="TIMESTAMP"/>
        <result property="stopDate" column="stop_date" jdbcType="TIMESTAMP"/>
        <result property="startNumber" column="start_number" jdbcType="INTEGER"/>

    </resultMap>
    <update id="updateState">
        update sms_type set state = #{state},update_staff = #{updateStaff},update_date = #{updateDate} where id = #{id}
    </update>
    <update id="updateById" >
        UPDATE sms_type
        <set>
            <if test="id != null">id = #{id},</if>
            <if test="rechargeTypeNum != null">recharge_type_num = #{rechargeTypeNum},</if>
            <if test="rechargeTypeName != null">recharge_type_name = #{rechargeTypeName},</if>
            <if test="state != null">state = #{state},</if>
            <if test="type != null">type = #{type},</if>
            <if test="rechargeMoney != null">recharge_money = #{rechargeMoney},</if>
            <if test="smsNumber != null">sms_number = #{smsNumber},</if>
            <if test="giftNumber != null">gift_number = #{giftNumber},</if>
            <if test="smsPrice != null">sms_price = #{smsPrice},</if>
            <if test="smsType != null">sms_type = #{smsType},</if>
            <if test="inputStaff != null">input_staff = #{inputStaff},</if>
            <if test="inputDate != null">input_date = #{inputDate},</if>
            <if test="updateStaff != null">update_staff = #{updateStaff},</if>
            <if test="updateDate != null">update_date = #{updateDate},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="stopDate != null">stop_date = #{stopDate},</if>
            <if test="startNumber!=null"> start_number = #{startNumber},</if>
        </set>
        WHERE id = #{id}
    </update>

    <update id="updateByType" >
        UPDATE sms_type
        <set>
            recharge_money = #{rechargeMoney},
            sms_number = #{smsNumber},
            gift_number = #{giftNumber},
            sms_price = #{smsPrice},
            <if test="id != null">id = #{id},</if>
            <if test="rechargeTypeNum != null">recharge_type_num = #{rechargeTypeNum},</if>
            <if test="rechargeTypeName != null">recharge_type_name = #{rechargeTypeName},</if>
            <if test="state != null">state = #{state},</if>
            <if test="type != null">type = #{type},</if>
            <if test="smsType != null">sms_type = #{smsType},</if>
            <if test="inputStaff != null">input_staff = #{inputStaff},</if>
            <if test="inputDate != null">input_date = #{inputDate},</if>
            <if test="updateStaff != null">update_staff = #{updateStaff},</if>
            <if test="updateDate != null">update_date = #{updateDate},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="stopDate != null">stop_date = #{stopDate},</if>
            <if test="startNumber !=null">start_number =#{startNumber}</if>
        </set>
        WHERE id = #{id}
    </update>

    <delete id="deleteById">
        delete from sms_type where id = #{id}
    </delete>


</mapper>

