<?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.reptileclient.jlifeapp.dao.qg.JzOrderQgMapper">
    <resultMap id="BaseResultMap" type="com.reptileclient.jlifeapp.entity.qg.JzOrderQg">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="order_sn" property="orderSn" jdbcType="VARCHAR"/>
        <result column="goods" property="goods" jdbcType="VARCHAR"/>
        <result column="city" property="city" jdbcType="VARCHAR"/>
        <result column="order_label" property="orderLabel" jdbcType="VARCHAR"/>
        <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/>
        <result column="user_name" property="userName" jdbcType="VARCHAR"/>
        <result column="user_phone" property="userPhone" jdbcType="VARCHAR"/>
        <result column="address" property="address" jdbcType="VARCHAR"/>
        <result column="user_book_time" property="userBookTime" jdbcType="VARCHAR"/>
        <result column="real_book_time" property="realBookTime" jdbcType="VARCHAR"/>
        <result column="servant_name" property="servantName" jdbcType="VARCHAR"/>
        <result column="order_create_time" property="orderCreateTime" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="SMALLINT"/>
        <result column="memo" property="memo" jdbcType="VARCHAR"/>
        <result column="create_user" property="createUser" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_user" property="updateUser" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="out_order_status_code" property="outOrderStatusCode" jdbcType="VARCHAR"/>
        <result column="out_order_status_code_value" property="outOrderStatusCodeValue" jdbcType="VARCHAR"/>
        <result column="out_id" property="outId" jdbcType="VARCHAR"/>
        <result column="shop_name" property="shopName" jdbcType="VARCHAR"/>
        <result column="work_order_number" property="workOrderNumber" jdbcType="INTEGER"/>
        <result column="assign_time" property="assignTime" jdbcType="VARCHAR"/>
        <result column="gmtIdentify" property="gmtIdentify" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,
        order_sn,
        goods,
        city,
        order_label,
        pay_time,
        user_name,
        user_phone,
        address,
        user_book_time,
        real_book_time,
        servant_name,
        order_create_time,
        status,
        memo,
        create_user,
        create_time,
        update_user,
        update_time,
        out_order_status_code,
        out_order_status_code_value,
        out_id,
        shop_name,
        work_order_number,
        assign_time,
        gmtIdentify
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from jz_order_qg
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from jz_order_qg
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg">
        insert into jz_order_qg (id, order_sn, goods,
                                 city, order_label, pay_time,
                                 user_name, user_phone, address,
                                 user_book_time, real_book_time, servant_name,
                                 order_create_time, status, memo,
                                 create_user, create_time, update_user,
                                 update_time, out_order_status_code, out_order_status_code_value,
                                 out_id, shop_name, work_order_number,
                                 assign_time, gmtIdentify)
        values (#{id,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{goods,jdbcType=VARCHAR},
                #{city,jdbcType=VARCHAR}, #{orderLabel,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP},
                #{userName,jdbcType=VARCHAR}, #{userPhone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
                #{userBookTime,jdbcType=VARCHAR}, #{realBookTime,jdbcType=VARCHAR}, #{servantName,jdbcType=VARCHAR},
                #{orderCreateTime,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT}, #{memo,jdbcType=VARCHAR},
                #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
                #{updateTime,jdbcType=TIMESTAMP}, #{outOrderStatusCode,jdbcType=VARCHAR},
                #{outOrderStatusCodeValue,jdbcType=VARCHAR},
                #{outId,jdbcType=VARCHAR}, #{shopName,jdbcType=VARCHAR}, #{workOrderNumber,jdbcType=INTEGER},
                #{assignTime,jdbcType=VARCHAR},
                #{gmtIdentify,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg">
        insert into jz_order_qg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="orderSn != null">
                order_sn,
            </if>
            <if test="goods != null">
                goods,
            </if>
            <if test="city != null">
                city,
            </if>
            <if test="orderLabel != null">
                order_label,
            </if>
            <if test="payTime != null">
                pay_time,
            </if>
            <if test="userName != null">
                user_name,
            </if>
            <if test="userPhone != null">
                user_phone,
            </if>
            <if test="address != null">
                address,
            </if>
            <if test="userBookTime != null">
                user_book_time,
            </if>
            <if test="realBookTime != null">
                real_book_time,
            </if>
            <if test="servantName != null">
                servant_name,
            </if>
            <if test="orderCreateTime != null">
                order_create_time,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="memo != null">
                memo,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateUser != null">
                update_user,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="outOrderStatusCode != null">
                out_order_status_code,
            </if>
            <if test="outOrderStatusCodeValue != null">
                out_order_status_code_value,
            </if>
            <if test="outId != null">
                out_id,
            </if>
            <if test="shopName != null">
                shop_name,
            </if>
            <if test="workOrderNumber != null">
                work_order_number,
            </if>
            <if test="assignTime != null">
                assign_time,
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                gmtIdentify
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="orderSn != null">
                #{orderSn,jdbcType=VARCHAR},
            </if>
            <if test="goods != null">
                #{goods,jdbcType=VARCHAR},
            </if>
            <if test="city != null">
                #{city,jdbcType=VARCHAR},
            </if>
            <if test="orderLabel != null">
                #{orderLabel,jdbcType=VARCHAR},
            </if>
            <if test="payTime != null">
                #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userName != null">
                #{userName,jdbcType=VARCHAR},
            </if>
            <if test="userPhone != null">
                #{userPhone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                #{address,jdbcType=VARCHAR},
            </if>
            <if test="userBookTime != null">
                #{userBookTime,jdbcType=VARCHAR},
            </if>
            <if test="realBookTime != null">
                #{realBookTime,jdbcType=VARCHAR},
            </if>
            <if test="servantName != null">
                #{servantName,jdbcType=VARCHAR},
            </if>
            <if test="orderCreateTime != null">
                #{orderCreateTime,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=SMALLINT},
            </if>
            <if test="memo != null">
                #{memo,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                #{updateUser,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="outOrderStatusCode != null">
                #{outOrderStatusCode,jdbcType=VARCHAR},
            </if>
            <if test="outOrderStatusCodeValue != null">
                #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            </if>
            <if test="outId != null">
                #{outId,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="workOrderNumber != null">
                #{workOrderNumber,jdbcType=INTEGER},
            </if>
            <if test="assignTime != null">
                #{assignTime,jdbcType=VARCHAR},
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                #{gmtIdentify,jdbcType=VARCHAR}
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg">
        <!--@mbg.generated-->
        update jz_order_qg
        <set>
            <if test="orderSn != null">
                order_sn = #{orderSn,jdbcType=VARCHAR},
            </if>
            <if test="goods != null">
                goods = #{goods,jdbcType=VARCHAR},
            </if>
            <if test="city != null">
                city = #{city,jdbcType=VARCHAR},
            </if>
            <if test="orderLabel != null">
                order_label = #{orderLabel,jdbcType=VARCHAR},
            </if>
            <if test="payTime != null">
                pay_time = #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userName != null">
                user_name = #{userName,jdbcType=VARCHAR},
            </if>
            <if test="userPhone != null">
                user_phone = #{userPhone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                address = #{address,jdbcType=VARCHAR},
            </if>
            <if test="userBookTime != null">
                user_book_time = #{userBookTime,jdbcType=VARCHAR},
            </if>
            <if test="realBookTime != null">
                real_book_time = #{realBookTime,jdbcType=VARCHAR},
            </if>
            <if test="servantName != null">
                servant_name = #{servantName,jdbcType=VARCHAR},
            </if>
            <if test="orderCreateTime != null">
                order_create_time = #{orderCreateTime,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=SMALLINT},
            </if>
            <if test="memo != null">
                memo = #{memo,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                create_user = #{createUser,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="outOrderStatusCode != null">
                out_order_status_code = #{outOrderStatusCode,jdbcType=VARCHAR},
            </if>
            <if test="outOrderStatusCodeValue != null">
                out_order_status_code_value = #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            </if>
            <if test="outId != null">
                out_id = #{outId,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                shop_name = #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="workOrderNumber != null">
                work_order_number = #{workOrderNumber,jdbcType=INTEGER},
            </if>
            <if test="assignTime != null">
                assign_time = #{assignTime,jdbcType=VARCHAR},
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                gmtIdentify =#{gmtIdentify,jdbcType=VARCHAR}
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg">
        update jz_order_qg
        set order_sn                    = #{orderSn,jdbcType=VARCHAR},
            goods                       = #{goods,jdbcType=VARCHAR},
            city                        = #{city,jdbcType=VARCHAR},
            order_label                 = #{orderLabel,jdbcType=VARCHAR},
            pay_time                    = #{payTime,jdbcType=TIMESTAMP},
            user_name                   = #{userName,jdbcType=VARCHAR},
            user_phone                  = #{userPhone,jdbcType=VARCHAR},
            address                     = #{address,jdbcType=VARCHAR},
            user_book_time              = #{userBookTime,jdbcType=VARCHAR},
            real_book_time              = #{realBookTime,jdbcType=VARCHAR},
            servant_name                = #{servantName,jdbcType=VARCHAR},
            order_create_time           = #{orderCreateTime,jdbcType=VARCHAR},
            status                      = #{status,jdbcType=SMALLINT},
            memo                        = #{memo,jdbcType=VARCHAR},
            create_user                 = #{createUser,jdbcType=INTEGER},
            create_time                 = #{createTime,jdbcType=TIMESTAMP},
            update_user                 = #{updateUser,jdbcType=INTEGER},
            update_time                 = #{updateTime,jdbcType=TIMESTAMP},
            out_order_status_code       = #{outOrderStatusCode,jdbcType=VARCHAR},
            out_order_status_code_value = #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            out_id                      = #{outId,jdbcType=VARCHAR},
            shop_name                   = #{shopName,jdbcType=VARCHAR},
            work_order_number           = #{workOrderNumber,jdbcType=INTEGER},
            assign_time                 = #{assignTime,jdbcType=VARCHAR},
            gmtIdentify                 =#{gmtIdentify,jdbcType=VARCHAR}
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateBatch" parameterType="java.util.List">
        <!--@mbg.generated-->
        update jz_order_qg
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="order_sn = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.orderSn,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="goods = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.goods,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="city = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.city,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="order_label = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.orderLabel,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="pay_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.payTime,jdbcType=TIMESTAMP}
                </foreach>
            </trim>
            <trim prefix="user_name = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.userName,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="user_phone = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.userPhone,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="address = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.address,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="user_book_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.userBookTime,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="real_book_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.realBookTime,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="servant_name = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.servantName,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="order_create_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.orderCreateTime,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="`status` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=SMALLINT}
                </foreach>
            </trim>
            <trim prefix="memo = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.memo,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="create_user = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.createUser,jdbcType=INTEGER}
                </foreach>
            </trim>
            <trim prefix="create_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
                </foreach>
            </trim>
            <trim prefix="update_user = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.updateUser,jdbcType=INTEGER}
                </foreach>
            </trim>
            <trim prefix="update_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
                </foreach>
            </trim>
            <trim prefix="out_order_status_code = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.outOrderStatusCode,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="out_order_status_code_value = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.outOrderStatusCodeValue,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="out_id = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.outId,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="shop_name = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.shopName,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="work_order_number = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.workOrderNumber,jdbcType=INTEGER}
                </foreach>
            </trim>
            <trim prefix="assign_time =case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id =#{item.id,jdbcType=INTEGER} then #{item.assignTime,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="gmtIdentify =case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id =#{item.id,jdbcType=INTEGER} then #{item.gmtIdentify,jdbcType=VARCHAR}
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="list" item="item" open="(" separator=", ">
            #{item.id,jdbcType=INTEGER}
        </foreach>
    </update>
    <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into jz_order_qg
                (order_sn, goods, city, order_label, pay_time, user_name, user_phone, address, user_book_time,
                 real_book_time, servant_name, order_create_time, `status`, memo, create_user, create_time,
                 update_user, update_time, out_order_status_code, out_order_status_code_value, out_id,
                 shop_name, work_order_number, gmtIdentify, assign_time)
                values
        <foreach collection="list" item="item" separator=",">
            (#{item.orderSn,jdbcType=VARCHAR}, #{item.goods,jdbcType=VARCHAR}, #{item.city,jdbcType=VARCHAR},
             #{item.orderLabel,jdbcType=VARCHAR}, #{item.payTime,jdbcType=TIMESTAMP}, #{item.userName,jdbcType=VARCHAR},
             #{item.userPhone,jdbcType=VARCHAR}, #{item.address,jdbcType=VARCHAR},
             #{item.userBookTime,jdbcType=VARCHAR},
             #{item.realBookTime,jdbcType=VARCHAR}, #{item.servantName,jdbcType=VARCHAR},
             #{item.orderCreateTime,jdbcType=VARCHAR},
             #{item.status,jdbcType=SMALLINT}, #{item.memo,jdbcType=VARCHAR}, #{item.createUser,jdbcType=INTEGER},
             #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateUser,jdbcType=INTEGER},
             #{item.updateTime,jdbcType=TIMESTAMP},
             #{item.outOrderStatusCode,jdbcType=VARCHAR}, #{item.outOrderStatusCodeValue,jdbcType=VARCHAR},
             #{item.outId,jdbcType=VARCHAR}, #{item.shopName,jdbcType=VARCHAR},
             #{item.workOrderNumber,jdbcType=INTEGER},
             #{item.gmtIdentify,jdbcType=VARCHAR},
             #{item.assignTime,jdbcType=VARCHAR})
        </foreach>
    </insert>
    <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
            parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg" useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into jz_order_qg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            order_sn,
            goods,
            city,
            order_label,
            pay_time,
            user_name,
            user_phone,
            address,
            user_book_time,
            real_book_time,
            servant_name,
            order_create_time,
            `status`,
            memo,
            create_user,
            create_time,
            update_user,
            update_time,
            out_order_status_code,
            out_order_status_code_value,
            out_id,
            shop_name,
            work_order_number,
            assign_time,
            gmtIdentify
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            #{orderSn,jdbcType=VARCHAR},
            #{goods,jdbcType=VARCHAR},
            #{city,jdbcType=VARCHAR},
            #{orderLabel,jdbcType=VARCHAR},
            #{payTime,jdbcType=TIMESTAMP},
            #{userName,jdbcType=VARCHAR},
            #{userPhone,jdbcType=VARCHAR},
            #{address,jdbcType=VARCHAR},
            #{userBookTime,jdbcType=VARCHAR},
            #{realBookTime,jdbcType=VARCHAR},
            #{servantName,jdbcType=VARCHAR},
            #{orderCreateTime,jdbcType=VARCHAR},
            #{status,jdbcType=SMALLINT},
            #{memo,jdbcType=VARCHAR},
            #{createUser,jdbcType=INTEGER},
            #{createTime,jdbcType=TIMESTAMP},
            #{updateUser,jdbcType=INTEGER},
            #{updateTime,jdbcType=TIMESTAMP},
            #{outOrderStatusCode,jdbcType=VARCHAR},
            #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            #{outId,jdbcType=VARCHAR},
            #{shopName,jdbcType=VARCHAR},
            #{workOrderNumber,jdbcType=INTEGER},
            #{assignTime,jdbcType=VARCHAR},
            #{gmtIdentify,jdbcType=VARCHAR},
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=INTEGER},
            </if>
            order_sn                    = #{orderSn,jdbcType=VARCHAR},
            goods                       = #{goods,jdbcType=VARCHAR},
            city                        = #{city,jdbcType=VARCHAR},
            order_label                 = #{orderLabel,jdbcType=VARCHAR},
            pay_time                    = #{payTime,jdbcType=TIMESTAMP},
            user_name                   = #{userName,jdbcType=VARCHAR},
            user_phone                  = #{userPhone,jdbcType=VARCHAR},
            address                     = #{address,jdbcType=VARCHAR},
            user_book_time              = #{userBookTime,jdbcType=VARCHAR},
            real_book_time              = #{realBookTime,jdbcType=VARCHAR},
            servant_name                = #{servantName,jdbcType=VARCHAR},
            order_create_time           = #{orderCreateTime,jdbcType=VARCHAR},
            `status`                    = #{status,jdbcType=SMALLINT},
            memo                        = #{memo,jdbcType=VARCHAR},
            create_user                 = #{createUser,jdbcType=INTEGER},
            create_time                 = #{createTime,jdbcType=TIMESTAMP},
            update_user                 = #{updateUser,jdbcType=INTEGER},
            update_time                 = #{updateTime,jdbcType=TIMESTAMP},
            out_order_status_code       = #{outOrderStatusCode,jdbcType=VARCHAR},
            out_order_status_code_value = #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            out_id                      = #{outId,jdbcType=VARCHAR},
            shop_name                   = #{shopName,jdbcType=VARCHAR},
            work_order_number           = #{workOrderNumber,jdbcType=INTEGER},
            assign_time                 =#{assignTime,jdbcType=VARCHAR},
            gmtIdentify                 =#{gmtIdentify,jdbcType=VARCHAR}
        </trim>
    </insert>
    <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
            parameterType="com.reptileclient.jlifeapp.entity.qg.JzOrderQg" useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into jz_order_qg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="orderSn != null">
                order_sn,
            </if>
            <if test="goods != null">
                goods,
            </if>
            <if test="city != null">
                city,
            </if>
            <if test="orderLabel != null">
                order_label,
            </if>
            <if test="payTime != null">
                pay_time,
            </if>
            <if test="userName != null">
                user_name,
            </if>
            <if test="userPhone != null">
                user_phone,
            </if>
            <if test="address != null">
                address,
            </if>
            <if test="userBookTime != null">
                user_book_time,
            </if>
            <if test="realBookTime != null">
                real_book_time,
            </if>
            <if test="servantName != null">
                servant_name,
            </if>
            <if test="orderCreateTime != null">
                order_create_time,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="memo != null">
                memo,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateUser != null">
                update_user,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="outOrderStatusCode != null">
                out_order_status_code,
            </if>
            <if test="outOrderStatusCodeValue != null">
                out_order_status_code_value,
            </if>
            <if test="outId != null">
                out_id,
            </if>
            <if test="shopName != null">
                shop_name,
            </if>
            <if test="workOrderNumber != null">
                work_order_number,
            </if>
            <if test="assignTime != null and assignTime != ''">
                assign_time,
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                gmtIdentify,
            </if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="orderSn != null">
                #{orderSn,jdbcType=VARCHAR},
            </if>
            <if test="goods != null">
                #{goods,jdbcType=VARCHAR},
            </if>
            <if test="city != null">
                #{city,jdbcType=VARCHAR},
            </if>
            <if test="orderLabel != null">
                #{orderLabel,jdbcType=VARCHAR},
            </if>
            <if test="payTime != null">
                #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userName != null">
                #{userName,jdbcType=VARCHAR},
            </if>
            <if test="userPhone != null">
                #{userPhone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                #{address,jdbcType=VARCHAR},
            </if>
            <if test="userBookTime != null">
                #{userBookTime,jdbcType=VARCHAR},
            </if>
            <if test="realBookTime != null">
                #{realBookTime,jdbcType=VARCHAR},
            </if>
            <if test="servantName != null">
                #{servantName,jdbcType=VARCHAR},
            </if>
            <if test="orderCreateTime != null">
                #{orderCreateTime,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=SMALLINT},
            </if>
            <if test="memo != null">
                #{memo,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                #{updateUser,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="outOrderStatusCode != null">
                #{outOrderStatusCode,jdbcType=VARCHAR},
            </if>
            <if test="outOrderStatusCodeValue != null">
                #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            </if>
            <if test="outId != null">
                #{outId,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="workOrderNumber != null">
                #{workOrderNumber,jdbcType=INTEGER},
            </if>
            <if test="assignTime != null and assignTime != ''">
                #{assignTime,jdbcType=VARCHAR},
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                #{gmtIdentify,jdbcType=VARCHAR},
            </if>
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=INTEGER},
            </if>
            <if test="orderSn != null">
                order_sn = #{orderSn,jdbcType=VARCHAR},
            </if>
            <if test="goods != null">
                goods = #{goods,jdbcType=VARCHAR},
            </if>
            <if test="city != null">
                city = #{city,jdbcType=VARCHAR},
            </if>
            <if test="orderLabel != null">
                order_label = #{orderLabel,jdbcType=VARCHAR},
            </if>
            <if test="payTime != null">
                pay_time = #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userName != null">
                user_name = #{userName,jdbcType=VARCHAR},
            </if>
            <if test="userPhone != null">
                user_phone = #{userPhone,jdbcType=VARCHAR},
            </if>
            <if test="address != null">
                address = #{address,jdbcType=VARCHAR},
            </if>
            <if test="userBookTime != null">
                user_book_time = #{userBookTime,jdbcType=VARCHAR},
            </if>
            <if test="realBookTime != null">
                real_book_time = #{realBookTime,jdbcType=VARCHAR},
            </if>
            <if test="servantName != null">
                servant_name = #{servantName,jdbcType=VARCHAR},
            </if>
            <if test="orderCreateTime != null">
                order_create_time = #{orderCreateTime,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=SMALLINT},
            </if>
            <if test="memo != null">
                memo = #{memo,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                create_user = #{createUser,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="outOrderStatusCode != null">
                out_order_status_code = #{outOrderStatusCode,jdbcType=VARCHAR},
            </if>
            <if test="outOrderStatusCodeValue != null">
                out_order_status_code_value = #{outOrderStatusCodeValue,jdbcType=VARCHAR},
            </if>
            <if test="outId != null">
                out_id = #{outId,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                shop_name = #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="workOrderNumber != null">
                work_order_number = #{workOrderNumber,jdbcType=INTEGER},
            </if>
            <if test="assignTime != null and assignTime != ''">
                assign_time =#{assignTime,jdbcType=VARCHAR},
            </if>
            <if test="gmtIdentify != null and gmtIdentify != ''">
                gmtIdentify =#{gmtIdentify,jdbcType=VARCHAR}
            </if>
        </trim>
    </insert>

    <select id="selectAll" resultMap="BaseResultMap">
        select *
        from jz_order_qg
    </select>

    <select id="selectCount" resultType="int">
        select count(1)
        from jz_order_qg
    </select>

    <select id="selectByCreateTime" resultMap="BaseResultMap">
        -- 1637054252000 1637140655000
                select *
                from jz_order_qg
                where unix_timestamp(create_time) * 1000 &gt;= #{lastMonth,jdbcType=BIGINT}
                  and unix_timestamp(create_time) * 1000 &lt;= #{now}
    </select>

    <update id="updateBatchByOutId">
        update jz_order_qg
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="`out_order_status_code` = case" suffix="end,">
                <foreach collection="waitUpdate" index="index" item="item">
                    when id = #{index} then #{status,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="`out_order_status_code_value` = case" suffix="end,">
                <foreach collection="waitUpdate" index="index" item="item">
                    when id = #{index} then #{statusDesc,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="`update_time` = case" suffix="end,">
                <foreach collection="waitUpdate" index="index" item="item">
                    when id = #{index} then now()
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="waitUpdate" item="item" open="(" separator=", ">
            #{item,jdbcType=INTEGER}
        </foreach>
    </update>

    <delete id="deleteDuplicate">
        delete from jz_order_qg where id in (select * from (select  min(id) as id
                                                            from jz_order_qg
                                                            group by out_id
                                                            having count(1) > 1)t)
    </delete>

    <delete id="deleteByCity">
        delete from jz_order_qg where city = #{city,jdbcType=VARCHAR}
    </delete>
</mapper>
