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

    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="service_no" jdbcType="VARCHAR" property="serviceNo" />
    <result column="service_name" jdbcType="VARCHAR" property="serviceName" />
    <result column="sys_role_ext_data_id" jdbcType="BIGINT" property="sysRoleExtDataId" />
    <result column="sys_role_ext_sample_id" jdbcType="BIGINT" property="sysRoleExtSampleId" />
    <result column="sys_org_id" jdbcType="BIGINT" property="sysOrgId" />
    <result column="sys_virt_id" jdbcType="BIGINT" property="sysVirtId" />
    <result column="out_org_id" jdbcType="BIGINT" property="outOrgId" />
    <result column="out_virt_id" jdbcType="BIGINT" property="outVirtId" />
    <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, service_no, service_name, sys_role_ext_data_id, sys_role_ext_sample_id, sys_org_id, 
    sys_virt_id, out_org_id, out_virt_id, deleted
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataSamplePermissionExample" resultMap="BaseResultMap">

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

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

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

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role_ext_data_sample_permission (service_no, service_name, sys_role_ext_data_id, 
      sys_role_ext_sample_id, sys_org_id, sys_virt_id, 
      out_org_id, out_virt_id, deleted
      )
    values (#{serviceNo,jdbcType=VARCHAR}, #{serviceName,jdbcType=VARCHAR}, #{sysRoleExtDataId,jdbcType=BIGINT}, 
      #{sysRoleExtSampleId,jdbcType=BIGINT}, #{sysOrgId,jdbcType=BIGINT}, #{sysVirtId,jdbcType=BIGINT}, 
      #{outOrgId,jdbcType=BIGINT}, #{outVirtId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataSamplePermission">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role_ext_data_sample_permission
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="serviceNo != null">
        service_no,
      </if>
      <if test="serviceName != null">
        service_name,
      </if>
      <if test="sysRoleExtDataId != null">
        sys_role_ext_data_id,
      </if>
      <if test="sysRoleExtSampleId != null">
        sys_role_ext_sample_id,
      </if>
      <if test="sysOrgId != null">
        sys_org_id,
      </if>
      <if test="sysVirtId != null">
        sys_virt_id,
      </if>
      <if test="outOrgId != null">
        out_org_id,
      </if>
      <if test="outVirtId != null">
        out_virt_id,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="serviceNo != null">
        #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="sysRoleExtDataId != null">
        #{sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="sysRoleExtSampleId != null">
        #{sysRoleExtSampleId,jdbcType=BIGINT},
      </if>
      <if test="sysOrgId != null">
        #{sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="sysVirtId != null">
        #{sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="outOrgId != null">
        #{outOrgId,jdbcType=BIGINT},
      </if>
      <if test="outVirtId != null">
        #{outVirtId,jdbcType=BIGINT},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.role.SysRoleExtDataSamplePermissionExample" resultType="java.lang.Long">

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

    update sys_role_ext_data_sample_permission
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </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.sysRoleExtDataId != null">
        sys_role_ext_data_id = #{record.sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="record.sysRoleExtSampleId != null">
        sys_role_ext_sample_id = #{record.sysRoleExtSampleId,jdbcType=BIGINT},
      </if>
      <if test="record.sysOrgId != null">
        sys_org_id = #{record.sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="record.sysVirtId != null">
        sys_virt_id = #{record.sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="record.outOrgId != null">
        out_org_id = #{record.outOrgId,jdbcType=BIGINT},
      </if>
      <if test="record.outVirtId != null">
        out_virt_id = #{record.outVirtId,jdbcType=BIGINT},
      </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 sys_role_ext_data_sample_permission
    set id = #{record.id,jdbcType=BIGINT},
      service_no = #{record.serviceNo,jdbcType=VARCHAR},
      service_name = #{record.serviceName,jdbcType=VARCHAR},
      sys_role_ext_data_id = #{record.sysRoleExtDataId,jdbcType=BIGINT},
      sys_role_ext_sample_id = #{record.sysRoleExtSampleId,jdbcType=BIGINT},
      sys_org_id = #{record.sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{record.sysVirtId,jdbcType=BIGINT},
      out_org_id = #{record.outOrgId,jdbcType=BIGINT},
      out_virt_id = #{record.outVirtId,jdbcType=BIGINT},
      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.sys.role.SysRoleExtDataSamplePermission">

    update sys_role_ext_data_sample_permission
    <set>
      <if test="serviceNo != null">
        service_no = #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        service_name = #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="sysRoleExtDataId != null">
        sys_role_ext_data_id = #{sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="sysRoleExtSampleId != null">
        sys_role_ext_sample_id = #{sysRoleExtSampleId,jdbcType=BIGINT},
      </if>
      <if test="sysOrgId != null">
        sys_org_id = #{sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="sysVirtId != null">
        sys_virt_id = #{sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="outOrgId != null">
        out_org_id = #{outOrgId,jdbcType=BIGINT},
      </if>
      <if test="outVirtId != null">
        out_virt_id = #{outVirtId,jdbcType=BIGINT},
      </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.sys.role.SysRoleExtDataSamplePermission">

    update sys_role_ext_data_sample_permission
    set service_no = #{serviceNo,jdbcType=VARCHAR},
      service_name = #{serviceName,jdbcType=VARCHAR},
      sys_role_ext_data_id = #{sysRoleExtDataId,jdbcType=BIGINT},
      sys_role_ext_sample_id = #{sysRoleExtSampleId,jdbcType=BIGINT},
      sys_org_id = #{sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{sysVirtId,jdbcType=BIGINT},
      out_org_id = #{outOrgId,jdbcType=BIGINT},
      out_virt_id = #{outVirtId,jdbcType=BIGINT},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>