<?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="io.dataease.base.mapper.SysMsgMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsg">
    <id column="msg_id" jdbcType="BIGINT" property="msgId" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="type_id" jdbcType="BIGINT" property="typeId" />
    <result column="status" jdbcType="BIT" property="status" />
    <result column="param" jdbcType="VARCHAR" property="param" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="read_time" jdbcType="BIGINT" property="readTime" />
    <result column="content" jdbcType="VARCHAR" property="content" />
  </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">
    msg_id, user_id, type_id, `status`, param, create_time, read_time, content
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_msg
    <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 sys_msg
    where msg_id = #{msgId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_msg
    where msg_id = #{msgId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMsgExample">
    delete from sys_msg
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.SysMsg">
    insert into sys_msg (msg_id, user_id, type_id, 
      `status`, param, create_time, 
      read_time, content)
    values (#{msgId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, 
      #{status,jdbcType=BIT}, #{param,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, 
      #{readTime,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsg">
    insert into sys_msg
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="msgId != null">
        msg_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="typeId != null">
        type_id,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="param != null">
        param,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="readTime != null">
        read_time,
      </if>
      <if test="content != null">
        content,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="msgId != null">
        #{msgId,jdbcType=BIGINT},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="typeId != null">
        #{typeId,jdbcType=BIGINT},
      </if>
      <if test="status != null">
        #{status,jdbcType=BIT},
      </if>
      <if test="param != null">
        #{param,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="readTime != null">
        #{readTime,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.SysMsgExample" resultType="java.lang.Long">
    select count(*) from sys_msg
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_msg
    <set>
      <if test="record.msgId != null">
        msg_id = #{record.msgId,jdbcType=BIGINT},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.typeId != null">
        type_id = #{record.typeId,jdbcType=BIGINT},
      </if>
      <if test="record.status != null">
        `status` = #{record.status,jdbcType=BIT},
      </if>
      <if test="record.param != null">
        param = #{record.param,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=BIGINT},
      </if>
      <if test="record.readTime != null">
        read_time = #{record.readTime,jdbcType=BIGINT},
      </if>
      <if test="record.content != null">
        content = #{record.content,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_msg
    set msg_id = #{record.msgId,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      type_id = #{record.typeId,jdbcType=BIGINT},
      `status` = #{record.status,jdbcType=BIT},
      param = #{record.param,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=BIGINT},
      read_time = #{record.readTime,jdbcType=BIGINT},
      content = #{record.content,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMsg">
    update sys_msg
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="typeId != null">
        type_id = #{typeId,jdbcType=BIGINT},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=BIT},
      </if>
      <if test="param != null">
        param = #{param,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=BIGINT},
      </if>
      <if test="readTime != null">
        read_time = #{readTime,jdbcType=BIGINT},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
    </set>
    where msg_id = #{msgId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsg">
    update sys_msg
    set user_id = #{userId,jdbcType=BIGINT},
      type_id = #{typeId,jdbcType=BIGINT},
      `status` = #{status,jdbcType=BIT},
      param = #{param,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=BIGINT},
      read_time = #{readTime,jdbcType=BIGINT},
      content = #{content,jdbcType=VARCHAR}
    where msg_id = #{msgId,jdbcType=BIGINT}
  </update>
</mapper>