<?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.lightinit.hsdataportal.mapper.ResourceMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataportal.entity.Resource">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
    <result column="resource_state" jdbcType="VARCHAR" property="resourceState" />
    <result column="resource_name" jdbcType="VARCHAR" property="resourceName" />
    <result column="resource_identity" jdbcType="VARCHAR" property="resourceIdentity" />
    <result column="resource_summary" jdbcType="VARCHAR" property="resourceSummary" />
    <result column="register_date" jdbcType="TIMESTAMP" property="registerDate" />
    <result column="catelog_type" jdbcType="VARCHAR" property="catelogType" />
    <result column="catelog_basic" jdbcType="BIGINT" property="catelogBasic" />
    <result column="catelog_sector" jdbcType="BIGINT" property="catelogSector" />
    <result column="catelog_theme" jdbcType="BIGINT" property="catelogTheme" />
    <result column="catelog_custom" jdbcType="BIGINT" property="catelogCustom" />
    <result column="share_type" jdbcType="VARCHAR" property="shareType" />
    <result column="open_type" jdbcType="VARCHAR" property="openType" />
    <result column="allow_deal" jdbcType="TINYINT" property="allowDeal" />
    <result column="audited_by" jdbcType="BIGINT" property="auditedBy" />
    <result column="audited_at" jdbcType="TIMESTAMP" property="auditedAt" />
    <result column="audit_result" jdbcType="VARCHAR" property="auditResult" />
    <result column="audit_opinion" jdbcType="VARCHAR" property="auditOpinion" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="deleted_at" jdbcType="TIMESTAMP" property="deletedAt" />
    <result column="deleted_by" jdbcType="BIGINT" property="deletedBy" />
    <result column="out_id_1" jdbcType="VARCHAR" property="outId1" />
    <result column="out_id_2" jdbcType="VARCHAR" property="outId2" />
    <result column="out_id_3" jdbcType="VARCHAR" property="outId3" />
  </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, resource_type, resource_state, resource_name, resource_identity, resource_summary, 
    register_date, catelog_type, catelog_basic, catelog_sector, catelog_theme, catelog_custom, 
    share_type, open_type, allow_deal, audited_by, audited_at, audit_result, audit_opinion, 
    created_at, created_by, deleted_at, deleted_by, out_id_1, out_id_2, out_id_3
  </sql>
  <select id="selectByExample" parameterType="com.lightinit.hsdataportal.entity.ResourceExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from resource
    <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 resource
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from resource
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataportal.entity.ResourceExample">
    delete from resource
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataportal.entity.Resource">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into resource (resource_type, resource_state, resource_name, 
      resource_identity, resource_summary, register_date, 
      catelog_type, catelog_basic, catelog_sector, 
      catelog_theme, catelog_custom, share_type, 
      open_type, allow_deal, audited_by, 
      audited_at, audit_result, audit_opinion, 
      created_at, created_by, deleted_at, 
      deleted_by, out_id_1, out_id_2, 
      out_id_3)
    values (#{resourceType,jdbcType=VARCHAR}, #{resourceState,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, 
      #{resourceIdentity,jdbcType=VARCHAR}, #{resourceSummary,jdbcType=VARCHAR}, #{registerDate,jdbcType=TIMESTAMP}, 
      #{catelogType,jdbcType=VARCHAR}, #{catelogBasic,jdbcType=BIGINT}, #{catelogSector,jdbcType=BIGINT}, 
      #{catelogTheme,jdbcType=BIGINT}, #{catelogCustom,jdbcType=BIGINT}, #{shareType,jdbcType=VARCHAR}, 
      #{openType,jdbcType=VARCHAR}, #{allowDeal,jdbcType=TINYINT}, #{auditedBy,jdbcType=BIGINT}, 
      #{auditedAt,jdbcType=TIMESTAMP}, #{auditResult,jdbcType=VARCHAR}, #{auditOpinion,jdbcType=VARCHAR}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP}, 
      #{deletedBy,jdbcType=BIGINT}, #{outId1,jdbcType=VARCHAR}, #{outId2,jdbcType=VARCHAR}, 
      #{outId3,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataportal.entity.Resource">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into resource
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="resourceType != null">
        resource_type,
      </if>
      <if test="resourceState != null">
        resource_state,
      </if>
      <if test="resourceName != null">
        resource_name,
      </if>
      <if test="resourceIdentity != null">
        resource_identity,
      </if>
      <if test="resourceSummary != null">
        resource_summary,
      </if>
      <if test="registerDate != null">
        register_date,
      </if>
      <if test="catelogType != null">
        catelog_type,
      </if>
      <if test="catelogBasic != null">
        catelog_basic,
      </if>
      <if test="catelogSector != null">
        catelog_sector,
      </if>
      <if test="catelogTheme != null">
        catelog_theme,
      </if>
      <if test="catelogCustom != null">
        catelog_custom,
      </if>
      <if test="shareType != null">
        share_type,
      </if>
      <if test="openType != null">
        open_type,
      </if>
      <if test="allowDeal != null">
        allow_deal,
      </if>
      <if test="auditedBy != null">
        audited_by,
      </if>
      <if test="auditedAt != null">
        audited_at,
      </if>
      <if test="auditResult != null">
        audit_result,
      </if>
      <if test="auditOpinion != null">
        audit_opinion,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="deletedAt != null">
        deleted_at,
      </if>
      <if test="deletedBy != null">
        deleted_by,
      </if>
      <if test="outId1 != null">
        out_id_1,
      </if>
      <if test="outId2 != null">
        out_id_2,
      </if>
      <if test="outId3 != null">
        out_id_3,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="resourceType != null">
        #{resourceType,jdbcType=VARCHAR},
      </if>
      <if test="resourceState != null">
        #{resourceState,jdbcType=VARCHAR},
      </if>
      <if test="resourceName != null">
        #{resourceName,jdbcType=VARCHAR},
      </if>
      <if test="resourceIdentity != null">
        #{resourceIdentity,jdbcType=VARCHAR},
      </if>
      <if test="resourceSummary != null">
        #{resourceSummary,jdbcType=VARCHAR},
      </if>
      <if test="registerDate != null">
        #{registerDate,jdbcType=TIMESTAMP},
      </if>
      <if test="catelogType != null">
        #{catelogType,jdbcType=VARCHAR},
      </if>
      <if test="catelogBasic != null">
        #{catelogBasic,jdbcType=BIGINT},
      </if>
      <if test="catelogSector != null">
        #{catelogSector,jdbcType=BIGINT},
      </if>
      <if test="catelogTheme != null">
        #{catelogTheme,jdbcType=BIGINT},
      </if>
      <if test="catelogCustom != null">
        #{catelogCustom,jdbcType=BIGINT},
      </if>
      <if test="shareType != null">
        #{shareType,jdbcType=VARCHAR},
      </if>
      <if test="openType != null">
        #{openType,jdbcType=VARCHAR},
      </if>
      <if test="allowDeal != null">
        #{allowDeal,jdbcType=TINYINT},
      </if>
      <if test="auditedBy != null">
        #{auditedBy,jdbcType=BIGINT},
      </if>
      <if test="auditedAt != null">
        #{auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="auditResult != null">
        #{auditResult,jdbcType=VARCHAR},
      </if>
      <if test="auditOpinion != null">
        #{auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        #{deletedBy,jdbcType=BIGINT},
      </if>
      <if test="outId1 != null">
        #{outId1,jdbcType=VARCHAR},
      </if>
      <if test="outId2 != null">
        #{outId2,jdbcType=VARCHAR},
      </if>
      <if test="outId3 != null">
        #{outId3,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataportal.entity.ResourceExample" resultType="java.lang.Long">
    select count(*) from resource
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update resource
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.resourceType != null">
        resource_type = #{record.resourceType,jdbcType=VARCHAR},
      </if>
      <if test="record.resourceState != null">
        resource_state = #{record.resourceState,jdbcType=VARCHAR},
      </if>
      <if test="record.resourceName != null">
        resource_name = #{record.resourceName,jdbcType=VARCHAR},
      </if>
      <if test="record.resourceIdentity != null">
        resource_identity = #{record.resourceIdentity,jdbcType=VARCHAR},
      </if>
      <if test="record.resourceSummary != null">
        resource_summary = #{record.resourceSummary,jdbcType=VARCHAR},
      </if>
      <if test="record.registerDate != null">
        register_date = #{record.registerDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.catelogType != null">
        catelog_type = #{record.catelogType,jdbcType=VARCHAR},
      </if>
      <if test="record.catelogBasic != null">
        catelog_basic = #{record.catelogBasic,jdbcType=BIGINT},
      </if>
      <if test="record.catelogSector != null">
        catelog_sector = #{record.catelogSector,jdbcType=BIGINT},
      </if>
      <if test="record.catelogTheme != null">
        catelog_theme = #{record.catelogTheme,jdbcType=BIGINT},
      </if>
      <if test="record.catelogCustom != null">
        catelog_custom = #{record.catelogCustom,jdbcType=BIGINT},
      </if>
      <if test="record.shareType != null">
        share_type = #{record.shareType,jdbcType=VARCHAR},
      </if>
      <if test="record.openType != null">
        open_type = #{record.openType,jdbcType=VARCHAR},
      </if>
      <if test="record.allowDeal != null">
        allow_deal = #{record.allowDeal,jdbcType=TINYINT},
      </if>
      <if test="record.auditedBy != null">
        audited_by = #{record.auditedBy,jdbcType=BIGINT},
      </if>
      <if test="record.auditedAt != null">
        audited_at = #{record.auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.auditResult != null">
        audit_result = #{record.auditResult,jdbcType=VARCHAR},
      </if>
      <if test="record.auditOpinion != null">
        audit_opinion = #{record.auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=BIGINT},
      </if>
      <if test="record.deletedAt != null">
        deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedBy != null">
        deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      </if>
      <if test="record.outId1 != null">
        out_id_1 = #{record.outId1,jdbcType=VARCHAR},
      </if>
      <if test="record.outId2 != null">
        out_id_2 = #{record.outId2,jdbcType=VARCHAR},
      </if>
      <if test="record.outId3 != null">
        out_id_3 = #{record.outId3,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update resource
    set id = #{record.id,jdbcType=BIGINT},
      resource_type = #{record.resourceType,jdbcType=VARCHAR},
      resource_state = #{record.resourceState,jdbcType=VARCHAR},
      resource_name = #{record.resourceName,jdbcType=VARCHAR},
      resource_identity = #{record.resourceIdentity,jdbcType=VARCHAR},
      resource_summary = #{record.resourceSummary,jdbcType=VARCHAR},
      register_date = #{record.registerDate,jdbcType=TIMESTAMP},
      catelog_type = #{record.catelogType,jdbcType=VARCHAR},
      catelog_basic = #{record.catelogBasic,jdbcType=BIGINT},
      catelog_sector = #{record.catelogSector,jdbcType=BIGINT},
      catelog_theme = #{record.catelogTheme,jdbcType=BIGINT},
      catelog_custom = #{record.catelogCustom,jdbcType=BIGINT},
      share_type = #{record.shareType,jdbcType=VARCHAR},
      open_type = #{record.openType,jdbcType=VARCHAR},
      allow_deal = #{record.allowDeal,jdbcType=TINYINT},
      audited_by = #{record.auditedBy,jdbcType=BIGINT},
      audited_at = #{record.auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{record.auditResult,jdbcType=VARCHAR},
      audit_opinion = #{record.auditOpinion,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      out_id_1 = #{record.outId1,jdbcType=VARCHAR},
      out_id_2 = #{record.outId2,jdbcType=VARCHAR},
      out_id_3 = #{record.outId3,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataportal.entity.Resource">
    update resource
    <set>
      <if test="resourceType != null">
        resource_type = #{resourceType,jdbcType=VARCHAR},
      </if>
      <if test="resourceState != null">
        resource_state = #{resourceState,jdbcType=VARCHAR},
      </if>
      <if test="resourceName != null">
        resource_name = #{resourceName,jdbcType=VARCHAR},
      </if>
      <if test="resourceIdentity != null">
        resource_identity = #{resourceIdentity,jdbcType=VARCHAR},
      </if>
      <if test="resourceSummary != null">
        resource_summary = #{resourceSummary,jdbcType=VARCHAR},
      </if>
      <if test="registerDate != null">
        register_date = #{registerDate,jdbcType=TIMESTAMP},
      </if>
      <if test="catelogType != null">
        catelog_type = #{catelogType,jdbcType=VARCHAR},
      </if>
      <if test="catelogBasic != null">
        catelog_basic = #{catelogBasic,jdbcType=BIGINT},
      </if>
      <if test="catelogSector != null">
        catelog_sector = #{catelogSector,jdbcType=BIGINT},
      </if>
      <if test="catelogTheme != null">
        catelog_theme = #{catelogTheme,jdbcType=BIGINT},
      </if>
      <if test="catelogCustom != null">
        catelog_custom = #{catelogCustom,jdbcType=BIGINT},
      </if>
      <if test="shareType != null">
        share_type = #{shareType,jdbcType=VARCHAR},
      </if>
      <if test="openType != null">
        open_type = #{openType,jdbcType=VARCHAR},
      </if>
      <if test="allowDeal != null">
        allow_deal = #{allowDeal,jdbcType=TINYINT},
      </if>
      <if test="auditedBy != null">
        audited_by = #{auditedBy,jdbcType=BIGINT},
      </if>
      <if test="auditedAt != null">
        audited_at = #{auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="auditResult != null">
        audit_result = #{auditResult,jdbcType=VARCHAR},
      </if>
      <if test="auditOpinion != null">
        audit_opinion = #{auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        deleted_by = #{deletedBy,jdbcType=BIGINT},
      </if>
      <if test="outId1 != null">
        out_id_1 = #{outId1,jdbcType=VARCHAR},
      </if>
      <if test="outId2 != null">
        out_id_2 = #{outId2,jdbcType=VARCHAR},
      </if>
      <if test="outId3 != null">
        out_id_3 = #{outId3,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataportal.entity.Resource">
    update resource
    set resource_type = #{resourceType,jdbcType=VARCHAR},
      resource_state = #{resourceState,jdbcType=VARCHAR},
      resource_name = #{resourceName,jdbcType=VARCHAR},
      resource_identity = #{resourceIdentity,jdbcType=VARCHAR},
      resource_summary = #{resourceSummary,jdbcType=VARCHAR},
      register_date = #{registerDate,jdbcType=TIMESTAMP},
      catelog_type = #{catelogType,jdbcType=VARCHAR},
      catelog_basic = #{catelogBasic,jdbcType=BIGINT},
      catelog_sector = #{catelogSector,jdbcType=BIGINT},
      catelog_theme = #{catelogTheme,jdbcType=BIGINT},
      catelog_custom = #{catelogCustom,jdbcType=BIGINT},
      share_type = #{shareType,jdbcType=VARCHAR},
      open_type = #{openType,jdbcType=VARCHAR},
      allow_deal = #{allowDeal,jdbcType=TINYINT},
      audited_by = #{auditedBy,jdbcType=BIGINT},
      audited_at = #{auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{auditResult,jdbcType=VARCHAR},
      audit_opinion = #{auditOpinion,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT},
      out_id_1 = #{outId1,jdbcType=VARCHAR},
      out_id_2 = #{outId2,jdbcType=VARCHAR},
      out_id_3 = #{outId3,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>