package cn.skcks.matrix.v2.orm.mybatis.basic.mapper;

import cn.skcks.matrix.v2.orm.mybatis.basic.model.LocationRecord;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface LocationRecordMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table location_record
     *
     * @mbg.generated
     */
    @Delete({
        "delete from location_record",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table location_record
     *
     * @mbg.generated
     */
    @Insert({
        "insert into location_record (id, callback_time, ",
        "location_time, location_type, ",
        "latitude, longitude, ",
        "accuracy, altitude, ",
        "bearing, speed, country, ",
        "province, city, ",
        "district, street, ",
        "street_number, city_code, ",
        "ad_code, address, ",
        "description, user_id)",
        "values (#{id,jdbcType=VARCHAR}, #{callbackTime,jdbcType=TIMESTAMP}, ",
        "#{locationTime,jdbcType=TIMESTAMP}, #{locationType,jdbcType=INTEGER}, ",
        "#{latitude,jdbcType=DOUBLE}, #{longitude,jdbcType=DOUBLE}, ",
        "#{accuracy,jdbcType=DOUBLE}, #{altitude,jdbcType=DOUBLE}, ",
        "#{bearing,jdbcType=DOUBLE}, #{speed,jdbcType=DOUBLE}, #{country,jdbcType=VARCHAR}, ",
        "#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ",
        "#{district,jdbcType=VARCHAR}, #{street,jdbcType=VARCHAR}, ",
        "#{streetNumber,jdbcType=VARCHAR}, #{cityCode,jdbcType=VARCHAR}, ",
        "#{adCode,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT})"
    })
    int insert(LocationRecord row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table location_record
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, callback_time, location_time, location_type, latitude, longitude, accuracy, ",
        "altitude, bearing, speed, country, province, city, district, street, street_number, ",
        "city_code, ad_code, address, description, user_id",
        "from location_record",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="callback_time", property="callbackTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="location_time", property="locationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="location_type", property="locationType", jdbcType=JdbcType.INTEGER),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="accuracy", property="accuracy", jdbcType=JdbcType.DOUBLE),
        @Result(column="altitude", property="altitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="bearing", property="bearing", jdbcType=JdbcType.DOUBLE),
        @Result(column="speed", property="speed", jdbcType=JdbcType.DOUBLE),
        @Result(column="country", property="country", jdbcType=JdbcType.VARCHAR),
        @Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
        @Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
        @Result(column="district", property="district", jdbcType=JdbcType.VARCHAR),
        @Result(column="street", property="street", jdbcType=JdbcType.VARCHAR),
        @Result(column="street_number", property="streetNumber", jdbcType=JdbcType.VARCHAR),
        @Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="ad_code", property="adCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
    })
    LocationRecord selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table location_record
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, callback_time, location_time, location_type, latitude, longitude, accuracy, ",
        "altitude, bearing, speed, country, province, city, district, street, street_number, ",
        "city_code, ad_code, address, description, user_id",
        "from location_record"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="callback_time", property="callbackTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="location_time", property="locationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="location_type", property="locationType", jdbcType=JdbcType.INTEGER),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="accuracy", property="accuracy", jdbcType=JdbcType.DOUBLE),
        @Result(column="altitude", property="altitude", jdbcType=JdbcType.DOUBLE),
        @Result(column="bearing", property="bearing", jdbcType=JdbcType.DOUBLE),
        @Result(column="speed", property="speed", jdbcType=JdbcType.DOUBLE),
        @Result(column="country", property="country", jdbcType=JdbcType.VARCHAR),
        @Result(column="province", property="province", jdbcType=JdbcType.VARCHAR),
        @Result(column="city", property="city", jdbcType=JdbcType.VARCHAR),
        @Result(column="district", property="district", jdbcType=JdbcType.VARCHAR),
        @Result(column="street", property="street", jdbcType=JdbcType.VARCHAR),
        @Result(column="street_number", property="streetNumber", jdbcType=JdbcType.VARCHAR),
        @Result(column="city_code", property="cityCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="ad_code", property="adCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT)
    })
    List<LocationRecord> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table location_record
     *
     * @mbg.generated
     */
    @Update({
        "update location_record",
        "set callback_time = #{callbackTime,jdbcType=TIMESTAMP},",
          "location_time = #{locationTime,jdbcType=TIMESTAMP},",
          "location_type = #{locationType,jdbcType=INTEGER},",
          "latitude = #{latitude,jdbcType=DOUBLE},",
          "longitude = #{longitude,jdbcType=DOUBLE},",
          "accuracy = #{accuracy,jdbcType=DOUBLE},",
          "altitude = #{altitude,jdbcType=DOUBLE},",
          "bearing = #{bearing,jdbcType=DOUBLE},",
          "speed = #{speed,jdbcType=DOUBLE},",
          "country = #{country,jdbcType=VARCHAR},",
          "province = #{province,jdbcType=VARCHAR},",
          "city = #{city,jdbcType=VARCHAR},",
          "district = #{district,jdbcType=VARCHAR},",
          "street = #{street,jdbcType=VARCHAR},",
          "street_number = #{streetNumber,jdbcType=VARCHAR},",
          "city_code = #{cityCode,jdbcType=VARCHAR},",
          "ad_code = #{adCode,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "user_id = #{userId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(LocationRecord row);
}
