<?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.ym.mec.biz.dal.dao.TenantProductInfoDao">

    <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantProductInfo">
        <id column="id_" jdbcType="INTEGER" property="id"/>
        <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
        <result column="serve_id_" jdbcType="INTEGER" property="serveId"/>
        <result column="serve_detail_id_" jdbcType="INTEGER" property="serveDetailId"/>
        <result column="original_price_" jdbcType="VARCHAR" property="originalPrice"/>
        <result column="contract_price_" jdbcType="VARCHAR" property="contractPrice"/>
        <result column="pay_amount_" jdbcType="VARCHAR" property="payAmount"/>
        <result column="pay_date_" jdbcType="TIMESTAMP" property="payDate"/>
        <result column="expiry_count_" jdbcType="INTEGER" property="expiryCount"/>
        <result column="expiry_unit_" jdbcType="VARCHAR" property="expiryUnit"/>
        <result column="expiry_date_" jdbcType="TIMESTAMP" property="expiryDate"/>
        <result column="using_" jdbcType="INTEGER" property="using"/>
    </resultMap>

    <sql id="Base_Column_List">
        id_
        , tenant_id_, serve_id_, serve_detail_id_, original_price_, contract_price_, pay_amount_, pay_date_, expiry_count_, expiry_unit_, expiry_date_, using_
    </sql>

    <update id="updateByTenantId" parameterType="com.ym.mec.biz.dal.entity.TenantProductInfo">
        update tenant_product_info
        <set>
            <if test="serveId != null">
                serve_id_ = #{serveId,jdbcType=INTEGER},
            </if>
            <if test="serveDetailId != null">
                serve_detail_id_ = #{serveDetailId,jdbcType=INTEGER},
            </if>
            <if test="originalPrice != null">
                original_price_ = #{originalPrice,jdbcType=VARCHAR},
            </if>
            <if test="contractPrice != null">
                contract_price_ = #{contractPrice,jdbcType=VARCHAR},
            </if>
            <if test="payAmount != null">
                pay_amount_ = #{payAmount,jdbcType=VARCHAR},
            </if>
            <if test="payDate != null">
                pay_date_ = #{payDate,jdbcType=TIMESTAMP},
            </if>
            <if test="expiryCount != null">
                expiry_count_ = #{expiryCount,jdbcType=INTEGER},
            </if>
            <if test="expiryUnit != null">
                expiry_unit_ = #{expiryUnit,jdbcType=VARCHAR},
            </if>
            <if test="expiryDate != null">
                expiry_date_ = #{expiryDate,jdbcType=TIMESTAMP},
            </if>
            <if test="using != null">
                using_ = #{using,jdbcType=INTEGER},
            </if>
        </set>
        where tenant_id_ = #{tenantId,jdbcType=INTEGER} and using_ = 0
    </update>

</mapper>