Newer
Older
huludao / src / main / resources / mapper / RiverManage / RiverInfoDao.xml
<?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.RiverInfoDao">
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.RiverInfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="river_no" jdbcType="VARCHAR" property="riverNo" />
    <result column="river_code" jdbcType="VARCHAR" property="riverCode" />
    <result column="reach_name" jdbcType="VARCHAR" property="reachName" />
    <result column="river_name" jdbcType="VARCHAR" property="riverName" />
    <result column="river_section" jdbcType="VARCHAR" property="riverSection" />
    <result column="reach_length" jdbcType="DECIMAL" property="reachLength" />
    <result column="river_area" jdbcType="DECIMAL" property="riverArea" />
    <result column="up_stream" jdbcType="VARCHAR" property="upStream" />
    <result column="down_stream" jdbcType="VARCHAR" property="downStream" />
    <result column="continental_river" jdbcType="TINYINT" property="continentalRiver" />
    <result column="file_name" jdbcType="VARCHAR" property="fileName" />
    <result column="water_quality_level" jdbcType="INTEGER" property="waterQualityLevel" />
    <result column="water_warn_level"  property="waterWarnLevel" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.newfiber.api.pc.model.River.RiverInfo">
    <result column="file_path" jdbcType="LONGVARCHAR" property="filePath" />
  </resultMap>
  <sql id="Base_Column_List">
    id, river_no, river_code,reach_name, river_name, river_section, reach_length, river_area, up_stream,
    down_stream, continental_river, file_name,water_quality_level,water_warn_level
  </sql>
  <sql id="Blob_Column_List">
    file_path
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from river_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from river_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.newfiber.api.pc.model.River.RiverInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Mar 15 08:30:31 CST 2021.
    -->
    insert into river_info (id, river_no, reach_name,
    river_name, river_section, reach_length,
    river_area, up_stream, down_stream,
    continental_river, file_name, file_path
    )
    values (#{id,jdbcType=INTEGER}, #{riverNo,jdbcType=VARCHAR}, #{reachName,jdbcType=VARCHAR},
    #{riverName,jdbcType=VARCHAR}, #{riverSection,jdbcType=VARCHAR}, #{reachLength,jdbcType=DECIMAL},
    #{riverArea,jdbcType=DECIMAL}, #{upStream,jdbcType=VARCHAR}, #{downStream,jdbcType=VARCHAR},
    #{continentalRiver,jdbcType=TINYINT}, #{fileName,jdbcType=VARCHAR}, #{filePath,jdbcType=LONGVARCHAR}
    )
  </insert>
  <insert id="insertSelective" parameterType="com.newfiber.api.pc.model.River.RiverInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Mar 15 08:30:31 CST 2021.
    -->
    insert into river_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="riverNo != null">
        river_no,
      </if>
      <if test="reachName != null">
        reach_name,
      </if>
      <if test="riverName != null">
        river_name,
      </if>
      <if test="riverSection != null">
        river_section,
      </if>
      <if test="reachLength != null">
        reach_length,
      </if>
      <if test="riverArea != null">
        river_area,
      </if>
      <if test="upStream != null">
        up_stream,
      </if>
      <if test="downStream != null">
        down_stream,
      </if>
      <if test="continentalRiver != null">
        continental_river,
      </if>
      <if test="fileName != null">
        file_name,
      </if>
      <if test="filePath != null">
        file_path,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="riverNo != null">
        #{riverNo,jdbcType=VARCHAR},
      </if>
      <if test="reachName != null">
        #{reachName,jdbcType=VARCHAR},
      </if>
      <if test="riverName != null">
        #{riverName,jdbcType=VARCHAR},
      </if>
      <if test="riverSection != null">
        #{riverSection,jdbcType=VARCHAR},
      </if>
      <if test="reachLength != null">
        #{reachLength,jdbcType=DECIMAL},
      </if>
      <if test="riverArea != null">
        #{riverArea,jdbcType=DECIMAL},
      </if>
      <if test="upStream != null">
        #{upStream,jdbcType=VARCHAR},
      </if>
      <if test="downStream != null">
        #{downStream,jdbcType=VARCHAR},
      </if>
      <if test="continentalRiver != null">
        #{continentalRiver,jdbcType=TINYINT},
      </if>
      <if test="fileName != null">
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        #{filePath,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.newfiber.api.pc.model.River.RiverInfo">
    update river_info
    <set>
      <if test="riverNo != null">
        river_no = #{riverNo,jdbcType=VARCHAR},
      </if>
      <if test="reachName != null">
        reach_name = #{reachName,jdbcType=VARCHAR},
      </if>
      <if test="riverName != null">
        river_name = #{riverName,jdbcType=VARCHAR},
      </if>
      <if test="riverSection != null">
        river_section = #{riverSection,jdbcType=VARCHAR},
      </if>
      <if test="reachLength != null">
        reach_length = #{reachLength,jdbcType=DECIMAL},
      </if>
      <if test="riverArea != null">
        river_area = #{riverArea,jdbcType=DECIMAL},
      </if>
      <if test="upStream != null">
        up_stream = #{upStream,jdbcType=VARCHAR},
      </if>
      <if test="downStream != null">
        down_stream = #{downStream,jdbcType=VARCHAR},
      </if>
      <if test="continentalRiver != null">
        continental_river = #{continentalRiver,jdbcType=TINYINT},
      </if>
      <if test="fileName != null">
        file_name = #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        file_path = #{filePath,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.newfiber.api.pc.model.River.RiverInfo">
    update river_info
    set river_no = #{riverNo,jdbcType=VARCHAR},
    reach_name = #{reachName,jdbcType=VARCHAR},
    river_name = #{riverName,jdbcType=VARCHAR},
    river_section = #{riverSection,jdbcType=VARCHAR},
    reach_length = #{reachLength,jdbcType=DECIMAL},
    river_area = #{riverArea,jdbcType=DECIMAL},
    up_stream = #{upStream,jdbcType=VARCHAR},
    down_stream = #{downStream,jdbcType=VARCHAR},
    continental_river = #{continentalRiver,jdbcType=TINYINT},
    file_name = #{fileName,jdbcType=VARCHAR},
    file_path = #{filePath,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.newfiber.api.pc.model.River.RiverInfo">
    update river_info
    set river_no = #{riverNo,jdbcType=VARCHAR},
    reach_name = #{reachName,jdbcType=VARCHAR},
    river_name = #{riverName,jdbcType=VARCHAR},
    river_section = #{riverSection,jdbcType=VARCHAR},
    reach_length = #{reachLength,jdbcType=DECIMAL},
    river_area = #{riverArea,jdbcType=DECIMAL},
    up_stream = #{upStream,jdbcType=VARCHAR},
    down_stream = #{downStream,jdbcType=VARCHAR},
    continental_river = #{continentalRiver,jdbcType=TINYINT},
    file_name = #{fileName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

    <select id="selectRiver" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>,
      <include refid="Blob_Column_List" />
        from river_info where 1=1
        <if test="riverName != null and riverName != ''">
            and river_name like concat('%',#{riverName},'%')
        </if>
    </select>

    <select id="selectAllRiver" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List"/>,
      <include refid="Blob_Column_List" />
      from river_info
    </select>

</mapper>