<?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.hsdataplatform.mapper.DataCatelogMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataplatform.entity.DataCatelog">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="data_name" jdbcType="VARCHAR" property="dataName" />
    <result column="data_code" jdbcType="VARCHAR" property="dataCode" />
    <result column="supplier" jdbcType="BIGINT" property="supplier" />
    <result column="supplier_dept" jdbcType="BIGINT" property="supplierDept" />
    <result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
    <result column="data_summary" jdbcType="VARCHAR" property="dataSummary" />
    <result column="data_source_type" jdbcType="VARCHAR" property="dataSourceType" />
    <result column="data_source" jdbcType="VARCHAR" property="dataSource" />
    <result column="update_cycle" jdbcType="VARCHAR" property="updateCycle" />
    <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
    <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="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" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.lightinit.hsdataplatform.entity.DataCatelogWithBLOBs">
    <result column="data_source_other" jdbcType="LONGVARCHAR" property="dataSourceOther" />
    <result column="relation" jdbcType="LONGVARCHAR" property="relation" />
  </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, data_name, data_code, supplier, supplier_dept, supplier_code, data_summary, data_source_type, 
    data_source, update_cycle, publish_time, catelog_type, catelog_basic, catelog_sector, 
    catelog_theme, catelog_custom, created_at, created_by, deleted_at, deleted_by
  </sql>
  <sql id="Blob_Column_List">
    data_source_other, relation
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from data_catelog
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="page != null" >
      limit ${page.beginIndex},${page.pageSize}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from data_catelog
    <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="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from data_catelog
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from data_catelog
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogExample">
    delete from data_catelog
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into data_catelog (data_name, data_code, supplier, 
      supplier_dept, supplier_code, data_summary, 
      data_source_type, data_source, update_cycle, 
      publish_time, catelog_type, catelog_basic, 
      catelog_sector, catelog_theme, catelog_custom, 
      created_at, created_by, deleted_at, 
      deleted_by, data_source_other, relation
      )
    values (#{dataName,jdbcType=VARCHAR}, #{dataCode,jdbcType=VARCHAR}, #{supplier,jdbcType=BIGINT}, 
      #{supplierDept,jdbcType=BIGINT}, #{supplierCode,jdbcType=VARCHAR}, #{dataSummary,jdbcType=VARCHAR}, 
      #{dataSourceType,jdbcType=VARCHAR}, #{dataSource,jdbcType=VARCHAR}, #{updateCycle,jdbcType=VARCHAR}, 
      #{publishTime,jdbcType=TIMESTAMP}, #{catelogType,jdbcType=VARCHAR}, #{catelogBasic,jdbcType=BIGINT}, 
      #{catelogSector,jdbcType=BIGINT}, #{catelogTheme,jdbcType=BIGINT}, #{catelogCustom,jdbcType=BIGINT}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP}, 
      #{deletedBy,jdbcType=BIGINT}, #{dataSourceOther,jdbcType=LONGVARCHAR}, #{relation,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into data_catelog
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dataName != null">
        data_name,
      </if>
      <if test="dataCode != null">
        data_code,
      </if>
      <if test="supplier != null">
        supplier,
      </if>
      <if test="supplierDept != null">
        supplier_dept,
      </if>
      <if test="supplierCode != null">
        supplier_code,
      </if>
      <if test="dataSummary != null">
        data_summary,
      </if>
      <if test="dataSourceType != null">
        data_source_type,
      </if>
      <if test="dataSource != null">
        data_source,
      </if>
      <if test="updateCycle != null">
        update_cycle,
      </if>
      <if test="publishTime != null">
        publish_time,
      </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="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="dataSourceOther != null">
        data_source_other,
      </if>
      <if test="relation != null">
        relation,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dataName != null">
        #{dataName,jdbcType=VARCHAR},
      </if>
      <if test="dataCode != null">
        #{dataCode,jdbcType=VARCHAR},
      </if>
      <if test="supplier != null">
        #{supplier,jdbcType=BIGINT},
      </if>
      <if test="supplierDept != null">
        #{supplierDept,jdbcType=BIGINT},
      </if>
      <if test="supplierCode != null">
        #{supplierCode,jdbcType=VARCHAR},
      </if>
      <if test="dataSummary != null">
        #{dataSummary,jdbcType=VARCHAR},
      </if>
      <if test="dataSourceType != null">
        #{dataSourceType,jdbcType=VARCHAR},
      </if>
      <if test="dataSource != null">
        #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="updateCycle != null">
        #{updateCycle,jdbcType=VARCHAR},
      </if>
      <if test="publishTime != null">
        #{publishTime,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="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="dataSourceOther != null">
        #{dataSourceOther,jdbcType=LONGVARCHAR},
      </if>
      <if test="relation != null">
        #{relation,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogExample" resultType="java.lang.Long">
    select count(*) from data_catelog
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update data_catelog
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dataName != null">
        data_name = #{record.dataName,jdbcType=VARCHAR},
      </if>
      <if test="record.dataCode != null">
        data_code = #{record.dataCode,jdbcType=VARCHAR},
      </if>
      <if test="record.supplier != null">
        supplier = #{record.supplier,jdbcType=BIGINT},
      </if>
      <if test="record.supplierDept != null">
        supplier_dept = #{record.supplierDept,jdbcType=BIGINT},
      </if>
      <if test="record.supplierCode != null">
        supplier_code = #{record.supplierCode,jdbcType=VARCHAR},
      </if>
      <if test="record.dataSummary != null">
        data_summary = #{record.dataSummary,jdbcType=VARCHAR},
      </if>
      <if test="record.dataSourceType != null">
        data_source_type = #{record.dataSourceType,jdbcType=VARCHAR},
      </if>
      <if test="record.dataSource != null">
        data_source = #{record.dataSource,jdbcType=VARCHAR},
      </if>
      <if test="record.updateCycle != null">
        update_cycle = #{record.updateCycle,jdbcType=VARCHAR},
      </if>
      <if test="record.publishTime != null">
        publish_time = #{record.publishTime,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.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.dataSourceOther != null">
        data_source_other = #{record.dataSourceOther,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.relation != null">
        relation = #{record.relation,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update data_catelog
    set id = #{record.id,jdbcType=BIGINT},
      data_name = #{record.dataName,jdbcType=VARCHAR},
      data_code = #{record.dataCode,jdbcType=VARCHAR},
      supplier = #{record.supplier,jdbcType=BIGINT},
      supplier_dept = #{record.supplierDept,jdbcType=BIGINT},
      supplier_code = #{record.supplierCode,jdbcType=VARCHAR},
      data_summary = #{record.dataSummary,jdbcType=VARCHAR},
      data_source_type = #{record.dataSourceType,jdbcType=VARCHAR},
      data_source = #{record.dataSource,jdbcType=VARCHAR},
      update_cycle = #{record.updateCycle,jdbcType=VARCHAR},
      publish_time = #{record.publishTime,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},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      data_source_other = #{record.dataSourceOther,jdbcType=LONGVARCHAR},
      relation = #{record.relation,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update data_catelog
    set id = #{record.id,jdbcType=BIGINT},
      data_name = #{record.dataName,jdbcType=VARCHAR},
      data_code = #{record.dataCode,jdbcType=VARCHAR},
      supplier = #{record.supplier,jdbcType=BIGINT},
      supplier_dept = #{record.supplierDept,jdbcType=BIGINT},
      supplier_code = #{record.supplierCode,jdbcType=VARCHAR},
      data_summary = #{record.dataSummary,jdbcType=VARCHAR},
      data_source_type = #{record.dataSourceType,jdbcType=VARCHAR},
      data_source = #{record.dataSource,jdbcType=VARCHAR},
      update_cycle = #{record.updateCycle,jdbcType=VARCHAR},
      publish_time = #{record.publishTime,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},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogWithBLOBs">
    update data_catelog
    <set>
      <if test="dataName != null">
        data_name = #{dataName,jdbcType=VARCHAR},
      </if>
      <if test="dataCode != null">
        data_code = #{dataCode,jdbcType=VARCHAR},
      </if>
      <if test="supplier != null">
        supplier = #{supplier,jdbcType=BIGINT},
      </if>
      <if test="supplierDept != null">
        supplier_dept = #{supplierDept,jdbcType=BIGINT},
      </if>
      <if test="supplierCode != null">
        supplier_code = #{supplierCode,jdbcType=VARCHAR},
      </if>
      <if test="dataSummary != null">
        data_summary = #{dataSummary,jdbcType=VARCHAR},
      </if>
      <if test="dataSourceType != null">
        data_source_type = #{dataSourceType,jdbcType=VARCHAR},
      </if>
      <if test="dataSource != null">
        data_source = #{dataSource,jdbcType=VARCHAR},
      </if>
      <if test="updateCycle != null">
        update_cycle = #{updateCycle,jdbcType=VARCHAR},
      </if>
      <if test="publishTime != null">
        publish_time = #{publishTime,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="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="dataSourceOther != null">
        data_source_other = #{dataSourceOther,jdbcType=LONGVARCHAR},
      </if>
      <if test="relation != null">
        relation = #{relation,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogWithBLOBs">
    update data_catelog
    set data_name = #{dataName,jdbcType=VARCHAR},
      data_code = #{dataCode,jdbcType=VARCHAR},
      supplier = #{supplier,jdbcType=BIGINT},
      supplier_dept = #{supplierDept,jdbcType=BIGINT},
      supplier_code = #{supplierCode,jdbcType=VARCHAR},
      data_summary = #{dataSummary,jdbcType=VARCHAR},
      data_source_type = #{dataSourceType,jdbcType=VARCHAR},
      data_source = #{dataSource,jdbcType=VARCHAR},
      update_cycle = #{updateCycle,jdbcType=VARCHAR},
      publish_time = #{publishTime,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},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT},
      data_source_other = #{dataSourceOther,jdbcType=LONGVARCHAR},
      relation = #{relation,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataplatform.entity.DataCatelog">
    update data_catelog
    set data_name = #{dataName,jdbcType=VARCHAR},
      data_code = #{dataCode,jdbcType=VARCHAR},
      supplier = #{supplier,jdbcType=BIGINT},
      supplier_dept = #{supplierDept,jdbcType=BIGINT},
      supplier_code = #{supplierCode,jdbcType=VARCHAR},
      data_summary = #{dataSummary,jdbcType=VARCHAR},
      data_source_type = #{dataSourceType,jdbcType=VARCHAR},
      data_source = #{dataSource,jdbcType=VARCHAR},
      update_cycle = #{updateCycle,jdbcType=VARCHAR},
      publish_time = #{publishTime,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},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <!--sun-->
  <select id="getDataCatelogList1111" parameterType="com.lightinit.hsdataplatform.model.admin.DataCatelogListModel" resultType="com.lightinit.hsdataplatform.model.admin.DataCatelogListModel">
    <if test="dataName !=null and dataName !=''">
      <bind name="dataNameLike" value="'%'+dataName+'%'"></bind>
    </if>
    <if test="sectorName !=null and sectorName !=''">
      <bind name="sectorNameLike" value="'%'+sectorName+'%'"></bind>
    </if>
    SELECT dc.id,dc.catelog_type,dc.data_code,dc.data_name,dc.data_summary,dc.data_source_type,d.dic_name AS data_sourceTypeString,dc.supplier,
  s.sector_name,dci.item_name,dc.catelog_custom,dci.share_type,
    CONCAT(
    IFNULL(rc1.catelog_name,''),' ',
    IFNULL(rc2.catelog_name,''),' ',
    IFNULL(rc3.catelog_name,''),' ',
    IFNULL(rc4.catelog_name,''),' '
    ) AS catelog_name
  FROM data_catelog dc
  LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
  LEFT JOIN sector s ON dc.supplier = s.id
  LEFT JOIN dictionary d ON d.id=dc.data_source_type
  LEFT JOIN resource_catelog rc1 ON dc.catelog_basic=rc1.id
  LEFT JOIN resource_catelog rc2 ON dc.catelog_sector=rc2.id
  LEFT JOIN resource_catelog rc3 ON dc.catelog_theme=rc3.id
  LEFT JOIN resource_catelog rc4 ON dc.catelog_custom=rc4.id
    <where>
      <if test="shareType !=null and shareType !=''">
        and dci.share_type=#{shareType}
      </if>
      <if test="dataName !=null and dataName !=''">
        and dc.data_name Like #{dataNameLike}
      </if>
      <if test="sectorName !=null and sectorName !=''">
        and s.sector_name Like #{sectorNameLike}
      </if>
        <if test="supplier !=null ">
        and dc.supplier Like #{supplier}
      </if>
    </where>
  </select>
  <!--sun-->
  <select id="getDataCatelogList" parameterType="com.lightinit.hsdataplatform.model.admin.DataCatelogListModel" resultType="com.lightinit.hsdataplatform.model.admin.DataCatelogListModel">
    <if test="catelogName !=null and catelogName !=''">
      <bind name="catelogNameLike" value="'%'+catelogName+'%'"></bind>
    </if>
    <if test="dataName !=null and dataName !=''">
     <bind name="dataNameLike" value="'%'+dataName+'%'"></bind>
    </if>
    <if test="sectorName !=null and sectorName !=''">
      <bind name="sectorNameLike" value="'%'+sectorName+'%'"></bind>
    </if>
      SELECT * FROM(
      SELECT dc.id,dc.catelog_type,dc.data_code,dc.data_name,dc.data_summary,dc.data_source_type,d.dic_name AS data_sourceTypeString,dc.supplier,
      s.sector_name,dci.item_name,dc.catelog_custom,dci.share_type,
      TRIM(CONCAT(
      IFNULL(rc1.catelog_name,''),'  ',
      IFNULL(rc2.catelog_name,''),'  ',
      IFNULL(rc3.catelog_name,''),'  ',
      IFNULL(rc4.catelog_name,''),'  '
      )) AS catelog_name
      FROM data_catelog dc
      LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
      LEFT JOIN sector s ON dc.supplier = s.id
      LEFT JOIN dictionary d ON d.id=dc.data_source_type
      LEFT JOIN resource_catelog rc1 ON dc.catelog_basic=rc1.id
      LEFT JOIN resource_catelog rc2 ON dc.catelog_sector=rc2.id
      LEFT JOIN resource_catelog rc3 ON dc.catelog_theme=rc3.id
      LEFT JOIN resource_catelog rc4 ON dc.catelog_custom=rc4.id
      <where>
          <if test="shareType !=null and shareType !=''">
              and dci.share_type=#{shareType}
          </if>
          <if test="dataName !=null and dataName !=''">
              and dc.data_name Like #{dataNameLike}
          </if>
          <if test="sectorName !=null and sectorName !=''">
              and s.sector_name Like #{sectorNameLike}
          </if>
          <if test="supplier !=null ">
              and dc.supplier = #{supplier}
          </if>
      </where>
      ) AS A
      <where>
          <if test="catelogName !=null and catelogName !=''">
              catelog_name LIKE #{catelogNameLike}
          </if>
      </where>
      <if test="page != null" >
          limit ${page.beginIndex},${page.pageSize}
      </if>
  </select>
  <!--sun-->
  <select id="getDataCatelogListCount" parameterType="com.lightinit.hsdataplatform.model.admin.DataCatelogListModel" resultType="long">
      <if test="catelogName !=null and catelogName !=''">
          <bind name="catelogNameLike" value="'%'+catelogName+'%'"></bind>
      </if>
      <if test="dataName !=null and dataName !=''">
          <bind name="dataNameLike" value="'%'+dataName+'%'"></bind>
      </if>
      <if test="sectorName !=null and sectorName !=''">
          <bind name="sectorNameLike" value="'%'+sectorName+'%'"></bind>
      </if>
      SELECT COUNT(*) FROM(
      SELECT dc.id,dc.catelog_type,dc.data_code,dc.data_name,dc.data_summary,dc.data_source_type,d.dic_name AS data_sourceTypeString,dc.supplier,
      s.sector_name,dci.item_name,dc.catelog_custom,dci.share_type,
      TRIM(CONCAT(
      IFNULL(rc1.catelog_name,''),'  ',
      IFNULL(rc2.catelog_name,''),'  ',
      IFNULL(rc3.catelog_name,''),'  ',
      IFNULL(rc4.catelog_name,''),'  '
      )) AS catelog_name
      FROM data_catelog dc
      LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
      LEFT JOIN sector s ON dc.supplier = s.id
      LEFT JOIN dictionary d ON d.id=dc.data_source_type
      LEFT JOIN resource_catelog rc1 ON dc.catelog_basic=rc1.id
      LEFT JOIN resource_catelog rc2 ON dc.catelog_sector=rc2.id
      LEFT JOIN resource_catelog rc3 ON dc.catelog_theme=rc3.id
      LEFT JOIN resource_catelog rc4 ON dc.catelog_custom=rc4.id
      <where>
          <if test="shareType !=null and shareType !=''">
              and dci.share_type=#{shareType}
          </if>
          <if test="dataName !=null and dataName !=''">
              and dc.data_name Like #{dataNameLike}
          </if>
          <if test="sectorName !=null and sectorName !=''">
              and s.sector_name Like #{sectorNameLike}
          </if>
          <if test="supplier !=null ">
              and dc.supplier Like #{supplier}
          </if>
      </where>
      ) AS A
      <where>
          <if test="catelogName !=null and catelogName !=''">
              catelog_name LIKE #{catelogNameLike}
          </if>
      </where>
  </select>

  <!--sx视图-->
  <select id="getAllDataToView" resultType="com.lightinit.hsdataplatform.model.admin.SectorDataStaticsModel">
  SELECT s.id,CONCAT(IFNULL(s.sector_name,'未命名'),'(',COUNT(*),')') AS `name`,concat('id_',s.id) AS `value`
    FROM data_catelog dc
    LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
    LEFT JOIN sector s ON dc.supplier = s.id
    LEFT JOIN dictionary d ON d.id=dc.data_source_type
    WHERE s.id IS NOT NULL
    GROUP BY s.id
    ORDER BY id DESC
  </select>


    <!--sx-->
    <select id="getDataById" resultType="com.lightinit.hsdataplatform.model.admin.SectorDataStaticsModel">
SELECT dc.data_name AS `name`,dc.data_name AS `value`,
s.sector_name
FROM data_catelog dc LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
LEFT JOIN sector s ON dc.supplier = s.id
LEFT JOIN dictionary d ON d.id=dc.data_source_type
        WHERE s.id=#{id}
        group by `name`
    </select>

 <!--sx-->
    <select id="getChildrenByDataName" resultType="com.lightinit.hsdataplatform.model.admin.SectorChirdrenModel">
SELECT dci.item_name AS `name`,dci.item_name AS `value`
FROM data_catelog dc LEFT JOIN data_catelog_item dci ON dci.data_catelog_id=dc.id
LEFT JOIN sector s ON dc.supplier = s.id LEFT JOIN dictionary d ON d.id=dc.data_source_type
WHERE  dc.data_name=#{name} AND  dci.item_name IS NOT NULL
    </select>

</mapper>