<?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.LeaveMessageMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataportal.entity.LeaveMessage">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="msg_state" jdbcType="VARCHAR" property="msgState" />
    <result column="publish_by" jdbcType="BIGINT" property="publishBy" />
    <result column="publish_at" jdbcType="TIMESTAMP" property="publishAt" />
    <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_content" jdbcType="VARCHAR" property="feedbackContent" />
    <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.hsdataportal.entity.LeaveMessage">
    <result column="msg_content" jdbcType="LONGVARCHAR" property="msgContent" />
  </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, msg_state, publish_by, publish_at, feedback_at, feedback_by, feedback_result, 
    feedback_content, created_at, created_by, deleted_at, deleted_by
  </sql>
  <sql id="Blob_Column_List">
    msg_content
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.lightinit.hsdataportal.entity.LeaveMessageExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from leave_message
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.lightinit.hsdataportal.entity.LeaveMessageExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from leave_message
    <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 leave_message
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from leave_message
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataportal.entity.LeaveMessageExample">
    delete from leave_message
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataportal.entity.LeaveMessage">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into leave_message (msg_state, publish_by, publish_at, 
      feedback_at, feedback_by, feedback_result, 
      feedback_content, created_at, created_by, 
      deleted_at, deleted_by, msg_content
      )
    values (#{msgState,jdbcType=VARCHAR}, #{publishBy,jdbcType=BIGINT}, #{publishAt,jdbcType=TIMESTAMP}, 
      #{feedbackAt,jdbcType=TIMESTAMP}, #{feedbackBy,jdbcType=BIGINT}, #{feedbackResult,jdbcType=VARCHAR}, 
      #{feedbackContent,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, 
      #{deletedAt,jdbcType=TIMESTAMP}, #{deletedBy,jdbcType=BIGINT}, #{msgContent,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataportal.entity.LeaveMessage">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into leave_message
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="msgState != null">
        msg_state,
      </if>
      <if test="publishBy != null">
        publish_by,
      </if>
      <if test="publishAt != null">
        publish_at,
      </if>
      <if test="feedbackAt != null">
        feedback_at,
      </if>
      <if test="feedbackBy != null">
        feedback_by,
      </if>
      <if test="feedbackResult != null">
        feedback_result,
      </if>
      <if test="feedbackContent != null">
        feedback_content,
      </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="msgContent != null">
        msg_content,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="msgState != null">
        #{msgState,jdbcType=VARCHAR},
      </if>
      <if test="publishBy != null">
        #{publishBy,jdbcType=BIGINT},
      </if>
      <if test="publishAt != null">
        #{publishAt,jdbcType=TIMESTAMP},
      </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="feedbackContent != null">
        #{feedbackContent,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="msgContent != null">
        #{msgContent,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataportal.entity.LeaveMessageExample" resultType="java.lang.Long">
    select count(*) from leave_message
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update leave_message
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.msgState != null">
        msg_state = #{record.msgState,jdbcType=VARCHAR},
      </if>
      <if test="record.publishBy != null">
        publish_by = #{record.publishBy,jdbcType=BIGINT},
      </if>
      <if test="record.publishAt != null">
        publish_at = #{record.publishAt,jdbcType=TIMESTAMP},
      </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.feedbackContent != null">
        feedback_content = #{record.feedbackContent,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.msgContent != null">
        msg_content = #{record.msgContent,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update leave_message
    set id = #{record.id,jdbcType=BIGINT},
      msg_state = #{record.msgState,jdbcType=VARCHAR},
      publish_by = #{record.publishBy,jdbcType=BIGINT},
      publish_at = #{record.publishAt,jdbcType=TIMESTAMP},
      feedback_at = #{record.feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{record.feedbackBy,jdbcType=BIGINT},
      feedback_result = #{record.feedbackResult,jdbcType=VARCHAR},
      feedback_content = #{record.feedbackContent,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},
      msg_content = #{record.msgContent,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update leave_message
    set id = #{record.id,jdbcType=BIGINT},
      msg_state = #{record.msgState,jdbcType=VARCHAR},
      publish_by = #{record.publishBy,jdbcType=BIGINT},
      publish_at = #{record.publishAt,jdbcType=TIMESTAMP},
      feedback_at = #{record.feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{record.feedbackBy,jdbcType=BIGINT},
      feedback_result = #{record.feedbackResult,jdbcType=VARCHAR},
      feedback_content = #{record.feedbackContent,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.LeaveMessage">
    update leave_message
    <set>
      <if test="msgState != null">
        msg_state = #{msgState,jdbcType=VARCHAR},
      </if>
      <if test="publishBy != null">
        publish_by = #{publishBy,jdbcType=BIGINT},
      </if>
      <if test="publishAt != null">
        publish_at = #{publishAt,jdbcType=TIMESTAMP},
      </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="feedbackContent != null">
        feedback_content = #{feedbackContent,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="msgContent != null">
        msg_content = #{msgContent,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.lightinit.hsdataportal.entity.LeaveMessage">
    update leave_message
    set msg_state = #{msgState,jdbcType=VARCHAR},
      publish_by = #{publishBy,jdbcType=BIGINT},
      publish_at = #{publishAt,jdbcType=TIMESTAMP},
      feedback_at = #{feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{feedbackBy,jdbcType=BIGINT},
      feedback_result = #{feedbackResult,jdbcType=VARCHAR},
      feedback_content = #{feedbackContent,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT},
      msg_content = #{msgContent,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataportal.entity.LeaveMessage">
    update leave_message
    set msg_state = #{msgState,jdbcType=VARCHAR},
      publish_by = #{publishBy,jdbcType=BIGINT},
      publish_at = #{publishAt,jdbcType=TIMESTAMP},
      feedback_at = #{feedbackAt,jdbcType=TIMESTAMP},
      feedback_by = #{feedbackBy,jdbcType=BIGINT},
      feedback_result = #{feedbackResult,jdbcType=VARCHAR},
      feedback_content = #{feedbackContent,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>
</mapper>