<?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.bowintek.smartsearch.mapper.SysAnnouncementMapper">
  <resultMap id="BaseResultMap" type="com.bowintek.smartsearch.model.SysAnnouncement">
    <id column="AnnouncementID" jdbcType="VARCHAR" property="announcementID" />
    <result column="Title" jdbcType="VARCHAR" property="title" />
    <result column="Content" jdbcType="VARCHAR" property="content" />
    <result column="StartTime" jdbcType="TIMESTAMP" property="startTime" />
    <result column="EndTime" jdbcType="TIMESTAMP" property="endTime" />
    <result column="RecordStatus" jdbcType="INTEGER" property="recordStatus" />
    <result column="CreateBy" jdbcType="VARCHAR" property="createBy" />
    <result column="CreateTime" jdbcType="TIMESTAMP" property="createTime" />
    <result column="UpdateBy" jdbcType="VARCHAR" property="updateBy" />
    <result column="UpdateTime" jdbcType="TIMESTAMP" property="updateTime" />
  </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">
    AnnouncementID, Title, Content, StartTime, EndTime, RecordStatus, CreateBy, CreateTime, 
    UpdateBy, UpdateTime
  </sql>
  <select id="selectByExample" parameterType="com.bowintek.smartsearch.model.SysAnnouncementExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_announcement
    <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.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_announcement
    where AnnouncementID = #{announcementID,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from sys_announcement
    where AnnouncementID = #{announcementID,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.bowintek.smartsearch.model.SysAnnouncementExample">
    delete from sys_announcement
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bowintek.smartsearch.model.SysAnnouncement">
    insert into sys_announcement (AnnouncementID, Title, Content, 
      StartTime, EndTime, RecordStatus, 
      CreateBy, CreateTime, UpdateBy, 
      UpdateTime)
    values (#{announcementID,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, 
      #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{recordStatus,jdbcType=INTEGER}, 
      #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, 
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.bowintek.smartsearch.model.SysAnnouncement">
    insert into sys_announcement
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="announcementID != null">
        AnnouncementID,
      </if>
      <if test="title != null">
        Title,
      </if>
      <if test="content != null">
        Content,
      </if>
      <if test="startTime != null">
        StartTime,
      </if>
      <if test="endTime != null">
        EndTime,
      </if>
      <if test="recordStatus != null">
        RecordStatus,
      </if>
      <if test="createBy != null">
        CreateBy,
      </if>
      <if test="createTime != null">
        CreateTime,
      </if>
      <if test="updateBy != null">
        UpdateBy,
      </if>
      <if test="updateTime != null">
        UpdateTime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="announcementID != null">
        #{announcementID,jdbcType=VARCHAR},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recordStatus != null">
        #{recordStatus,jdbcType=INTEGER},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bowintek.smartsearch.model.SysAnnouncementExample" resultType="java.lang.Long">
    select count(*) from sys_announcement
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_announcement
    <set>
      <if test="row.announcementID != null">
        AnnouncementID = #{row.announcementID,jdbcType=VARCHAR},
      </if>
      <if test="row.title != null">
        Title = #{row.title,jdbcType=VARCHAR},
      </if>
      <if test="row.content != null">
        Content = #{row.content,jdbcType=VARCHAR},
      </if>
      <if test="row.startTime != null">
        StartTime = #{row.startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="row.endTime != null">
        EndTime = #{row.endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="row.recordStatus != null">
        RecordStatus = #{row.recordStatus,jdbcType=INTEGER},
      </if>
      <if test="row.createBy != null">
        CreateBy = #{row.createBy,jdbcType=VARCHAR},
      </if>
      <if test="row.createTime != null">
        CreateTime = #{row.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="row.updateBy != null">
        UpdateBy = #{row.updateBy,jdbcType=VARCHAR},
      </if>
      <if test="row.updateTime != null">
        UpdateTime = #{row.updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_announcement
    set AnnouncementID = #{row.announcementID,jdbcType=VARCHAR},
      Title = #{row.title,jdbcType=VARCHAR},
      Content = #{row.content,jdbcType=VARCHAR},
      StartTime = #{row.startTime,jdbcType=TIMESTAMP},
      EndTime = #{row.endTime,jdbcType=TIMESTAMP},
      RecordStatus = #{row.recordStatus,jdbcType=INTEGER},
      CreateBy = #{row.createBy,jdbcType=VARCHAR},
      CreateTime = #{row.createTime,jdbcType=TIMESTAMP},
      UpdateBy = #{row.updateBy,jdbcType=VARCHAR},
      UpdateTime = #{row.updateTime,jdbcType=TIMESTAMP}
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.bowintek.smartsearch.model.SysAnnouncement">
    update sys_announcement
    <set>
      <if test="title != null">
        Title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        Content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null">
        StartTime = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        EndTime = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recordStatus != null">
        RecordStatus = #{recordStatus,jdbcType=INTEGER},
      </if>
      <if test="createBy != null">
        CreateBy = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CreateTime = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        UpdateBy = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        UpdateTime = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where AnnouncementID = #{announcementID,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bowintek.smartsearch.model.SysAnnouncement">
    update sys_announcement
    set Title = #{title,jdbcType=VARCHAR},
      Content = #{content,jdbcType=VARCHAR},
      StartTime = #{startTime,jdbcType=TIMESTAMP},
      EndTime = #{endTime,jdbcType=TIMESTAMP},
      RecordStatus = #{recordStatus,jdbcType=INTEGER},
      CreateBy = #{createBy,jdbcType=VARCHAR},
      CreateTime = #{createTime,jdbcType=TIMESTAMP},
      UpdateBy = #{updateBy,jdbcType=VARCHAR},
      UpdateTime = #{updateTime,jdbcType=TIMESTAMP}
    where AnnouncementID = #{announcementID,jdbcType=VARCHAR}
  </update>
</mapper>