<?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.javaweb.hydrology.mapper.HydrologyDataMapper">
|
|
<resultMap type="HydrologyData" id="HydrologyDataResult">
|
<result property="id" column="id" />
|
<result property="record" column="record" />
|
<result property="holeNum" column="hole_num" />
|
<result property="year" column="year" />
|
<result property="month" column="month" />
|
<result property="layer" column="layer" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<sql id="selectHydrologyDataVo">
|
select id, record, hole_num, year, month, layer, create_time from js_hydrology_data
|
</sql>
|
|
<select id="selectHydrologyDataList" parameterType="HydrologyData" resultMap="HydrologyDataResult">
|
<include refid="selectHydrologyDataVo"/>
|
<where>
|
<if test="record != null "> and record = #{record}</if>
|
<if test="holeNum != null and holeNum != ''"> and hole_num = #{holeNum}</if>
|
<if test="year != null and year != ''"> and year = #{year}</if>
|
<if test="month != null and month != ''"> and month = #{month}</if>
|
<if test="layer != null and layer != ''"> and layer = #{layer}</if>
|
</where>
|
</select>
|
|
<select id="selectHydrologyDataListByNum" resultType="com.javaweb.hydrology.vo.HydrologyDataVo">
|
select record, year, month, layer from js_hydrology_data
|
where hole_num = #{holeNum} and year > #{year}
|
order by month asc
|
</select>
|
|
<select id="selectMaxData" parameterType="String" resultType="com.javaweb.hydrology.vo.HydrologyDataVo">
|
select record, year, month, layer from js_hydrology_data
|
where hole_num = #{holeNum} and record is not null
|
order by record desc limit 1
|
</select>
|
|
<select id="selectMinData" parameterType="String" resultType="com.javaweb.hydrology.vo.HydrologyDataVo">
|
select record, year, month, layer from js_hydrology_data
|
where hole_num = #{holeNum} and record is not null
|
order by record asc limit 1
|
</select>
|
|
<select id="selectHydrologyDataById" parameterType="Long" resultMap="HydrologyDataResult">
|
<include refid="selectHydrologyDataVo"/>
|
where id = #{id}
|
</select>
|
|
|
|
<insert id="insertHydrologyData" parameterType="HydrologyData" useGeneratedKeys="true" keyProperty="id">
|
insert into js_hydrology_data
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="record != null ">record,</if>
|
<if test="holeNum != null and holeNum != ''">hole_num,</if>
|
<if test="year != null and year != ''">year,</if>
|
<if test="month != null and month != ''">month,</if>
|
<if test="layer != null and layer != ''">layer,</if>
|
<if test="createTime != null ">create_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="record != null ">#{record},</if>
|
<if test="holeNum != null and holeNum != ''">#{holeNum},</if>
|
<if test="year != null and year != ''">#{year},</if>
|
<if test="month != null and month != ''">#{month},</if>
|
<if test="layer != null and layer != ''">#{layer},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateHydrologyData" parameterType="HydrologyData">
|
update js_hydrology_data
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="record != null ">record = #{record},</if>
|
<if test="holeNum != null and holeNum != ''">hole_num = #{holeNum},</if>
|
<if test="year != null and year != ''">year = #{year},</if>
|
<if test="month != null and month != ''">month = #{month},</if>
|
<if test="layer != null and layer != ''">layer = #{layer},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteHydrologyDataById" parameterType="Long">
|
delete from js_hydrology_data where id = #{id}
|
</delete>
|
|
|
<delete id="deleteHydrologyDataByEntity" parameterType="HydrologyData">
|
delete from js_hydrology_data where
|
hole_num = #{holeNum} and year = #{year} and month = #{month} and layer = #{layer}
|
</delete>
|
|
|
<delete id="deleteHydrologyDataByIds" parameterType="String">
|
delete from js_hydrology_data where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|