<?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.notify.SysNotifyMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="category_id" jdbcType="INTEGER" property="categoryId" />
    <result column="template_id" jdbcType="INTEGER" property="templateId" />
    <result column="is_deleted" jdbcType="TINYINT" property="isDeleted" />
    <result column="from_time" jdbcType="TIMESTAMP" property="fromTime" />
    <result column="from_user_id" jdbcType="BIGINT" property="fromUserId" />
    <result column="identifier" jdbcType="VARCHAR" property="identifier" />
    <result column="to_time" jdbcType="TIMESTAMP" property="toTime" />
    <result column="to_user_id" jdbcType="BIGINT" property="toUserId" />
    <result column="to_user_name" jdbcType="VARCHAR" property="toUserName" />
    <result column="task_state" jdbcType="TINYINT" property="taskState" />
    <result column="is_readed" jdbcType="TINYINT" property="isReaded" />
    <result column="read_time" jdbcType="TIMESTAMP" property="readTime" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="detail_link" jdbcType="VARCHAR" property="detailLink" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    <result column="content" jdbcType="LONGVARCHAR" property="content" />
    <result column="message_body" jdbcType="LONGVARCHAR" property="messageBody" />
  </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, category_id, template_id, is_deleted, from_time, from_user_id, identifier, to_time, 
    to_user_id, to_user_name, task_state, is_readed, read_time, title, detail_link, remark
  </sql>
  <sql id="Blob_Column_List">
    content, message_body
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotifyExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from sys_notify
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotifyExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_notify
    <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 sys_notify
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_notify
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotifyExample">
    delete from sys_notify
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_notify (category_id, template_id, is_deleted, 
      from_time, from_user_id, identifier, 
      to_time, to_user_id, to_user_name, 
      task_state, is_readed, read_time, 
      title, detail_link, remark, 
      content, message_body)
    values (#{categoryId,jdbcType=INTEGER}, #{templateId,jdbcType=INTEGER}, #{isDeleted,jdbcType=TINYINT}, 
      #{fromTime,jdbcType=TIMESTAMP}, #{fromUserId,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, 
      #{toTime,jdbcType=TIMESTAMP}, #{toUserId,jdbcType=BIGINT}, #{toUserName,jdbcType=VARCHAR}, 
      #{taskState,jdbcType=TINYINT}, #{isReaded,jdbcType=TINYINT}, #{readTime,jdbcType=TIMESTAMP}, 
      #{title,jdbcType=VARCHAR}, #{detailLink,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
      #{content,jdbcType=LONGVARCHAR}, #{messageBody,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_notify
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="categoryId != null">
        category_id,
      </if>
      <if test="templateId != null">
        template_id,
      </if>
      <if test="isDeleted != null">
        is_deleted,
      </if>
      <if test="fromTime != null">
        from_time,
      </if>
      <if test="fromUserId != null">
        from_user_id,
      </if>
      <if test="identifier != null">
        identifier,
      </if>
      <if test="toTime != null">
        to_time,
      </if>
      <if test="toUserId != null">
        to_user_id,
      </if>
      <if test="toUserName != null">
        to_user_name,
      </if>
      <if test="taskState != null">
        task_state,
      </if>
      <if test="isReaded != null">
        is_readed,
      </if>
      <if test="readTime != null">
        read_time,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="detailLink != null">
        detail_link,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="messageBody != null">
        message_body,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="categoryId != null">
        #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="templateId != null">
        #{templateId,jdbcType=INTEGER},
      </if>
      <if test="isDeleted != null">
        #{isDeleted,jdbcType=TINYINT},
      </if>
      <if test="fromTime != null">
        #{fromTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fromUserId != null">
        #{fromUserId,jdbcType=BIGINT},
      </if>
      <if test="identifier != null">
        #{identifier,jdbcType=VARCHAR},
      </if>
      <if test="toTime != null">
        #{toTime,jdbcType=TIMESTAMP},
      </if>
      <if test="toUserId != null">
        #{toUserId,jdbcType=BIGINT},
      </if>
      <if test="toUserName != null">
        #{toUserName,jdbcType=VARCHAR},
      </if>
      <if test="taskState != null">
        #{taskState,jdbcType=TINYINT},
      </if>
      <if test="isReaded != null">
        #{isReaded,jdbcType=TINYINT},
      </if>
      <if test="readTime != null">
        #{readTime,jdbcType=TIMESTAMP},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="detailLink != null">
        #{detailLink,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=LONGVARCHAR},
      </if>
      <if test="messageBody != null">
        #{messageBody,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotifyExample" resultType="java.lang.Long">
    select count(*) from sys_notify
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_notify
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.categoryId != null">
        category_id = #{record.categoryId,jdbcType=INTEGER},
      </if>
      <if test="record.templateId != null">
        template_id = #{record.templateId,jdbcType=INTEGER},
      </if>
      <if test="record.isDeleted != null">
        is_deleted = #{record.isDeleted,jdbcType=TINYINT},
      </if>
      <if test="record.fromTime != null">
        from_time = #{record.fromTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.fromUserId != null">
        from_user_id = #{record.fromUserId,jdbcType=BIGINT},
      </if>
      <if test="record.identifier != null">
        identifier = #{record.identifier,jdbcType=VARCHAR},
      </if>
      <if test="record.toTime != null">
        to_time = #{record.toTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.toUserId != null">
        to_user_id = #{record.toUserId,jdbcType=BIGINT},
      </if>
      <if test="record.toUserName != null">
        to_user_name = #{record.toUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.taskState != null">
        task_state = #{record.taskState,jdbcType=TINYINT},
      </if>
      <if test="record.isReaded != null">
        is_readed = #{record.isReaded,jdbcType=TINYINT},
      </if>
      <if test="record.readTime != null">
        read_time = #{record.readTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.title != null">
        title = #{record.title,jdbcType=VARCHAR},
      </if>
      <if test="record.detailLink != null">
        detail_link = #{record.detailLink,jdbcType=VARCHAR},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.content != null">
        content = #{record.content,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.messageBody != null">
        message_body = #{record.messageBody,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update sys_notify
    set id = #{record.id,jdbcType=BIGINT},
      category_id = #{record.categoryId,jdbcType=INTEGER},
      template_id = #{record.templateId,jdbcType=INTEGER},
      is_deleted = #{record.isDeleted,jdbcType=TINYINT},
      from_time = #{record.fromTime,jdbcType=TIMESTAMP},
      from_user_id = #{record.fromUserId,jdbcType=BIGINT},
      identifier = #{record.identifier,jdbcType=VARCHAR},
      to_time = #{record.toTime,jdbcType=TIMESTAMP},
      to_user_id = #{record.toUserId,jdbcType=BIGINT},
      to_user_name = #{record.toUserName,jdbcType=VARCHAR},
      task_state = #{record.taskState,jdbcType=TINYINT},
      is_readed = #{record.isReaded,jdbcType=TINYINT},
      read_time = #{record.readTime,jdbcType=TIMESTAMP},
      title = #{record.title,jdbcType=VARCHAR},
      detail_link = #{record.detailLink,jdbcType=VARCHAR},
      remark = #{record.remark,jdbcType=VARCHAR},
      content = #{record.content,jdbcType=LONGVARCHAR},
      message_body = #{record.messageBody,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_notify
    set id = #{record.id,jdbcType=BIGINT},
      category_id = #{record.categoryId,jdbcType=INTEGER},
      template_id = #{record.templateId,jdbcType=INTEGER},
      is_deleted = #{record.isDeleted,jdbcType=TINYINT},
      from_time = #{record.fromTime,jdbcType=TIMESTAMP},
      from_user_id = #{record.fromUserId,jdbcType=BIGINT},
      identifier = #{record.identifier,jdbcType=VARCHAR},
      to_time = #{record.toTime,jdbcType=TIMESTAMP},
      to_user_id = #{record.toUserId,jdbcType=BIGINT},
      to_user_name = #{record.toUserName,jdbcType=VARCHAR},
      task_state = #{record.taskState,jdbcType=TINYINT},
      is_readed = #{record.isReaded,jdbcType=TINYINT},
      read_time = #{record.readTime,jdbcType=TIMESTAMP},
      title = #{record.title,jdbcType=VARCHAR},
      detail_link = #{record.detailLink,jdbcType=VARCHAR},
      remark = #{record.remark,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    update sys_notify
    <set>
      <if test="categoryId != null">
        category_id = #{categoryId,jdbcType=INTEGER},
      </if>
      <if test="templateId != null">
        template_id = #{templateId,jdbcType=INTEGER},
      </if>
      <if test="isDeleted != null">
        is_deleted = #{isDeleted,jdbcType=TINYINT},
      </if>
      <if test="fromTime != null">
        from_time = #{fromTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fromUserId != null">
        from_user_id = #{fromUserId,jdbcType=BIGINT},
      </if>
      <if test="identifier != null">
        identifier = #{identifier,jdbcType=VARCHAR},
      </if>
      <if test="toTime != null">
        to_time = #{toTime,jdbcType=TIMESTAMP},
      </if>
      <if test="toUserId != null">
        to_user_id = #{toUserId,jdbcType=BIGINT},
      </if>
      <if test="toUserName != null">
        to_user_name = #{toUserName,jdbcType=VARCHAR},
      </if>
      <if test="taskState != null">
        task_state = #{taskState,jdbcType=TINYINT},
      </if>
      <if test="isReaded != null">
        is_readed = #{isReaded,jdbcType=TINYINT},
      </if>
      <if test="readTime != null">
        read_time = #{readTime,jdbcType=TIMESTAMP},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="detailLink != null">
        detail_link = #{detailLink,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=LONGVARCHAR},
      </if>
      <if test="messageBody != null">
        message_body = #{messageBody,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    update sys_notify
    set category_id = #{categoryId,jdbcType=INTEGER},
      template_id = #{templateId,jdbcType=INTEGER},
      is_deleted = #{isDeleted,jdbcType=TINYINT},
      from_time = #{fromTime,jdbcType=TIMESTAMP},
      from_user_id = #{fromUserId,jdbcType=BIGINT},
      identifier = #{identifier,jdbcType=VARCHAR},
      to_time = #{toTime,jdbcType=TIMESTAMP},
      to_user_id = #{toUserId,jdbcType=BIGINT},
      to_user_name = #{toUserName,jdbcType=VARCHAR},
      task_state = #{taskState,jdbcType=TINYINT},
      is_readed = #{isReaded,jdbcType=TINYINT},
      read_time = #{readTime,jdbcType=TIMESTAMP},
      title = #{title,jdbcType=VARCHAR},
      detail_link = #{detailLink,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      content = #{content,jdbcType=LONGVARCHAR},
      message_body = #{messageBody,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.sys.notify.SysNotify">
    update sys_notify
    set category_id = #{categoryId,jdbcType=INTEGER},
      template_id = #{templateId,jdbcType=INTEGER},
      is_deleted = #{isDeleted,jdbcType=TINYINT},
      from_time = #{fromTime,jdbcType=TIMESTAMP},
      from_user_id = #{fromUserId,jdbcType=BIGINT},
      identifier = #{identifier,jdbcType=VARCHAR},
      to_time = #{toTime,jdbcType=TIMESTAMP},
      to_user_id = #{toUserId,jdbcType=BIGINT},
      to_user_name = #{toUserName,jdbcType=VARCHAR},
      task_state = #{taskState,jdbcType=TINYINT},
      is_readed = #{isReaded,jdbcType=TINYINT},
      read_time = #{readTime,jdbcType=TIMESTAMP},
      title = #{title,jdbcType=VARCHAR},
      detail_link = #{detailLink,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>