<?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.GridCompanyLawArchivesMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.grid.GridCompanyLawArchives">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="archives_no" jdbcType="VARCHAR" property="archivesNo" />
    <result column="archives_type" jdbcType="VARCHAR" property="archivesType" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
    <result column="create_username" jdbcType="VARCHAR" property="createUsername" />
    <result column="is_valid" jdbcType="VARCHAR" property="isValid" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  </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, archives_no, archives_type, name, create_time, remark, create_user_id, create_username, 
    is_valid, company_id
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchivesExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from grid_company_law_archives
    <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_law_archives
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from grid_company_law_archives
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchivesExample">
    delete from grid_company_law_archives
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchives">
    insert into grid_company_law_archives (id, archives_no, archives_type, 
      name, create_time, remark, 
      create_user_id, create_username, is_valid, 
      company_id)
    values (#{id,jdbcType=VARCHAR}, #{archivesNo,jdbcType=VARCHAR}, #{archivesType,jdbcType=VARCHAR}, 
      #{name,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
      #{createUserId,jdbcType=VARCHAR}, #{createUsername,jdbcType=VARCHAR}, #{isValid,jdbcType=VARCHAR}, 
       #{companyId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchives">
    insert into grid_company_law_archives
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="archivesNo != null">
        archives_no,
      </if>
      <if test="archivesType != null">
        archives_type,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="createUsername != null">
        create_username,
      </if>
      <if test="isValid != null">
        is_valid,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="archivesNo != null">
        #{archivesNo,jdbcType=VARCHAR},
      </if>
      <if test="archivesType != null">
        #{archivesType,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=VARCHAR},
      </if>
      <if test="createUsername != null">
        #{createUsername,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchivesExample" resultType="java.lang.Long">
    select count(*) from grid_company_law_archives
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update grid_company_law_archives
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.archivesNo != null">
        archives_no = #{record.archivesNo,jdbcType=VARCHAR},
      </if>
      <if test="record.archivesType != null">
        archives_type = #{record.archivesType,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=VARCHAR},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.createUsername != null">
        create_username = #{record.createUsername,jdbcType=VARCHAR},
      </if>
      <if test="record.isValid != null">
        is_valid = #{record.isValid,jdbcType=VARCHAR},
      </if>
      <if test="record.companyId != null">
        company_id = #{record.companyId,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_law_archives
    set id = #{record.id,jdbcType=VARCHAR},
      archives_no = #{record.archivesNo,jdbcType=VARCHAR},
      archives_type = #{record.archivesType,jdbcType=VARCHAR},
      name = #{record.name,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=VARCHAR},
      remark = #{record.remark,jdbcType=VARCHAR},
      create_user_id = #{record.createUserId,jdbcType=VARCHAR},
      create_username = #{record.createUsername,jdbcType=VARCHAR},
      is_valid = #{record.isValid,jdbcType=VARCHAR},
      company_id = #{record.companyId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchives">
    update grid_company_law_archives
    <set>
      <if test="archivesNo != null">
        archives_no = #{archivesNo,jdbcType=VARCHAR},
      </if>
      <if test="archivesType != null">
        archives_type = #{archivesType,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=VARCHAR},
      </if>
      <if test="createUsername != null">
        create_username = #{createUsername,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        is_valid = #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.grid.GridCompanyLawArchives">
    update grid_company_law_archives
    set archives_no = #{archivesNo,jdbcType=VARCHAR},
      archives_type = #{archivesType,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      create_user_id = #{createUserId,jdbcType=VARCHAR},
      create_username = #{createUsername,jdbcType=VARCHAR},
      is_valid = #{isValid,jdbcType=VARCHAR},
      company_id = #{companyId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>