<?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.ruoyi.system.mapper.system.SysOtherappAttachmentMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.system.SysOtherappAttachment">
    <id column="attach_id" jdbcType="BIGINT" property="attachId" />
    <result column="attach_type" jdbcType="VARCHAR" property="attachType" />
    <result column="filename" jdbcType="VARCHAR" property="filename" />
    <result column="fileurl" jdbcType="VARCHAR" property="fileurl" />
    <result column="valid" jdbcType="TINYINT" property="valid" />
    <result column="business_id" jdbcType="VARCHAR" property="businessId" />
  </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">
    attach_id, attach_type, filename, fileurl, valid,  business_id
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachmentExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_otherapp_attachment
    <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_otherapp_attachment
    where attach_id = #{attachId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_otherapp_attachment
    where attach_id = #{attachId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachmentExample">
    delete from sys_otherapp_attachment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachment">
    insert into sys_otherapp_attachment (attach_id, attach_type, filename,
      fileurl, valid,
      business_id)
    values (#{attachId,jdbcType=BIGINT}, #{attachType,jdbcType=VARCHAR}, #{filename,jdbcType=VARCHAR},
      #{fileurl,jdbcType=VARCHAR}, #{valid,jdbcType=TINYINT},
      #{businessId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachment">
    insert into sys_otherapp_attachment
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="attachId != null">
        attach_id,
      </if>
      <if test="attachType != null">
        attach_type,
      </if>
      <if test="filename != null">
        filename,
      </if>
      <if test="fileurl != null">
        fileurl,
      </if>
      <if test="valid != null">
        valid,
      </if>
      <if test="businessId != null">
        business_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="attachId != null">
        #{attachId,jdbcType=BIGINT},
      </if>
      <if test="attachType != null">
        #{attachType,jdbcType=VARCHAR},
      </if>
      <if test="filename != null">
        #{filename,jdbcType=VARCHAR},
      </if>
      <if test="fileurl != null">
        #{fileurl,jdbcType=VARCHAR},
      </if>
      <if test="valid != null">
        #{valid,jdbcType=TINYINT},
      </if>
      <if test="businessId != null">
        #{businessId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachmentExample" resultType="java.lang.Long">
    select count(*) from sys_otherapp_attachment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_otherapp_attachment
    <set>
      <if test="record.attachId != null">
        attach_id = #{record.attachId,jdbcType=BIGINT},
      </if>
      <if test="record.attachType != null">
        attach_type = #{record.attachType,jdbcType=VARCHAR},
      </if>
      <if test="record.filename != null">
        filename = #{record.filename,jdbcType=VARCHAR},
      </if>
      <if test="record.fileurl != null">
        fileurl = #{record.fileurl,jdbcType=VARCHAR},
      </if>
      <if test="record.valid != null">
        valid = #{record.valid,jdbcType=TINYINT},
      </if>
      <if test="record.businessId != null">
        business_id = #{record.businessId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_otherapp_attachment
    set attach_id = #{record.attachId,jdbcType=BIGINT},
      attach_type = #{record.attachType,jdbcType=VARCHAR},
      filename = #{record.filename,jdbcType=VARCHAR},
      fileurl = #{record.fileurl,jdbcType=VARCHAR},
      valid = #{record.valid,jdbcType=TINYINT},
      business_id = #{record.businessId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachment">
    update sys_otherapp_attachment
    <set>
      <if test="attachType != null">
        attach_type = #{attachType,jdbcType=VARCHAR},
      </if>
      <if test="filename != null">
        filename = #{filename,jdbcType=VARCHAR},
      </if>
      <if test="fileurl != null">
        fileurl = #{fileurl,jdbcType=VARCHAR},
      </if>
      <if test="valid != null">
        valid = #{valid,jdbcType=TINYINT},
      </if>
      <if test="businessId != null">
        business_id = #{businessId,jdbcType=VARCHAR},
      </if>
    </set>
    where attach_id = #{attachId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.system.SysOtherappAttachment">
    update sys_otherapp_attachment
    set attach_type = #{attachType,jdbcType=VARCHAR},
      filename = #{filename,jdbcType=VARCHAR},
      fileurl = #{fileurl,jdbcType=VARCHAR},
      valid = #{valid,jdbcType=TINYINT},
      business_id = #{businessId,jdbcType=VARCHAR}
    where attach_id = #{attachId,jdbcType=BIGINT}
  </update>
</mapper>
