<?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.buy507.mall.mapper.DmsTeamTotalConsumeMapper">
  <resultMap id="BaseResultMap" type="com.buy507.mall.model.DmsTeamTotalConsume">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="member_id" jdbcType="BIGINT" property="memberId" />
    <result column="value" jdbcType="DECIMAL" property="value" />
  </resultMap>
  
  <select id="selectOneByMemberId" parameterType="java.lang.Long" resultMap="BaseResultMap">
    SELECT *
      FROM dms_team_total_consume
     WHERE member_id = #{memberId}
  </select>
  
  <insert id="insert" parameterType="com.buy507.mall.model.DmsTeamTotalConsume">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into dms_team_total_consume (member_id, value)
    values (#{memberId,jdbcType=BIGINT}, #{value,jdbcType=DECIMAL})
  </insert>
  
  <update id="updateById" parameterType="com.buy507.mall.model.DmsTeamTotalConsume">
    update dms_team_total_consume
       set value = #{value,jdbcType=DECIMAL}
     where id = #{id,jdbcType=BIGINT}
  </update>  
  
</mapper>