SmartVehicleBlueShareKeyMapper.xml 12.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="com.glsx.smart.dao.mapper.SmartVehicleBlueShareKeyMapper">
    <resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
        <!--@mbg.generated-->
        <!--@Table smart_vehicle_blue_share_key-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="car_key_id" jdbcType="BIGINT" property="carKeyId"/>
        <result column="share_key_token" jdbcType="VARCHAR" property="shareKeyToken"/>
        <result column="share_pick_status" jdbcType="TINYINT" property="sharePickStatus"/>
        <result column="pick_user_id" jdbcType="BIGINT" property="pickUserId"/>
        <result column="pick_time" jdbcType="TIMESTAMP" property="pickTime"/>
        <result column="share_status" jdbcType="TINYINT" property="shareStatus"/>
        <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
    </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, car_key_id, share_key_token, share_pick_status, pick_user_id, pick_time, share_status,
        expire_time
    </sql>
    <select id="selectByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"
            resultMap="BaseResultMap">
        <!--@mbg.generated-->
    select

        <if test="distinct">

      distinct

        </if>
        <include refid="Base_Column_List"/>

    from smart_vehicle_blue_share_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_share_key
    where id = #{id,jdbcType=BIGINT}

    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
    delete from smart_vehicle_blue_share_key
    where id = #{id,jdbcType=BIGINT}

    </delete>
    <delete id="deleteByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample">
        <!--@mbg.generated-->
    delete from smart_vehicle_blue_share_key

        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey" useGeneratedKeys="true">
        <!--@mbg.generated-->
    insert into smart_vehicle_blue_share_key (car_key_id, share_key_token, share_pick_status, 
      pick_user_id, pick_time, share_status, 
      expire_time)
    values (#{carKeyId,jdbcType=BIGINT}, #{shareKeyToken,jdbcType=VARCHAR}, #{sharePickStatus,jdbcType=TINYINT}, 
      #{pickUserId,jdbcType=BIGINT}, #{pickTime,jdbcType=TIMESTAMP}, #{shareStatus,jdbcType=TINYINT}, 
      #{expireTime,jdbcType=TIMESTAMP})

    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey" useGeneratedKeys="true">
        <!--@mbg.generated-->
    insert into smart_vehicle_blue_share_key

        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="carKeyId != null">
                car_key_id,

            </if>
            <if test="shareKeyToken != null">

        share_key_token,

            </if>
            <if test="sharePickStatus != null">

        share_pick_status,

            </if>
            <if test="pickUserId != null">

        pick_user_id,

            </if>
            <if test="pickTime != null">

        pick_time,

            </if>
            <if test="shareStatus != null">

        share_status,

            </if>
            <if test="expireTime != null">

        expire_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="carKeyId != null">
                #{carKeyId,jdbcType=BIGINT},

            </if>
            <if test="shareKeyToken != null">

        #{shareKeyToken,jdbcType=VARCHAR},

            </if>
            <if test="sharePickStatus != null">

        #{sharePickStatus,jdbcType=TINYINT},

            </if>
            <if test="pickUserId != null">

        #{pickUserId,jdbcType=BIGINT},

            </if>
            <if test="pickTime != null">

        #{pickTime,jdbcType=TIMESTAMP},

            </if>
            <if test="shareStatus != null">

        #{shareStatus,jdbcType=TINYINT},

            </if>
            <if test="expireTime != null">

        #{expireTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKeyExample"
            resultType="java.lang.Long">
        <!--@mbg.generated-->
    select count(*) from smart_vehicle_blue_share_key

        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </select>
    <update id="updateByExampleSelective" parameterType="map">
        <!--@mbg.generated-->
    update smart_vehicle_blue_share_key

        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=BIGINT},

            </if>
            <if test="record.carKeyId != null">

        car_key_id = #{record.carKeyId,jdbcType=BIGINT},

            </if>
            <if test="record.shareKeyToken != null">

        share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},

            </if>
            <if test="record.sharePickStatus != null">

        share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},

            </if>
            <if test="record.pickUserId != null">

        pick_user_id = #{record.pickUserId,jdbcType=BIGINT},

            </if>
            <if test="record.pickTime != null">

        pick_time = #{record.pickTime,jdbcType=TIMESTAMP},

            </if>
            <if test="record.shareStatus != null">

        share_status = #{record.shareStatus,jdbcType=TINYINT},

            </if>
            <if test="record.expireTime != null">

        expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
            </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_share_key
    set id = #{record.id,jdbcType=BIGINT},
      car_key_id = #{record.carKeyId,jdbcType=BIGINT},
      share_key_token = #{record.shareKeyToken,jdbcType=VARCHAR},
      share_pick_status = #{record.sharePickStatus,jdbcType=TINYINT},
      pick_user_id = #{record.pickUserId,jdbcType=BIGINT},
      pick_time = #{record.pickTime,jdbcType=TIMESTAMP},
      share_status = #{record.shareStatus,jdbcType=TINYINT},
      expire_time = #{record.expireTime,jdbcType=TIMESTAMP}

        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
        <!--@mbg.generated-->
    update smart_vehicle_blue_share_key

        <set>
            <if test="carKeyId != null">
                car_key_id = #{carKeyId,jdbcType=BIGINT},

            </if>
            <if test="shareKeyToken != null">

        share_key_token = #{shareKeyToken,jdbcType=VARCHAR},

            </if>
            <if test="sharePickStatus != null">

        share_pick_status = #{sharePickStatus,jdbcType=TINYINT},

            </if>
            <if test="pickUserId != null">

        pick_user_id = #{pickUserId,jdbcType=BIGINT},

            </if>
            <if test="pickTime != null">

        pick_time = #{pickTime,jdbcType=TIMESTAMP},

            </if>
            <if test="shareStatus != null">

        share_status = #{shareStatus,jdbcType=TINYINT},

            </if>
            <if test="expireTime != null">

        expire_time = #{expireTime,jdbcType=TIMESTAMP},
            </if>
        </set>

    where id = #{id,jdbcType=BIGINT}

    </update>
    <update id="updateByPrimaryKey" parameterType="com.glsx.smart.dao.entity.SmartVehicleBlueShareKey">
        <!--@mbg.generated-->
    update smart_vehicle_blue_share_key
    set car_key_id = #{carKeyId,jdbcType=BIGINT},
      share_key_token = #{shareKeyToken,jdbcType=VARCHAR},
      share_pick_status = #{sharePickStatus,jdbcType=TINYINT},
      pick_user_id = #{pickUserId,jdbcType=BIGINT},
      pick_time = #{pickTime,jdbcType=TIMESTAMP},
      share_status = #{shareStatus,jdbcType=TINYINT},
      expire_time = #{expireTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}

    </update>

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