<?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.cool.store.mapper.HyPhoneLocationMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.HyPhoneLocationDO">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
    <result column="phone_address" jdbcType="VARCHAR" property="phoneAddress" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, phone_number, phone_address, create_time, update_time
  </sql>
  <select id="selectByPhoneNumber" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"></include>
    from hy_phone_location
    where phone_number = #{phoneNumber}
  </select>
  <insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
    insert into hy_phone_location
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="record.phoneNumber != null">
        phone_number,
      </if>
      <if test="record.phoneAddress != null">
        phone_address,
      </if>
      <if test="record.createTime != null">
        create_time,
      </if>
      <if test="record.updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="record.phoneNumber != null">
        #{record.phoneNumber},
      </if>
      <if test="record.phoneAddress != null">
        #{record.phoneAddress},
      </if>
      <if test="record.createTime != null">
        #{record.createTime},
      </if>
      <if test="record.updateTime != null">
        #{record.updateTime},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective">
    update hy_phone_location
    <set>
      <if test="phoneNumber != null">
        phone_number = #{phoneNumber},
      </if>
      <if test="phoneAddress != null">
        phone_address = #{phoneAddress},
      </if>
      <if test="createTime != null">
        create_time = #{createTime},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime},
      </if>
    </set>
    where id = #{id}
  </update>
</mapper>