<?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.zb.ZbAutoRecordMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.zb.ZbAutoRecord">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="report_id" jdbcType="VARCHAR" property="reportId" />
    <result column="last_report_id" jdbcType="VARCHAR" property="lastReportId" />
    <result column="last_week" jdbcType="VARCHAR" property="lastWeek" />
    <result column="year" jdbcType="VARCHAR" property="year" />
    <result column="valid" jdbcType="TINYINT" property="valid" />
    <result column="create_time" jdbcType="TIMESTAMP" 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, report_id, last_report_id, last_week, year, valid, create_time
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecordExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from zb_auto_record
    <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 zb_auto_record
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from zb_auto_record
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecordExample">
    delete from zb_auto_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecord">
    insert into zb_auto_record (id, report_id, last_report_id, 
      last_week, year, valid, 
      create_time)
    values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=VARCHAR}, #{lastReportId,jdbcType=VARCHAR}, 
      #{lastWeek,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, #{valid,jdbcType=TINYINT}, 
      #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecord">
    insert into zb_auto_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="reportId != null">
        report_id,
      </if>
      <if test="lastReportId != null">
        last_report_id,
      </if>
      <if test="lastWeek != null">
        last_week,
      </if>
      <if test="year != null">
        year,
      </if>
      <if test="valid != null">
        valid,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="lastReportId != null">
        #{lastReportId,jdbcType=VARCHAR},
      </if>
      <if test="lastWeek != null">
        #{lastWeek,jdbcType=VARCHAR},
      </if>
      <if test="year != null">
        #{year,jdbcType=VARCHAR},
      </if>
      <if test="valid != null">
        #{valid,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecordExample" resultType="java.lang.Long">
    select count(*) from zb_auto_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update zb_auto_record
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.reportId != null">
        report_id = #{record.reportId,jdbcType=VARCHAR},
      </if>
      <if test="record.lastReportId != null">
        last_report_id = #{record.lastReportId,jdbcType=VARCHAR},
      </if>
      <if test="record.lastWeek != null">
        last_week = #{record.lastWeek,jdbcType=VARCHAR},
      </if>
      <if test="record.year != null">
        year = #{record.year,jdbcType=VARCHAR},
      </if>
      <if test="record.valid != null">
        valid = #{record.valid,jdbcType=TINYINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update zb_auto_record
    set id = #{record.id,jdbcType=BIGINT},
      report_id = #{record.reportId,jdbcType=VARCHAR},
      last_report_id = #{record.lastReportId,jdbcType=VARCHAR},
      last_week = #{record.lastWeek,jdbcType=VARCHAR},
      year = #{record.year,jdbcType=VARCHAR},
      valid = #{record.valid,jdbcType=TINYINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecord">
    update zb_auto_record
    <set>
      <if test="reportId != null">
        report_id = #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="lastReportId != null">
        last_report_id = #{lastReportId,jdbcType=VARCHAR},
      </if>
      <if test="lastWeek != null">
        last_week = #{lastWeek,jdbcType=VARCHAR},
      </if>
      <if test="year != null">
        year = #{year,jdbcType=VARCHAR},
      </if>
      <if test="valid != null">
        valid = #{valid,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.zb.ZbAutoRecord">
    update zb_auto_record
    set report_id = #{reportId,jdbcType=VARCHAR},
      last_report_id = #{lastReportId,jdbcType=VARCHAR},
      last_week = #{lastWeek,jdbcType=VARCHAR},
      year = #{year,jdbcType=VARCHAR},
      valid = #{valid,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>