SmartVehicleBlueKeyMapper.xml 13.4 KB
<?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="cn.com.glsx.smart.modules.mapper.SmartVehicleBlueKeyMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey">
    <!--@mbg.generated-->
    <!--@Table smart_vehicle_blue_key-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="sn" jdbcType="VARCHAR" property="sn" />
    <result column="crep_code" jdbcType="VARCHAR" property="crepCode" />
    <result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
    <result column="smart_lock_Mac" jdbcType="VARCHAR" property="smartLockMac" />
    <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
    <result column="key_name" jdbcType="VARCHAR" property="keyName" />
    <result column="is_delete" jdbcType="TINYINT" property="isDelete" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="mobile_code" jdbcType="VARCHAR" property="mobileCode" />
    <result column="peripheral_uuid" jdbcType="VARCHAR" property="peripheralUuid" />
    <result column="share_status" jdbcType="TINYINT" property="shareStatus" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--@mbg.generated-->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
<!--                <when test="criterion.listValue">-->
<!--                  and ${criterion.condition}-->
<!--                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">-->
<!--                    #{listItem}-->
<!--                  </foreach>-->
<!--                </when>-->
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--@mbg.generated-->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
<!--                <when test="criterion.listValue">-->
<!--                  and ${criterion.condition}-->
<!--                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">-->
<!--                    #{listItem}-->
<!--                  </foreach>-->
<!--                </when>-->
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, user_id, sn, crep_code, secret_key, smart_lock_Mac, car_number, key_name, is_delete, 
    create_time, mobile_code, peripheral_uuid, share_status
  </sql>
  <select id="selectByExample" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKeyExample" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from smart_vehicle_blue_key
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from smart_vehicle_blue_key
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from smart_vehicle_blue_key
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKeyExample">
    <!--@mbg.generated-->
    delete from smart_vehicle_blue_key
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into smart_vehicle_blue_key (user_id, sn, crep_code, 
      secret_key, smart_lock_Mac, car_number, 
      key_name, is_delete, create_time, 
      mobile_code, peripheral_uuid, share_status)
    values (#{userId,jdbcType=BIGINT}, #{sn,jdbcType=VARCHAR}, #{crepCode,jdbcType=VARCHAR}, 
      #{secretKey,jdbcType=VARCHAR}, #{smartLockMac,jdbcType=VARCHAR}, #{carNumber,jdbcType=VARCHAR}, 
      #{keyName,jdbcType=VARCHAR}, #{isDelete,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, 
      #{mobileCode,jdbcType=VARCHAR}, #{peripheralUuid,jdbcType=VARCHAR}, #{shareStatus,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into smart_vehicle_blue_key
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="sn != null">
        sn,
      </if>
      <if test="crepCode != null">
        crep_code,
      </if>
      <if test="secretKey != null">
        secret_key,
      </if>
      <if test="smartLockMac != null">
        smart_lock_Mac,
      </if>
      <if test="carNumber != null">
        car_number,
      </if>
      <if test="keyName != null">
        key_name,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="mobileCode != null">
        mobile_code,
      </if>
      <if test="peripheralUuid != null">
        peripheral_uuid,
      </if>
      <if test="shareStatus != null">
        share_status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="sn != null">
        #{sn,jdbcType=VARCHAR},
      </if>
      <if test="crepCode != null">
        #{crepCode,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="smartLockMac != null">
        #{smartLockMac,jdbcType=VARCHAR},
      </if>
      <if test="carNumber != null">
        #{carNumber,jdbcType=VARCHAR},
      </if>
      <if test="keyName != null">
        #{keyName,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        #{isDelete,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="mobileCode != null">
        #{mobileCode,jdbcType=VARCHAR},
      </if>
      <if test="peripheralUuid != null">
        #{peripheralUuid,jdbcType=VARCHAR},
      </if>

      <if test="shareStatus != null">
        #{shareStatus,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKeyExample" resultType="java.lang.Long">
    <!--@mbg.generated-->
    select count(*) from smart_vehicle_blue_key
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--@mbg.generated-->
    update smart_vehicle_blue_key
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.sn != null">
        sn = #{record.sn,jdbcType=VARCHAR},
      </if>
      <if test="record.crepCode != null">
        crep_code = #{record.crepCode,jdbcType=VARCHAR},
      </if>
      <if test="record.secretKey != null">
        secret_key = #{record.secretKey,jdbcType=VARCHAR},
      </if>
      <if test="record.smartLockMac != null">
        smart_lock_Mac = #{record.smartLockMac,jdbcType=VARCHAR},
      </if>
      <if test="record.carNumber != null">
        car_number = #{record.carNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.keyName != null">
        key_name = #{record.keyName,jdbcType=VARCHAR},
      </if>
      <if test="record.isDelete != null">
        is_delete = #{record.isDelete,jdbcType=TINYINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.mobileCode != null">
        mobile_code = #{record.mobileCode,jdbcType=VARCHAR},
      </if>
      <if test="record.peripheralUuid != null">
        peripheral_uuid = #{record.peripheralUuid,jdbcType=VARCHAR},
      </if>
      <if test="record.shareStatus != null">
        share_status = #{record.shareStatus,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--@mbg.generated-->
    update smart_vehicle_blue_key
    set id = #{record.id,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      sn = #{record.sn,jdbcType=VARCHAR},
      crep_code = #{record.crepCode,jdbcType=VARCHAR},
      secret_key = #{record.secretKey,jdbcType=VARCHAR},
      smart_lock_Mac = #{record.smartLockMac,jdbcType=VARCHAR},
      car_number = #{record.carNumber,jdbcType=VARCHAR},
      key_name = #{record.keyName,jdbcType=VARCHAR},
      is_delete = #{record.isDelete,jdbcType=TINYINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      mobile_code = #{record.mobileCode,jdbcType=VARCHAR},
      peripheral_uuid = #{record.peripheralUuid,jdbcType=VARCHAR},
      share_status = #{record.shareStatus,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey">
    <!--@mbg.generated-->
    update smart_vehicle_blue_key
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="sn != null">
        sn = #{sn,jdbcType=VARCHAR},
      </if>
      <if test="crepCode != null">
        crep_code = #{crepCode,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        secret_key = #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="smartLockMac != null">
        smart_lock_Mac = #{smartLockMac,jdbcType=VARCHAR},
      </if>
      <if test="carNumber != null">
        car_number = #{carNumber,jdbcType=VARCHAR},
      </if>
      <if test="keyName != null">
        key_name = #{keyName,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        is_delete = #{isDelete,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="mobileCode != null">
        mobile_code = #{mobileCode,jdbcType=VARCHAR},
      </if>
      <if test="peripheralUuid != null">
        peripheral_uuid = #{peripheralUuid,jdbcType=VARCHAR},
      </if>

      <if test="shareStatus != null">
        share_status = #{shareStatus,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.com.glsx.smart.modules.entity.SmartVehicleBlueKey">
    <!--@mbg.generated-->
    update smart_vehicle_blue_key
    set user_id = #{userId,jdbcType=BIGINT},
      sn = #{sn,jdbcType=VARCHAR},
      crep_code = #{crepCode,jdbcType=VARCHAR},
      secret_key = #{secretKey,jdbcType=VARCHAR},
      smart_lock_Mac = #{smartLockMac,jdbcType=VARCHAR},
      car_number = #{carNumber,jdbcType=VARCHAR},
      key_name = #{keyName,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      mobile_code = #{mobileCode,jdbcType=VARCHAR},
      peripheral_uuid = #{peripheralUuid,jdbcType=VARCHAR},
      share_status = #{shareStatus,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <update id="removeKeyByIds">
        update smart_vehicle_blue_key
        <set>
            is_delete = 1
        </set>
         where id in
        <foreach close=")" collection="list" index="index" item="keyId" open="(" separator=",">
            #{keyId}
        </foreach>
    </update>
</mapper>