<?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.newfiber.api.pc.dao.RiverManage.SiteWaterLevelDao"> <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.SiteWaterLevel"> <id column="id" jdbcType="BIGINT" property="id" /> <result column="st_code" jdbcType="VARCHAR" property="stCode" /> <result column="st_time" jdbcType="TIMESTAMP" property="stTime" /> <result column="st_Name" jdbcType="VARCHAR" property="stName" /> <result column="lat" jdbcType="VARCHAR" property="lat" /> <result column="lon" jdbcType="VARCHAR" property="lon" /> <result column="year" jdbcType="VARCHAR" property="year" /> <result column="month1_level" jdbcType="TINYINT" property="month1Level" /> <result column="month2_level" jdbcType="TINYINT" property="month2Level" /> <result column="month3_level" jdbcType="TINYINT" property="month3Level" /> <result column="month4_level" jdbcType="TINYINT" property="month4Level" /> <result column="month5_level" jdbcType="TINYINT" property="month5Level" /> <result column="month6_level" jdbcType="TINYINT" property="month6Level" /> <result column="month7_level" jdbcType="TINYINT" property="month7Level" /> <result column="month8_level" jdbcType="TINYINT" property="month8Level" /> <result column="month9_level" jdbcType="TINYINT" property="month9Level" /> <result column="month10_level" jdbcType="TINYINT" property="month10Level" /> <result column="month11_level" jdbcType="TINYINT" property="month11Level" /> <result column="month12_level" jdbcType="TINYINT" property="month12Level" /> <result column="now_level" jdbcType="TINYINT" property="nowLevel" /> <result column="ditry_water_level" jdbcType="VARCHAR" property="ditryWaterLevel" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> </resultMap> <sql id="Base_Column_List"> id, st_code, lon, lat, st_name, st_time, year, month1_level, month2_level, month3_level, month4_level, month5_level, month6_level, month7_level, month8_level, month9_level, month10_level, month11_level, month12_level, now_level, ditry_water_level, create_time, update_time </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from site_water_level where id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from site_water_level where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.newfiber.api.pc.model.River.SiteWaterLevel"> insert into site_water_level (id, st_code, lon, lat, st_name, st_time, year, month1_level, month2_level, month3_level, month4_level, month5_level, month6_level, month7_level, month8_level, month9_level, month10_level, month11_level, month12_level, now_level, ditry_water_level, create_time, update_time) values (#{id,jdbcType=BIGINT}, #{stCode,jdbcType=VARCHAR}, #{lon,jdbcType=VARCHAR}, #{lat,jdbcType=VARCHAR}, #{stName,jdbcType=VARCHAR}, #{stTime,jdbcType=TIMESTAMP}, #{year,jdbcType=VARCHAR}, #{month1Level,jdbcType=TINYINT}, #{month2Level,jdbcType=TINYINT}, #{month3Level,jdbcType=TINYINT}, #{month4Level,jdbcType=TINYINT}, #{month5Level,jdbcType=TINYINT}, #{month6Level,jdbcType=TINYINT}, #{month7Level,jdbcType=TINYINT}, #{month8Level,jdbcType=TINYINT}, #{month9Level,jdbcType=TINYINT}, #{month10Level,jdbcType=TINYINT}, #{month11Level,jdbcType=TINYINT}, #{month12Level,jdbcType=TINYINT}, #{nowLevel,jdbcType=TINYINT}, #{ditryWaterLevel,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.newfiber.api.pc.model.River.SiteWaterLevel"> insert into site_water_level <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="stCode != null"> st_code, </if> <if test="lon != null"> lon, </if> <if test="lat != null"> lat, </if> <if test="stName != null"> st_name, </if> <if test="stTime != null"> st_time, </if> <if test="year != null"> year, </if> <if test="month1Level != null"> month1_level, </if> <if test="month2Level != null"> month2_level, </if> <if test="month3Level != null"> month3_level, </if> <if test="month4Level != null"> month4_level, </if> <if test="month5Level != null"> month5_level, </if> <if test="month6Level != null"> month6_level, </if> <if test="month7Level != null"> month7_level, </if> <if test="month8Level != null"> month8_level, </if> <if test="month9Level != null"> month9_level, </if> <if test="month10Level != null"> month10_level, </if> <if test="month11Level != null"> month11_level, </if> <if test="month12Level != null"> month12_level, </if> <if test="nowLevel != null"> now_level, </if> <if test="ditryWaterLevel != null"> ditry_water_level, </if> <if test="createTime != null"> create_time, </if> <if test="updateTime != null"> update_time, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, </if> <if test="stCode != null"> #{stCode,jdbcType=VARCHAR}, </if> <if test="lon != null"> #{lon,jdbcType=VARCHAR}, </if> <if test="lat != null"> #{lat,jdbcType=VARCHAR}, </if> <if test="stName != null"> #{stName,jdbcType=VARCHAR}, </if> <if test="stTime != null"> #{stTime,jdbcType=TIMESTAMP}, </if> <if test="year != null"> #{year,jdbcType=VARCHAR}, </if> <if test="month1Level != null"> #{month1Level,jdbcType=TINYINT}, </if> <if test="month2Level != null"> #{month2Level,jdbcType=TINYINT}, </if> <if test="month3Level != null"> #{month3Level,jdbcType=TINYINT}, </if> <if test="month4Level != null"> #{month4Level,jdbcType=TINYINT}, </if> <if test="month5Level != null"> #{month5Level,jdbcType=TINYINT}, </if> <if test="month6Level != null"> #{month6Level,jdbcType=TINYINT}, </if> <if test="month7Level != null"> #{month7Level,jdbcType=TINYINT}, </if> <if test="month8Level != null"> #{month8Level,jdbcType=TINYINT}, </if> <if test="month9Level != null"> #{month9Level,jdbcType=TINYINT}, </if> <if test="month10Level != null"> #{month10Level,jdbcType=TINYINT}, </if> <if test="month11Level != null"> #{month11Level,jdbcType=TINYINT}, </if> <if test="month12Level != null"> #{month12Level,jdbcType=TINYINT}, </if> <if test="nowLevel != null"> #{nowLevel,jdbcType=TINYINT}, </if> <if test="ditryWaterLevel != null"> #{ditryWaterLevel,jdbcType=VARCHAR}, </if> <if test="createTime != null"> #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateTime != null"> #{updateTime,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.newfiber.api.pc.model.River.SiteWaterLevel"> update site_water_level <set> <if test="stCode != null"> st_code = #{stCode,jdbcType=VARCHAR}, </if> <if test="lon != null"> lon = #{lon,jdbcType=VARCHAR}, </if> <if test="lat != null"> lat = #{lat,jdbcType=VARCHAR}, </if> <if test="stName != null"> st_name = #{stName,jdbcType=VARCHAR}, </if> <if test="stTime != null"> st_time = #{stTime,jdbcType=TIMESTAMP}, </if> <if test="year != null"> year = #{year,jdbcType=VARCHAR}, </if> <if test="month1Level != null"> month1_level = #{month1Level,jdbcType=TINYINT}, </if> <if test="month2Level != null"> month2_level = #{month2Level,jdbcType=TINYINT}, </if> <if test="month3Level != null"> month3_level = #{month3Level,jdbcType=TINYINT}, </if> <if test="month4Level != null"> month4_level = #{month4Level,jdbcType=TINYINT}, </if> <if test="month5Level != null"> month5_level = #{month5Level,jdbcType=TINYINT}, </if> <if test="month6Level != null"> month6_level = #{month6Level,jdbcType=TINYINT}, </if> <if test="month7Level != null"> month7_level = #{month7Level,jdbcType=TINYINT}, </if> <if test="month8Level != null"> month8_level = #{month8Level,jdbcType=TINYINT}, </if> <if test="month9Level != null"> month9_level = #{month9Level,jdbcType=TINYINT}, </if> <if test="month10Level != null"> month10_level = #{month10Level,jdbcType=TINYINT}, </if> <if test="month11Level != null"> month11_level = #{month11Level,jdbcType=TINYINT}, </if> <if test="month12Level != null"> month12_level = #{month12Level,jdbcType=TINYINT}, </if> <if test="nowLevel != null"> now_level = #{nowLevel,jdbcType=TINYINT}, </if> <if test="ditryWaterLevel != null"> ditry_water_level = #{ditryWaterLevel,jdbcType=VARCHAR}, </if> <if test="createTime != null"> create_time = #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateTime != null"> update_time = #{updateTime,jdbcType=TIMESTAMP}, </if> </set> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.newfiber.api.pc.model.River.SiteWaterLevel"> update site_water_level set st_code = #{stCode,jdbcType=VARCHAR}, lon = #{lon,jdbcType=VARCHAR}, lat = #{lat,jdbcType=VARCHAR}, st_name = #{stName,jdbcType=VARCHAR}, st_time = #{stTime,jdbcType=TIMESTAMP}, year = #{year,jdbcType=VARCHAR}, month1_level = #{month1Level,jdbcType=TINYINT}, month2_level = #{month2Level,jdbcType=TINYINT}, month3_level = #{month3Level,jdbcType=TINYINT}, month4_level = #{month4Level,jdbcType=TINYINT}, month5_level = #{month5Level,jdbcType=TINYINT}, month6_level = #{month6Level,jdbcType=TINYINT}, month7_level = #{month7Level,jdbcType=TINYINT}, month8_level = #{month8Level,jdbcType=TINYINT}, month9_level = #{month9Level,jdbcType=TINYINT}, month10_level = #{month10Level,jdbcType=TINYINT}, month11_level = #{month11Level,jdbcType=TINYINT}, month12_level = #{month12Level,jdbcType=TINYINT}, now_level = #{nowLevel,jdbcType=TINYINT}, ditry_water_level = #{ditryWaterLevel,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> <select id="listAll" resultMap="BaseResultMap" > select <include refid="Base_Column_List"/> from site_water_level where 1=1 <if test="year != null"> and year = #{year} </if> </select> <select id="listBySiteCode" resultMap="BaseResultMap" > select <include refid="Base_Column_List"/> from site_water_level where 1=1 <if test="year != null and year != ''"> and year = #{year} </if> <if test="stCode != null and stCode != ''"> and st_code =#{stCode} </if> </select> </mapper>