<?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.SysMsgSettingMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsgSetting">
    <id column="msg_setting_id" jdbcType="BIGINT" property="msgSettingId" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="type_id" jdbcType="BIGINT" property="typeId" />
    <result column="channel_id" jdbcType="BIGINT" property="channelId" />
    <result column="enable" jdbcType="BIT" property="enable" />
  </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_setting_id, user_id, type_id, channel_id, `enable`
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_msg_setting
    <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_setting
    where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_msg_setting
    where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample">
    delete from sys_msg_setting
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.SysMsgSetting">
    insert into sys_msg_setting (msg_setting_id, user_id, type_id, 
      channel_id, `enable`)
    values (#{msgSettingId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, 
      #{channelId,jdbcType=BIGINT}, #{enable,jdbcType=BIT})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsgSetting">
    insert into sys_msg_setting
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="msgSettingId != null">
        msg_setting_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="typeId != null">
        type_id,
      </if>
      <if test="channelId != null">
        channel_id,
      </if>
      <if test="enable != null">
        `enable`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="msgSettingId != null">
        #{msgSettingId,jdbcType=BIGINT},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="typeId != null">
        #{typeId,jdbcType=BIGINT},
      </if>
      <if test="channelId != null">
        #{channelId,jdbcType=BIGINT},
      </if>
      <if test="enable != null">
        #{enable,jdbcType=BIT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample" resultType="java.lang.Long">
    select count(*) from sys_msg_setting
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_msg_setting
    <set>
      <if test="record.msgSettingId != null">
        msg_setting_id = #{record.msgSettingId,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.channelId != null">
        channel_id = #{record.channelId,jdbcType=BIGINT},
      </if>
      <if test="record.enable != null">
        `enable` = #{record.enable,jdbcType=BIT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_msg_setting
    set msg_setting_id = #{record.msgSettingId,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      type_id = #{record.typeId,jdbcType=BIGINT},
      channel_id = #{record.channelId,jdbcType=BIGINT},
      `enable` = #{record.enable,jdbcType=BIT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMsgSetting">
    update sys_msg_setting
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="typeId != null">
        type_id = #{typeId,jdbcType=BIGINT},
      </if>
      <if test="channelId != null">
        channel_id = #{channelId,jdbcType=BIGINT},
      </if>
      <if test="enable != null">
        `enable` = #{enable,jdbcType=BIT},
      </if>
    </set>
    where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsgSetting">
    update sys_msg_setting
    set user_id = #{userId,jdbcType=BIGINT},
      type_id = #{typeId,jdbcType=BIGINT},
      channel_id = #{channelId,jdbcType=BIGINT},
      `enable` = #{enable,jdbcType=BIT}
    where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
  </update>
</mapper>