<?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.lightinit.hsdatashow.mapper.StWaterLakeWaterLevelMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevel">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="lake_id" jdbcType="BIGINT" property="lakeId" />
    <result column="water_level" jdbcType="DECIMAL" property="waterLevel" />
    <result column="capture_time" jdbcType="TIMESTAMP" property="captureTime" />
    <result column="capture_year" jdbcType="INTEGER" property="captureYear" />
    <result column="capture_month" jdbcType="INTEGER" property="captureMonth" />
    <result column="capture_day" jdbcType="INTEGER" property="captureDay" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="deleted_at" jdbcType="TIMESTAMP" property="deletedAt" />
    <result column="deleted_by" jdbcType="VARCHAR" property="deletedBy" />
  </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, lake_id, water_level, capture_time, capture_year, capture_month, capture_day, 
    remark, created_at, created_by, deleted_at, deleted_by
  </sql>
  <select id="selectByExample" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevelExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from st_water_lake_water_level
    <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 st_water_lake_water_level
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from st_water_lake_water_level
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevelExample">
    delete from st_water_lake_water_level
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevel">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into st_water_lake_water_level (lake_id, water_level, capture_time, 
      capture_year, capture_month, capture_day, 
      remark, created_at, created_by, 
      deleted_at, deleted_by)
    values (#{lakeId,jdbcType=BIGINT}, #{waterLevel,jdbcType=DECIMAL}, #{captureTime,jdbcType=TIMESTAMP}, 
      #{captureYear,jdbcType=INTEGER}, #{captureMonth,jdbcType=INTEGER}, #{captureDay,jdbcType=INTEGER}, 
      #{remark,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, 
      #{deletedAt,jdbcType=TIMESTAMP}, #{deletedBy,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevel">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into st_water_lake_water_level
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="lakeId != null">
        lake_id,
      </if>
      <if test="waterLevel != null">
        water_level,
      </if>
      <if test="captureTime != null">
        capture_time,
      </if>
      <if test="captureYear != null">
        capture_year,
      </if>
      <if test="captureMonth != null">
        capture_month,
      </if>
      <if test="captureDay != null">
        capture_day,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="deletedAt != null">
        deleted_at,
      </if>
      <if test="deletedBy != null">
        deleted_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="lakeId != null">
        #{lakeId,jdbcType=BIGINT},
      </if>
      <if test="waterLevel != null">
        #{waterLevel,jdbcType=DECIMAL},
      </if>
      <if test="captureTime != null">
        #{captureTime,jdbcType=TIMESTAMP},
      </if>
      <if test="captureYear != null">
        #{captureYear,jdbcType=INTEGER},
      </if>
      <if test="captureMonth != null">
        #{captureMonth,jdbcType=INTEGER},
      </if>
      <if test="captureDay != null">
        #{captureDay,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="deletedAt != null">
        #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        #{deletedBy,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevelExample" resultType="java.lang.Long">
    select count(*) from st_water_lake_water_level
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update st_water_lake_water_level
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.lakeId != null">
        lake_id = #{record.lakeId,jdbcType=BIGINT},
      </if>
      <if test="record.waterLevel != null">
        water_level = #{record.waterLevel,jdbcType=DECIMAL},
      </if>
      <if test="record.captureTime != null">
        capture_time = #{record.captureTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.captureYear != null">
        capture_year = #{record.captureYear,jdbcType=INTEGER},
      </if>
      <if test="record.captureMonth != null">
        capture_month = #{record.captureMonth,jdbcType=INTEGER},
      </if>
      <if test="record.captureDay != null">
        capture_day = #{record.captureDay,jdbcType=INTEGER},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=VARCHAR},
      </if>
      <if test="record.deletedAt != null">
        deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedBy != null">
        deleted_by = #{record.deletedBy,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update st_water_lake_water_level
    set id = #{record.id,jdbcType=BIGINT},
      lake_id = #{record.lakeId,jdbcType=BIGINT},
      water_level = #{record.waterLevel,jdbcType=DECIMAL},
      capture_time = #{record.captureTime,jdbcType=TIMESTAMP},
      capture_year = #{record.captureYear,jdbcType=INTEGER},
      capture_month = #{record.captureMonth,jdbcType=INTEGER},
      capture_day = #{record.captureDay,jdbcType=INTEGER},
      remark = #{record.remark,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=VARCHAR},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevel">
    update st_water_lake_water_level
    <set>
      <if test="lakeId != null">
        lake_id = #{lakeId,jdbcType=BIGINT},
      </if>
      <if test="waterLevel != null">
        water_level = #{waterLevel,jdbcType=DECIMAL},
      </if>
      <if test="captureTime != null">
        capture_time = #{captureTime,jdbcType=TIMESTAMP},
      </if>
      <if test="captureYear != null">
        capture_year = #{captureYear,jdbcType=INTEGER},
      </if>
      <if test="captureMonth != null">
        capture_month = #{captureMonth,jdbcType=INTEGER},
      </if>
      <if test="captureDay != null">
        capture_day = #{captureDay,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="deletedAt != null">
        deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        deleted_by = #{deletedBy,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdatashow.entity.StWaterLakeWaterLevel">
    update st_water_lake_water_level
    set lake_id = #{lakeId,jdbcType=BIGINT},
      water_level = #{waterLevel,jdbcType=DECIMAL},
      capture_time = #{captureTime,jdbcType=TIMESTAMP},
      capture_year = #{captureYear,jdbcType=INTEGER},
      capture_month = #{captureMonth,jdbcType=INTEGER},
      capture_day = #{captureDay,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=VARCHAR},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>