WaterMeterMapper.xml 6.3 KB
<?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.sunyo.energy.location.dao.WaterMeterMapper">
    <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.WaterMeter">
        <result column="wm_id" property="wmId" jdbcType="VARCHAR"/>
        <result column="wm_sacc" property="wmSacc" jdbcType="VARCHAR"/>
        <result column="wm_lacc" property="wmLacc" jdbcType="VARCHAR"/>
        <result column="wm_rdtime" property="wmRdtime" jdbcType="VARCHAR"/>
        <result column="wm_fmstate" property="wmFmstate" jdbcType="VARCHAR"/>
        <result column="wm_errmessage" property="wmErrmessage" jdbcType="VARCHAR"/>
        <result column="wm_voltage" property="wmVoltage" jdbcType="VARCHAR"/>
        <result column="wm_signalpower" property="wmSignalpower" jdbcType="VARCHAR"/>
        <result column="creatTime" property="creattime" jdbcType="TIMESTAMP"/>
        <result column="updateTime" property="updatetime" jdbcType="TIMESTAMP"/>
        <result column="reamke1" property="reamke1" jdbcType="VARCHAR"/>
        <result column="reamke2" property="reamke2" jdbcType="VARCHAR"/>
        <result column="reamke3" property="reamke3" jdbcType="VARCHAR"/>
        <result column="reamke4" property="reamke4" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="waterMeterAll" parameterType="string" resultMap="BaseResultMap">
    select * from water_meter where wm_id like concat('%',#{value},'%')
  </select>

    <insert id="insert" parameterType="com.sunyo.energy.location.model.WaterMeter">
    insert into water_meter (wm_id, wm_sacc, wm_lacc, 
      wm_rdtime, wm_fmstate, wm_errmessage, 
      wm_voltage, wm_signalpower, creatTime, 
      updateTime, reamke1, reamke2, 
      reamke3, reamke4)
    values (#{wmId,jdbcType=VARCHAR}, #{wmSacc,jdbcType=VARCHAR}, #{wmLacc,jdbcType=VARCHAR}, 
      #{wmRdtime,jdbcType=VARCHAR}, #{wmFmstate,jdbcType=VARCHAR}, #{wmErrmessage,jdbcType=VARCHAR}, 
      #{wmVoltage,jdbcType=VARCHAR}, #{wmSignalpower,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP}, 
      #{updatetime,jdbcType=TIMESTAMP}, #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}, 
      #{reamke3,jdbcType=VARCHAR}, #{reamke4,jdbcType=VARCHAR})
  </insert>


    <select id="selectAll" resultMap="BaseResultMap">
    select
    *
    from water_meter
    order by wm_rdtime desc
  </select>


    <select id="findOneWmSacc" resultType="java.lang.String">
    select reamke1 from water_meter where wm_id = #{value,jdbcType=VARCHAR}
  </select>

    <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.WaterMeter">
        insert into water_meter
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="wmId != null">
                wm_id,
            </if>
            <if test="wmSacc != null">
                wm_sacc,
            </if>
            <if test="wmLacc != null">
                wm_lacc,
            </if>
            <if test="wmRdtime != null">
                wm_rdtime,
            </if>
            <if test="wmFmstate != null">
                wm_fmstate,
            </if>
            <if test="wmErrmessage != null">
                wm_errmessage,
            </if>
            <if test="wmVoltage != null">
                wm_voltage,
            </if>
            <if test="wmSignalpower != null">
                wm_signalpower,
            </if>
            <if test="creattime != null">
                creatTime,
            </if>
            <if test="updatetime != null">
                updateTime,
            </if>
            <if test="reamke1 != null">
                reamke1,
            </if>
            <if test="reamke2 != null">
                reamke2,
            </if>
            <if test="reamke3 != null">
                reamke3,
            </if>
            <if test="reamke4 != null">
                reamke4,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="wmId != null">
                #{wmId,jdbcType=VARCHAR},
            </if>
            <if test="wmSacc != null">
                #{wmSacc,jdbcType=VARCHAR},
            </if>
            <if test="wmLacc != null">
                #{wmLacc,jdbcType=VARCHAR},
            </if>
            <if test="wmRdtime != null">
                #{wmRdtime,jdbcType=VARCHAR},
            </if>
            <if test="wmFmstate != null">
                #{wmFmstate,jdbcType=VARCHAR},
            </if>
            <if test="wmErrmessage != null">
                #{wmErrmessage,jdbcType=VARCHAR},
            </if>
            <if test="wmVoltage != null">
                #{wmVoltage,jdbcType=VARCHAR},
            </if>
            <if test="wmSignalpower != null">
                #{wmSignalpower,jdbcType=VARCHAR},
            </if>
            <if test="creattime != null">
                #{creattime,jdbcType=TIMESTAMP},
            </if>
            <if test="updatetime != null">
                #{updatetime,jdbcType=TIMESTAMP},
            </if>
            <if test="reamke1 != null">
                #{reamke1,jdbcType=VARCHAR},
            </if>
            <if test="reamke2 != null">
                #{reamke2,jdbcType=VARCHAR},
            </if>
            <if test="reamke3 != null">
                #{reamke3,jdbcType=VARCHAR},
            </if>
            <if test="reamke4 != null">
                #{reamke4,jdbcType=VARCHAR},
            </if>
        </trim>
        ON DUPLICATE KEY
        UPDATE
        wm_sacc = #{wmSacc,jdbcType=VARCHAR},
        wm_lacc = #{wmLacc,jdbcType=VARCHAR},
        wm_rdtime = #{wmRdtime,jdbcType=VARCHAR},
        wm_fmstate = #{wmFmstate,jdbcType=VARCHAR},
        wm_errmessage = #{wmErrmessage,jdbcType=VARCHAR},
        wm_voltage = #{wmVoltage,jdbcType=VARCHAR},
        wm_signalpower = #{wmSignalpower,jdbcType=VARCHAR},
        creatTime = #{creattime,jdbcType=TIMESTAMP},
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
        reamke1 = #{reamke1,jdbcType=VARCHAR},
        reamke2 = #{reamke2,jdbcType=VARCHAR},
        reamke3 = #{reamke3,jdbcType=VARCHAR},
        reamke4 = #{reamke4,jdbcType=VARCHAR}
    </insert>

    <update id="update" parameterType="java.lang.String">
    update water_meter set reamke1 = #{allSacc,jdbcType=VARCHAR}
    where wm_id = #{wmId, jdbcType=VARCHAR}
  </update>

</mapper>