<?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.superdesk.uniorder.dao.mapper.setting.UnifiedServiceMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.setting.UnifiedService">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="as_service" jdbcType="TINYINT" property="asService" />
    <result column="as_order_type" jdbcType="TINYINT" property="asOrderType" />
    <result column="service_id" jdbcType="INTEGER" property="serviceId" />
    <result column="service_no" jdbcType="VARCHAR" property="serviceNo" />
    <result column="service_name" jdbcType="VARCHAR" property="serviceName" />
    <result column="order_type" jdbcType="VARCHAR" property="orderType" />
    <result column="order_state" jdbcType="VARCHAR" property="orderState" />
    <result column="order_state_json" jdbcType="VARCHAR" property="orderStateJson" />
    <result column="pay_type_json" jdbcType="VARCHAR" property="payTypeJson" />
    <result column="goods_transport_fiscal_code" jdbcType="VARCHAR" property="goodsTransportFiscalCode" />
    <result column="goods_transport_tax_code" jdbcType="VARCHAR" property="goodsTransportTaxCode" />
    <result column="goods_transport_tax_rate" jdbcType="DECIMAL" property="goodsTransportTaxRate" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="update_user_id" jdbcType="BIGINT" property="updateUserId" />
    <result column="enabled" jdbcType="TINYINT" property="enabled" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <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">
    <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">
    id, as_service, as_order_type, service_id, service_no, service_name, order_type, 
    order_state, order_state_json, pay_type_json, goods_transport_fiscal_code, goods_transport_tax_code, 
    goods_transport_tax_rate, create_time, create_user_id, update_time, update_user_id, 
    enabled, deleted
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedServiceExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from unified_service
    <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">
    select 
    <include refid="Base_Column_List" />
    from unified_service
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from unified_service
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedServiceExample">
    delete from unified_service
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedService">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_service (as_service, as_order_type, service_id, 
      service_no, service_name, order_type, 
      order_state, order_state_json, pay_type_json, 
      goods_transport_fiscal_code, goods_transport_tax_code, 
      goods_transport_tax_rate, create_time, create_user_id, 
      update_time, update_user_id, enabled, 
      deleted)
    values (#{asService,jdbcType=TINYINT}, #{asOrderType,jdbcType=TINYINT}, #{serviceId,jdbcType=INTEGER}, 
      #{serviceNo,jdbcType=VARCHAR}, #{serviceName,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR}, 
      #{orderState,jdbcType=VARCHAR}, #{orderStateJson,jdbcType=VARCHAR}, #{payTypeJson,jdbcType=VARCHAR}, 
      #{goodsTransportFiscalCode,jdbcType=VARCHAR}, #{goodsTransportTaxCode,jdbcType=VARCHAR}, 
      #{goodsTransportTaxRate,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, #{enabled,jdbcType=TINYINT}, 
      #{deleted,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedService">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_service
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="asService != null">
        as_service,
      </if>
      <if test="asOrderType != null">
        as_order_type,
      </if>
      <if test="serviceId != null">
        service_id,
      </if>
      <if test="serviceNo != null">
        service_no,
      </if>
      <if test="serviceName != null">
        service_name,
      </if>
      <if test="orderType != null">
        order_type,
      </if>
      <if test="orderState != null">
        order_state,
      </if>
      <if test="orderStateJson != null">
        order_state_json,
      </if>
      <if test="payTypeJson != null">
        pay_type_json,
      </if>
      <if test="goodsTransportFiscalCode != null">
        goods_transport_fiscal_code,
      </if>
      <if test="goodsTransportTaxCode != null">
        goods_transport_tax_code,
      </if>
      <if test="goodsTransportTaxRate != null">
        goods_transport_tax_rate,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="updateUserId != null">
        update_user_id,
      </if>
      <if test="enabled != null">
        enabled,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="asService != null">
        #{asService,jdbcType=TINYINT},
      </if>
      <if test="asOrderType != null">
        #{asOrderType,jdbcType=TINYINT},
      </if>
      <if test="serviceId != null">
        #{serviceId,jdbcType=INTEGER},
      </if>
      <if test="serviceNo != null">
        #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="orderType != null">
        #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="orderState != null">
        #{orderState,jdbcType=VARCHAR},
      </if>
      <if test="orderStateJson != null">
        #{orderStateJson,jdbcType=VARCHAR},
      </if>
      <if test="payTypeJson != null">
        #{payTypeJson,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportFiscalCode != null">
        #{goodsTransportFiscalCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportTaxCode != null">
        #{goodsTransportTaxCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportTaxRate != null">
        #{goodsTransportTaxRate,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=TINYINT},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedServiceExample" resultType="java.lang.Long">
    select count(*) from unified_service
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update unified_service
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.asService != null">
        as_service = #{record.asService,jdbcType=TINYINT},
      </if>
      <if test="record.asOrderType != null">
        as_order_type = #{record.asOrderType,jdbcType=TINYINT},
      </if>
      <if test="record.serviceId != null">
        service_id = #{record.serviceId,jdbcType=INTEGER},
      </if>
      <if test="record.serviceNo != null">
        service_no = #{record.serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceName != null">
        service_name = #{record.serviceName,jdbcType=VARCHAR},
      </if>
      <if test="record.orderType != null">
        order_type = #{record.orderType,jdbcType=VARCHAR},
      </if>
      <if test="record.orderState != null">
        order_state = #{record.orderState,jdbcType=VARCHAR},
      </if>
      <if test="record.orderStateJson != null">
        order_state_json = #{record.orderStateJson,jdbcType=VARCHAR},
      </if>
      <if test="record.payTypeJson != null">
        pay_type_json = #{record.payTypeJson,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsTransportFiscalCode != null">
        goods_transport_fiscal_code = #{record.goodsTransportFiscalCode,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsTransportTaxCode != null">
        goods_transport_tax_code = #{record.goodsTransportTaxCode,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsTransportTaxRate != null">
        goods_transport_tax_rate = #{record.goodsTransportTaxRate,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserId != null">
        update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=TINYINT},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update unified_service
    set id = #{record.id,jdbcType=BIGINT},
      as_service = #{record.asService,jdbcType=TINYINT},
      as_order_type = #{record.asOrderType,jdbcType=TINYINT},
      service_id = #{record.serviceId,jdbcType=INTEGER},
      service_no = #{record.serviceNo,jdbcType=VARCHAR},
      service_name = #{record.serviceName,jdbcType=VARCHAR},
      order_type = #{record.orderType,jdbcType=VARCHAR},
      order_state = #{record.orderState,jdbcType=VARCHAR},
      order_state_json = #{record.orderStateJson,jdbcType=VARCHAR},
      pay_type_json = #{record.payTypeJson,jdbcType=VARCHAR},
      goods_transport_fiscal_code = #{record.goodsTransportFiscalCode,jdbcType=VARCHAR},
      goods_transport_tax_code = #{record.goodsTransportTaxCode,jdbcType=VARCHAR},
      goods_transport_tax_rate = #{record.goodsTransportTaxRate,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user_id = #{record.createUserId,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      enabled = #{record.enabled,jdbcType=TINYINT},
      deleted = #{record.deleted,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedService">
    update unified_service
    <set>
      <if test="asService != null">
        as_service = #{asService,jdbcType=TINYINT},
      </if>
      <if test="asOrderType != null">
        as_order_type = #{asOrderType,jdbcType=TINYINT},
      </if>
      <if test="serviceId != null">
        service_id = #{serviceId,jdbcType=INTEGER},
      </if>
      <if test="serviceNo != null">
        service_no = #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        service_name = #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="orderType != null">
        order_type = #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="orderState != null">
        order_state = #{orderState,jdbcType=VARCHAR},
      </if>
      <if test="orderStateJson != null">
        order_state_json = #{orderStateJson,jdbcType=VARCHAR},
      </if>
      <if test="payTypeJson != null">
        pay_type_json = #{payTypeJson,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportFiscalCode != null">
        goods_transport_fiscal_code = #{goodsTransportFiscalCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportTaxCode != null">
        goods_transport_tax_code = #{goodsTransportTaxCode,jdbcType=VARCHAR},
      </if>
      <if test="goodsTransportTaxRate != null">
        goods_transport_tax_rate = #{goodsTransportTaxRate,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        update_user_id = #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=TINYINT},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedService">
    update unified_service
    set as_service = #{asService,jdbcType=TINYINT},
      as_order_type = #{asOrderType,jdbcType=TINYINT},
      service_id = #{serviceId,jdbcType=INTEGER},
      service_no = #{serviceNo,jdbcType=VARCHAR},
      service_name = #{serviceName,jdbcType=VARCHAR},
      order_type = #{orderType,jdbcType=VARCHAR},
      order_state = #{orderState,jdbcType=VARCHAR},
      order_state_json = #{orderStateJson,jdbcType=VARCHAR},
      pay_type_json = #{payTypeJson,jdbcType=VARCHAR},
      goods_transport_fiscal_code = #{goodsTransportFiscalCode,jdbcType=VARCHAR},
      goods_transport_tax_code = #{goodsTransportTaxCode,jdbcType=VARCHAR},
      goods_transport_tax_rate = #{goodsTransportTaxRate,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT},
      enabled = #{enabled,jdbcType=TINYINT},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>