<?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.sys.role.SysRoleExtDataMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtData">

    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="service_no_mult" jdbcType="VARCHAR" property="serviceNoMult" />
    <result column="service_name_mult" jdbcType="VARCHAR" property="serviceNameMult" />
    <result column="sys_role_ext_sample_ids" jdbcType="VARCHAR" property="sysRoleExtSampleIds" />
    <result column="source_from" jdbcType="VARCHAR" property="sourceFrom" />
    <result column="source_from_quote_id" jdbcType="BIGINT" property="sourceFromQuoteId" />
    <result column="permit_start_time" jdbcType="TIMESTAMP" property="permitStartTime" />
    <result column="permit_end_time" jdbcType="TIMESTAMP" property="permitEndTime" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="enabled" jdbcType="TINYINT" property="enabled" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
    <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" />
  </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, service_no_mult, service_name_mult, sys_role_ext_sample_ids, source_from, source_from_quote_id, 
    permit_start_time, permit_end_time, name, remark, enabled, deleted, create_time, 
    create_user_id, update_time, update_user_id
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataExample" resultMap="BaseResultMap">

    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_role_ext_data
    <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 sys_role_ext_data
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

    delete from sys_role_ext_data
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataExample">

    delete from sys_role_ext_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtData">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role_ext_data (service_no_mult, service_name_mult, sys_role_ext_sample_ids, 
      source_from, source_from_quote_id, permit_start_time, 
      permit_end_time, name, remark, 
      enabled, deleted, create_time, 
      create_user_id, update_time, update_user_id
      )
    values (#{serviceNoMult,jdbcType=VARCHAR}, #{serviceNameMult,jdbcType=VARCHAR}, #{sysRoleExtSampleIds,jdbcType=VARCHAR}, 
      #{sourceFrom,jdbcType=VARCHAR}, #{sourceFromQuoteId,jdbcType=BIGINT}, #{permitStartTime,jdbcType=TIMESTAMP}, 
      #{permitEndTime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
      #{enabled,jdbcType=TINYINT}, #{deleted,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtData">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role_ext_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="serviceNoMult != null">
        service_no_mult,
      </if>
      <if test="serviceNameMult != null">
        service_name_mult,
      </if>
      <if test="sysRoleExtSampleIds != null">
        sys_role_ext_sample_ids,
      </if>
      <if test="sourceFrom != null">
        source_from,
      </if>
      <if test="sourceFromQuoteId != null">
        source_from_quote_id,
      </if>
      <if test="permitStartTime != null">
        permit_start_time,
      </if>
      <if test="permitEndTime != null">
        permit_end_time,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="enabled != null">
        enabled,
      </if>
      <if test="deleted != null">
        deleted,
      </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>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="serviceNoMult != null">
        #{serviceNoMult,jdbcType=VARCHAR},
      </if>
      <if test="serviceNameMult != null">
        #{serviceNameMult,jdbcType=VARCHAR},
      </if>
      <if test="sysRoleExtSampleIds != null">
        #{sysRoleExtSampleIds,jdbcType=VARCHAR},
      </if>
      <if test="sourceFrom != null">
        #{sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="sourceFromQuoteId != null">
        #{sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="permitStartTime != null">
        #{permitStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="permitEndTime != null">
        #{permitEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=TINYINT},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </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>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataExample" resultType="java.lang.Long">

    select count(*) from sys_role_ext_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">

    update sys_role_ext_data
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.serviceNoMult != null">
        service_no_mult = #{record.serviceNoMult,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceNameMult != null">
        service_name_mult = #{record.serviceNameMult,jdbcType=VARCHAR},
      </if>
      <if test="record.sysRoleExtSampleIds != null">
        sys_role_ext_sample_ids = #{record.sysRoleExtSampleIds,jdbcType=VARCHAR},
      </if>
      <if test="record.sourceFrom != null">
        source_from = #{record.sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="record.sourceFromQuoteId != null">
        source_from_quote_id = #{record.sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="record.permitStartTime != null">
        permit_start_time = #{record.permitStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.permitEndTime != null">
        permit_end_time = #{record.permitEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=TINYINT},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </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>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">

    update sys_role_ext_data
    set id = #{record.id,jdbcType=BIGINT},
      service_no_mult = #{record.serviceNoMult,jdbcType=VARCHAR},
      service_name_mult = #{record.serviceNameMult,jdbcType=VARCHAR},
      sys_role_ext_sample_ids = #{record.sysRoleExtSampleIds,jdbcType=VARCHAR},
      source_from = #{record.sourceFrom,jdbcType=VARCHAR},
      source_from_quote_id = #{record.sourceFromQuoteId,jdbcType=BIGINT},
      permit_start_time = #{record.permitStartTime,jdbcType=TIMESTAMP},
      permit_end_time = #{record.permitEndTime,jdbcType=TIMESTAMP},
      name = #{record.name,jdbcType=VARCHAR},
      remark = #{record.remark,jdbcType=VARCHAR},
      enabled = #{record.enabled,jdbcType=TINYINT},
      deleted = #{record.deleted,jdbcType=TINYINT},
      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}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtData">

    update sys_role_ext_data
    <set>
      <if test="serviceNoMult != null">
        service_no_mult = #{serviceNoMult,jdbcType=VARCHAR},
      </if>
      <if test="serviceNameMult != null">
        service_name_mult = #{serviceNameMult,jdbcType=VARCHAR},
      </if>
      <if test="sysRoleExtSampleIds != null">
        sys_role_ext_sample_ids = #{sysRoleExtSampleIds,jdbcType=VARCHAR},
      </if>
      <if test="sourceFrom != null">
        source_from = #{sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="sourceFromQuoteId != null">
        source_from_quote_id = #{sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="permitStartTime != null">
        permit_start_time = #{permitStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="permitEndTime != null">
        permit_end_time = #{permitEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=TINYINT},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </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>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtData">

    update sys_role_ext_data
    set service_no_mult = #{serviceNoMult,jdbcType=VARCHAR},
      service_name_mult = #{serviceNameMult,jdbcType=VARCHAR},
      sys_role_ext_sample_ids = #{sysRoleExtSampleIds,jdbcType=VARCHAR},
      source_from = #{sourceFrom,jdbcType=VARCHAR},
      source_from_quote_id = #{sourceFromQuoteId,jdbcType=BIGINT},
      permit_start_time = #{permitStartTime,jdbcType=TIMESTAMP},
      permit_end_time = #{permitEndTime,jdbcType=TIMESTAMP},
      name = #{name,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      enabled = #{enabled,jdbcType=TINYINT},
      deleted = #{deleted,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>