<?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.grid.GridCompanySafeCheckAttachmentMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachment">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="safe_check_id" jdbcType="VARCHAR" property="safeCheckId" />
    <result column="filename" jdbcType="VARCHAR" property="filename" />
    <result column="fileurl" jdbcType="VARCHAR" property="fileurl" />
    <result column="is_valid" jdbcType="VARCHAR" property="isValid" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
  </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, safe_check_id, filename, fileurl, is_valid, create_time
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachmentExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from grid_company_safe_check_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.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from grid_company_safe_check_attachment
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from grid_company_safe_check_attachment
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachmentExample">
    delete from grid_company_safe_check_attachment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachment">
    insert into grid_company_safe_check_attachment (id, safe_check_id, filename, 
      fileurl, is_valid, create_time
      )
    values (#{id,jdbcType=VARCHAR}, #{safeCheckId,jdbcType=VARCHAR}, #{filename,jdbcType=VARCHAR}, 
      #{fileurl,jdbcType=VARCHAR}, #{isValid,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachment">
    insert into grid_company_safe_check_attachment
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="safeCheckId != null">
        safe_check_id,
      </if>
      <if test="filename != null">
        filename,
      </if>
      <if test="fileurl != null">
        fileurl,
      </if>
      <if test="isValid != null">
        is_valid,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="safeCheckId != null">
        #{safeCheckId,jdbcType=VARCHAR},
      </if>
      <if test="filename != null">
        #{filename,jdbcType=VARCHAR},
      </if>
      <if test="fileurl != null">
        #{fileurl,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachmentExample" resultType="java.lang.Long">
    select count(*) from grid_company_safe_check_attachment
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update grid_company_safe_check_attachment
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.safeCheckId != null">
        safe_check_id = #{record.safeCheckId,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.isValid != null">
        is_valid = #{record.isValid,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update grid_company_safe_check_attachment
    set id = #{record.id,jdbcType=VARCHAR},
      safe_check_id = #{record.safeCheckId,jdbcType=VARCHAR},
      filename = #{record.filename,jdbcType=VARCHAR},
      fileurl = #{record.fileurl,jdbcType=VARCHAR},
      is_valid = #{record.isValid,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachment">
    update grid_company_safe_check_attachment
    <set>
      <if test="safeCheckId != null">
        safe_check_id = #{safeCheckId,jdbcType=VARCHAR},
      </if>
      <if test="filename != null">
        filename = #{filename,jdbcType=VARCHAR},
      </if>
      <if test="fileurl != null">
        fileurl = #{fileurl,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        is_valid = #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.grid.GridCompanySafeCheckAttachment">
    update grid_company_safe_check_attachment
    set safe_check_id = #{safeCheckId,jdbcType=VARCHAR},
      filename = #{filename,jdbcType=VARCHAR},
      fileurl = #{fileurl,jdbcType=VARCHAR},
      is_valid = #{isValid,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>