ElectricityInfoMapper.xml 6.7 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.ElectricityInfoMapper">
    <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityInfo">
        <id column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
        <result column="action_type" property="actionType" jdbcType="VARCHAR"/>
        <result column="device_id" property="deviceId" jdbcType="VARCHAR"/>
        <result column="money" property="money" jdbcType="DECIMAL"/>
        <result column="ip_address" property="ipAddress" jdbcType="VARCHAR"/>
        <result column="secret" property="secret" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="VARCHAR"/>
        <result column="opert_time" property="opertTime" jdbcType="TIMESTAMP"/>
        <result column="edit_time" property="editTime" jdbcType="TIMESTAMP"/>
        <result column="info_status" property="infoStatus" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
    order_number, action_type, device_id, money, ip_address, secret, status, opert_time, 
    edit_time, info_status
  </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
        select
        <include refid="Base_Column_List"/>
        from electricity_info
        where order_number = #{orderNumber,jdbcType=VARCHAR}
    </select>

    <select id="selectAll" resultMap="BaseResultMap" parameterType="string">
        select
        <include refid="Base_Column_List"/>
        from electricity_info
        where status = '1'
        <if test="deviceId != null and deviceId != ''">
            and device_id = #{deviceId, jdbcType=VARCHAR}
        </if>
        order by opert_time desc
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from electricity_info
    where order_number = #{orderNumber,jdbcType=VARCHAR}
  </delete>
    <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
    insert into electricity_info (order_number, action_type, device_id, 
      money, ip_address, secret, 
      status, opert_time, edit_time, 
      info_status)
    values (#{orderNumber,jdbcType=VARCHAR}, #{actionType,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR}, 
      #{money,jdbcType=DECIMAL}, #{ipAddress,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, 
      #{status,jdbcType=VARCHAR}, #{opertTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP}, 
      #{infoStatus,jdbcType=VARCHAR})
  </insert>
    <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
        insert into electricity_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orderNumber != null">
                order_number,
            </if>
            <if test="actionType != null">
                action_type,
            </if>
            <if test="deviceId != null">
                device_id,
            </if>
            <if test="money != null">
                money,
            </if>
            <if test="ipAddress != null">
                ip_address,
            </if>
            <if test="secret != null">
                secret,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="opertTime != null">
                opert_time,
            </if>
            <if test="editTime != null">
                edit_time,
            </if>
            <if test="infoStatus != null">
                info_status,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderNumber != null">
                #{orderNumber,jdbcType=VARCHAR},
            </if>
            <if test="actionType != null">
                #{actionType,jdbcType=VARCHAR},
            </if>
            <if test="deviceId != null">
                #{deviceId,jdbcType=VARCHAR},
            </if>
            <if test="money != null">
                #{money,jdbcType=DECIMAL},
            </if>
            <if test="ipAddress != null">
                #{ipAddress,jdbcType=VARCHAR},
            </if>
            <if test="secret != null">
                #{secret,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=VARCHAR},
            </if>
            <if test="opertTime != null">
                #{opertTime,jdbcType=TIMESTAMP},
            </if>
            <if test="editTime != null">
                #{editTime,jdbcType=TIMESTAMP},
            </if>
            <if test="infoStatus != null">
                #{infoStatus,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
        update electricity_info
        <set>
            <if test="actionType != null">
                action_type = #{actionType,jdbcType=VARCHAR},
            </if>
            <if test="deviceId != null">
                device_id = #{deviceId,jdbcType=VARCHAR},
            </if>
            <if test="money != null">
                money = #{money,jdbcType=DECIMAL},
            </if>
            <if test="ipAddress != null">
                ip_address = #{ipAddress,jdbcType=VARCHAR},
            </if>
            <if test="secret != null">
                secret = #{secret,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=VARCHAR},
            </if>
            <if test="opertTime != null">
                opert_time = #{opertTime,jdbcType=TIMESTAMP},
            </if>
            <if test="editTime != null">
                edit_time = #{editTime,jdbcType=TIMESTAMP},
            </if>
            <if test="infoStatus != null">
                info_status = #{infoStatus,jdbcType=VARCHAR},
            </if>
        </set>
        where order_number = #{orderNumber,jdbcType=VARCHAR}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityInfo">
    update electricity_info
    set action_type = #{actionType,jdbcType=VARCHAR},
      device_id = #{deviceId,jdbcType=VARCHAR},
      money = #{money,jdbcType=DECIMAL},
      ip_address = #{ipAddress,jdbcType=VARCHAR},
      secret = #{secret,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      opert_time = #{opertTime,jdbcType=TIMESTAMP},
      edit_time = #{editTime,jdbcType=TIMESTAMP},
      info_status = #{infoStatus,jdbcType=VARCHAR}
    where order_number = #{orderNumber,jdbcType=VARCHAR}
  </update>
</mapper>