<?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.RequirementDataMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataportal.entity.RequirementData">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="data_uses" jdbcType="VARCHAR" property="dataUses" />
    <result column="sector_id" jdbcType="BIGINT" property="sectorId" />
    <result column="rqrmnt_sector_id" jdbcType="BIGINT" property="rqrmntSectorId" />
    <result column="data_add_mode" jdbcType="VARCHAR" property="dataAddMode" />
    <result column="feedback_at" jdbcType="TIMESTAMP" property="feedbackAt" />
    <result column="feedback_by" jdbcType="BIGINT" property="feedbackBy" />
    <result column="feedback_result" jdbcType="VARCHAR" property="feedbackResult" />
    <result column="feedback_desc" jdbcType="VARCHAR" property="feedbackDesc" />
    <result column="data_publish_url" jdbcType="VARCHAR" property="dataPublishUrl" />
    <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>
  <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_uses, sector_id, rqrmnt_sector_id, data_add_mode, feedback_at, feedback_by, 
    feedback_result, feedback_desc, data_publish_url, created_at, created_by, deleted_at, 
    deleted_by
  </sql>
  <select id="selectByExample" parameterType="com.lightinit.hsdataportal.entity.RequirementDataExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from requirement_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 requirement_data
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from requirement_data
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataportal.entity.RequirementDataExample">
    delete from requirement_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataportal.entity.RequirementData">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into requirement_data (data_uses, sector_id, rqrmnt_sector_id, 
      data_add_mode, feedback_at, feedback_by, 
      feedback_result, feedback_desc, data_publish_url, 
      created_at, created_by, deleted_at, 
      deleted_by)
    values (#{dataUses,jdbcType=VARCHAR}, #{sectorId,jdbcType=BIGINT}, #{rqrmntSectorId,jdbcType=BIGINT}, 
      #{dataAddMode,jdbcType=VARCHAR}, #{feedbackAt,jdbcType=TIMESTAMP}, #{feedbackBy,jdbcType=BIGINT}, 
      #{feedbackResult,jdbcType=VARCHAR}, #{feedbackDesc,jdbcType=VARCHAR}, #{dataPublishUrl,jdbcType=VARCHAR}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP}, 
      #{deletedBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataportal.entity.RequirementData">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into requirement_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dataUses != null">
        data_uses,
      </if>
      <if test="sectorId != null">
        sector_id,
      </if>
      <if test="rqrmntSectorId != null">
        rqrmnt_sector_id,
      </if>
      <if test="dataAddMode != null">
        data_add_mode,
      </if>
      <if test="feedbackAt != null">
        feedback_at,
      </if>
      <if test="feedbackBy != null">
        feedback_by,
      </if>
      <if test="feedbackResult != null">
        feedback_result,
      </if>
      <if test="feedbackDesc != null">
        feedback_desc,
      </if>
      <if test="dataPublishUrl != null">
        data_publish_url,
      </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>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dataUses != null">
        #{dataUses,jdbcType=VARCHAR},
      </if>
      <if test="sectorId != null">
        #{sectorId,jdbcType=BIGINT},
      </if>
      <if test="rqrmntSectorId != null">
        #{rqrmntSectorId,jdbcType=BIGINT},
      </if>
      <if test="dataAddMode != null">
        #{dataAddMode,jdbcType=VARCHAR},
      </if>
      <if test="feedbackAt != null">
        #{feedbackAt,jdbcType=TIMESTAMP},
      </if>
      <if test="feedbackBy != null">
        #{feedbackBy,jdbcType=BIGINT},
      </if>
      <if test="feedbackResult != null">
        #{feedbackResult,jdbcType=VARCHAR},
      </if>
      <if test="feedbackDesc != null">
        #{feedbackDesc,jdbcType=VARCHAR},
      </if>
      <if test="dataPublishUrl != null">
        #{dataPublishUrl,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>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataportal.entity.RequirementDataExample" resultType="java.lang.Long">
    select count(*) from requirement_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update requirement_data
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dataUses != null">
        data_uses = #{record.dataUses,jdbcType=VARCHAR},
      </if>
      <if test="record.sectorId != null">
        sector_id = #{record.sectorId,jdbcType=BIGINT},
      </if>
      <if test="record.rqrmntSectorId != null">
        rqrmnt_sector_id = #{record.rqrmntSectorId,jdbcType=BIGINT},
      </if>
      <if test="record.dataAddMode != null">
        data_add_mode = #{record.dataAddMode,jdbcType=VARCHAR},
      </if>
      <if test="record.feedbackAt != null">
        feedback_at = #{record.feedbackAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.feedbackBy != null">
        feedback_by = #{record.feedbackBy,jdbcType=BIGINT},
      </if>
      <if test="record.feedbackResult != null">
        feedback_result = #{record.feedbackResult,jdbcType=VARCHAR},
      </if>
      <if test="record.feedbackDesc != null">
        feedback_desc = #{record.feedbackDesc,jdbcType=VARCHAR},
      </if>
      <if test="record.dataPublishUrl != null">
        data_publish_url = #{record.dataPublishUrl,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>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update requirement_data
    set id = #{record.id,jdbcType=BIGINT},
      data_uses = #{record.dataUses,jdbcType=VARCHAR},
      sector_id = #{record.sectorId,jdbcType=BIGINT},
      rqrmnt_sector_id = #{record.rqrmntSectorId,jdbcType=BIGINT},
      data_add_mode = #{record.dataAddMode,jdbcType=VARCHAR},
      feedback_at = #{record.feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{record.feedbackBy,jdbcType=BIGINT},
      feedback_result = #{record.feedbackResult,jdbcType=VARCHAR},
      feedback_desc = #{record.feedbackDesc,jdbcType=VARCHAR},
      data_publish_url = #{record.dataPublishUrl,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}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataportal.entity.RequirementData">
    update requirement_data
    <set>
      <if test="dataUses != null">
        data_uses = #{dataUses,jdbcType=VARCHAR},
      </if>
      <if test="sectorId != null">
        sector_id = #{sectorId,jdbcType=BIGINT},
      </if>
      <if test="rqrmntSectorId != null">
        rqrmnt_sector_id = #{rqrmntSectorId,jdbcType=BIGINT},
      </if>
      <if test="dataAddMode != null">
        data_add_mode = #{dataAddMode,jdbcType=VARCHAR},
      </if>
      <if test="feedbackAt != null">
        feedback_at = #{feedbackAt,jdbcType=TIMESTAMP},
      </if>
      <if test="feedbackBy != null">
        feedback_by = #{feedbackBy,jdbcType=BIGINT},
      </if>
      <if test="feedbackResult != null">
        feedback_result = #{feedbackResult,jdbcType=VARCHAR},
      </if>
      <if test="feedbackDesc != null">
        feedback_desc = #{feedbackDesc,jdbcType=VARCHAR},
      </if>
      <if test="dataPublishUrl != null">
        data_publish_url = #{dataPublishUrl,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>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataportal.entity.RequirementData">
    update requirement_data
    set data_uses = #{dataUses,jdbcType=VARCHAR},
      sector_id = #{sectorId,jdbcType=BIGINT},
      rqrmnt_sector_id = #{rqrmntSectorId,jdbcType=BIGINT},
      data_add_mode = #{dataAddMode,jdbcType=VARCHAR},
      feedback_at = #{feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{feedbackBy,jdbcType=BIGINT},
      feedback_result = #{feedbackResult,jdbcType=VARCHAR},
      feedback_desc = #{feedbackDesc,jdbcType=VARCHAR},
      data_publish_url = #{dataPublishUrl,jdbcType=VARCHAR},
      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>

  <insert id="insertRequirementDataId" parameterType="com.lightinit.hsdataportal.entity.RequirementData">
    insert into requirement_data (id, data_uses, sector_id, rqrmnt_sector_id,
    data_add_mode, feedback_at, feedback_by,
    feedback_result, feedback_desc, data_publish_url,
    created_at, created_by, deleted_at,
    deleted_by)
    values (#{id}, #{dataUses,jdbcType=VARCHAR}, #{sectorId,jdbcType=BIGINT}, #{rqrmntSectorId,jdbcType=BIGINT},
    #{dataAddMode,jdbcType=VARCHAR}, #{feedbackAt,jdbcType=TIMESTAMP}, #{feedbackBy,jdbcType=BIGINT},
    #{feedbackResult,jdbcType=VARCHAR}, #{feedbackDesc,jdbcType=VARCHAR}, #{dataPublishUrl,jdbcType=VARCHAR},
    #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP},
    #{deletedBy,jdbcType=BIGINT})
  </insert>
</mapper>