<?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.moral.monitor.dao.EquipmentMapper">
|
<resultMap id="BaseResultMap" type="com.moral.monitor.entity.Equipment">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="address" jdbcType="VARCHAR" property="address" />
|
<result column="longitude" jdbcType="DOUBLE" property="longitude" />
|
<result column="latitude" jdbcType="DOUBLE" property="latitude" />
|
<result column="mac" jdbcType="VARCHAR" property="mac" />
|
<result column="state" jdbcType="INTEGER" property="state" />
|
<result column="time" jdbcType="TIMESTAMP" property="time" />
|
<result column="installer" jdbcType="VARCHAR" property="installer" />
|
<result column="repairman" jdbcType="VARCHAR" property="repairman" />
|
<result column="province" jdbcType="VARCHAR" property="province" />
|
<result column="city" jdbcType="VARCHAR" property="city" />
|
<result column="area" jdbcType="VARCHAR" property="area" />
|
<result column="monitorpoint" jdbcType="VARCHAR" property="monitorpoint" />
|
<result column="owner_id" jdbcType="VARCHAR" property="ownerId" />
|
</resultMap>
|
<sql id="Example_Where_Clause">
|
<where>
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
<if test="criteria.valid">
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<foreach collection="criteria.criteria" item="criterion">
|
<choose>
|
<when test="criterion.noValue">
|
and ${criterion.condition}
|
</when>
|
<when test="criterion.singleValue">
|
and ${criterion.condition} #{criterion.value}
|
</when>
|
<when test="criterion.betweenValue">
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
</when>
|
<when test="criterion.listValue">
|
and ${criterion.condition}
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
#{listItem}
|
</foreach>
|
</when>
|
</choose>
|
</foreach>
|
</trim>
|
</if>
|
</foreach>
|
</where>
|
</sql>
|
<sql id="Update_By_Example_Where_Clause">
|
<where>
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
<if test="criteria.valid">
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<foreach collection="criteria.criteria" item="criterion">
|
<choose>
|
<when test="criterion.noValue">
|
and ${criterion.condition}
|
</when>
|
<when test="criterion.singleValue">
|
and ${criterion.condition} #{criterion.value}
|
</when>
|
<when test="criterion.betweenValue">
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
</when>
|
<when test="criterion.listValue">
|
and ${criterion.condition}
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
#{listItem}
|
</foreach>
|
</when>
|
</choose>
|
</foreach>
|
</trim>
|
</if>
|
</foreach>
|
</where>
|
</sql>
|
<sql id="Base_Column_List">
|
id, name, address, longitude, latitude, mac, state, time, installer, repairman, province,
|
city, area, monitorpoint, owner_id
|
</sql>
|
<select id="selectByExample" parameterType="com.moral.monitor.entity.EquipmentExample" resultMap="BaseResultMap">
|
select
|
<if test="distinct">
|
distinct
|
</if>
|
<include refid="Base_Column_List" />
|
from equipment
|
<if test="_parameter != null">
|
<include refid="Example_Where_Clause" />
|
</if>
|
<if test="orderByClause != null">
|
order by ${orderByClause}
|
</if>
|
</select>
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from equipment
|
where id = #{id,jdbcType=INTEGER}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
delete from equipment
|
where id = #{id,jdbcType=INTEGER}
|
</delete>
|
<delete id="deleteByExample" parameterType="com.moral.monitor.entity.EquipmentExample">
|
delete from equipment
|
<if test="_parameter != null">
|
<include refid="Example_Where_Clause" />
|
</if>
|
</delete>
|
<insert id="insert" parameterType="com.moral.monitor.entity.Equipment">
|
insert into equipment (id, name, address,
|
longitude, latitude, mac,
|
state, time, installer,
|
repairman, province, city,
|
area, monitorpoint, owner_id
|
)
|
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
#{longitude,jdbcType=DOUBLE}, #{latitude,jdbcType=DOUBLE}, #{mac,jdbcType=VARCHAR},
|
#{state,jdbcType=INTEGER}, #{time,jdbcType=TIMESTAMP}, #{installer,jdbcType=VARCHAR},
|
#{repairman,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR},
|
#{area,jdbcType=VARCHAR}, #{monitorpoint,jdbcType=VARCHAR}, #{ownerId,jdbcType=VARCHAR}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="com.moral.monitor.entity.Equipment">
|
insert into equipment
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="name != null">
|
name,
|
</if>
|
<if test="address != null">
|
address,
|
</if>
|
<if test="longitude != null">
|
longitude,
|
</if>
|
<if test="latitude != null">
|
latitude,
|
</if>
|
<if test="mac != null">
|
mac,
|
</if>
|
<if test="state != null">
|
state,
|
</if>
|
<if test="time != null">
|
time,
|
</if>
|
<if test="installer != null">
|
installer,
|
</if>
|
<if test="repairman != null">
|
repairman,
|
</if>
|
<if test="province != null">
|
province,
|
</if>
|
<if test="city != null">
|
city,
|
</if>
|
<if test="area != null">
|
area,
|
</if>
|
<if test="monitorpoint != null">
|
monitorpoint,
|
</if>
|
<if test="ownerId != null">
|
owner_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id,jdbcType=INTEGER},
|
</if>
|
<if test="name != null">
|
#{name,jdbcType=VARCHAR},
|
</if>
|
<if test="address != null">
|
#{address,jdbcType=VARCHAR},
|
</if>
|
<if test="longitude != null">
|
#{longitude,jdbcType=DOUBLE},
|
</if>
|
<if test="latitude != null">
|
#{latitude,jdbcType=DOUBLE},
|
</if>
|
<if test="mac != null">
|
#{mac,jdbcType=VARCHAR},
|
</if>
|
<if test="state != null">
|
#{state,jdbcType=INTEGER},
|
</if>
|
<if test="time != null">
|
#{time,jdbcType=TIMESTAMP},
|
</if>
|
<if test="installer != null">
|
#{installer,jdbcType=VARCHAR},
|
</if>
|
<if test="repairman != null">
|
#{repairman,jdbcType=VARCHAR},
|
</if>
|
<if test="province != null">
|
#{province,jdbcType=VARCHAR},
|
</if>
|
<if test="city != null">
|
#{city,jdbcType=VARCHAR},
|
</if>
|
<if test="area != null">
|
#{area,jdbcType=VARCHAR},
|
</if>
|
<if test="monitorpoint != null">
|
#{monitorpoint,jdbcType=VARCHAR},
|
</if>
|
<if test="ownerId != null">
|
#{ownerId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="countByExample" parameterType="com.moral.monitor.entity.EquipmentExample" resultType="java.lang.Long">
|
select count(*) from equipment
|
<if test="_parameter != null">
|
<include refid="Example_Where_Clause" />
|
</if>
|
</select>
|
<update id="updateByExampleSelective" parameterType="map">
|
update equipment
|
<set>
|
<if test="record.name != null">
|
name = #{record.name,jdbcType=VARCHAR},
|
</if>
|
<if test="record.address != null">
|
address = #{record.address,jdbcType=VARCHAR},
|
</if>
|
<if test="record.longitude != null">
|
longitude = #{record.longitude,jdbcType=DOUBLE},
|
</if>
|
<if test="record.latitude != null">
|
latitude = #{record.latitude,jdbcType=DOUBLE},
|
</if>
|
<if test="record.mac != null">
|
mac = #{record.mac,jdbcType=VARCHAR},
|
</if>
|
<if test="record.state != null">
|
state = #{record.state,jdbcType=INTEGER},
|
</if>
|
<if test="record.time != null">
|
time = #{record.time,jdbcType=TIMESTAMP},
|
</if>
|
<if test="record.installer != null">
|
installer = #{record.installer,jdbcType=VARCHAR},
|
</if>
|
<if test="record.repairman != null">
|
repairman = #{record.repairman,jdbcType=VARCHAR},
|
</if>
|
<if test="record.province != null">
|
province = #{record.province,jdbcType=VARCHAR},
|
</if>
|
<if test="record.city != null">
|
city = #{record.city,jdbcType=VARCHAR},
|
</if>
|
<if test="record.area != null">
|
area = #{record.area,jdbcType=VARCHAR},
|
</if>
|
<if test="record.monitorpoint != null">
|
monitorpoint = #{record.monitorpoint,jdbcType=VARCHAR},
|
</if>
|
<if test="record.ownerId != null">
|
owner_id = #{record.ownerId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
<if test="_parameter != null">
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByExample" parameterType="map">
|
update equipment
|
set id = #{record.id,jdbcType=INTEGER},
|
name = #{record.name,jdbcType=VARCHAR},
|
address = #{record.address,jdbcType=VARCHAR},
|
longitude = #{record.longitude,jdbcType=DOUBLE},
|
latitude = #{record.latitude,jdbcType=DOUBLE},
|
mac = #{record.mac,jdbcType=VARCHAR},
|
state = #{record.state,jdbcType=INTEGER},
|
time = #{record.time,jdbcType=TIMESTAMP},
|
installer = #{record.installer,jdbcType=VARCHAR},
|
repairman = #{record.repairman,jdbcType=VARCHAR},
|
province = #{record.province,jdbcType=VARCHAR},
|
city = #{record.city,jdbcType=VARCHAR},
|
area = #{record.area,jdbcType=VARCHAR},
|
monitorpoint = #{record.monitorpoint,jdbcType=VARCHAR},
|
owner_id = #{record.ownerId,jdbcType=VARCHAR}
|
<if test="_parameter != null">
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.moral.monitor.entity.Equipment">
|
update equipment
|
<set>
|
<if test="name != null">
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="address != null">
|
address = #{address,jdbcType=VARCHAR},
|
</if>
|
<if test="longitude != null">
|
longitude = #{longitude,jdbcType=DOUBLE},
|
</if>
|
<if test="latitude != null">
|
latitude = #{latitude,jdbcType=DOUBLE},
|
</if>
|
<if test="mac != null">
|
mac = #{mac,jdbcType=VARCHAR},
|
</if>
|
<if test="state != null">
|
state = #{state,jdbcType=INTEGER},
|
</if>
|
<if test="time != null">
|
time = #{time,jdbcType=TIMESTAMP},
|
</if>
|
<if test="installer != null">
|
installer = #{installer,jdbcType=VARCHAR},
|
</if>
|
<if test="repairman != null">
|
repairman = #{repairman,jdbcType=VARCHAR},
|
</if>
|
<if test="province != null">
|
province = #{province,jdbcType=VARCHAR},
|
</if>
|
<if test="city != null">
|
city = #{city,jdbcType=VARCHAR},
|
</if>
|
<if test="area != null">
|
area = #{area,jdbcType=VARCHAR},
|
</if>
|
<if test="monitorpoint != null">
|
monitorpoint = #{monitorpoint,jdbcType=VARCHAR},
|
</if>
|
<if test="ownerId != null">
|
owner_id = #{ownerId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.moral.monitor.entity.Equipment">
|
update equipment
|
set name = #{name,jdbcType=VARCHAR},
|
address = #{address,jdbcType=VARCHAR},
|
longitude = #{longitude,jdbcType=DOUBLE},
|
latitude = #{latitude,jdbcType=DOUBLE},
|
mac = #{mac,jdbcType=VARCHAR},
|
state = #{state,jdbcType=INTEGER},
|
time = #{time,jdbcType=TIMESTAMP},
|
installer = #{installer,jdbcType=VARCHAR},
|
repairman = #{repairman,jdbcType=VARCHAR},
|
province = #{province,jdbcType=VARCHAR},
|
city = #{city,jdbcType=VARCHAR},
|
area = #{area,jdbcType=VARCHAR},
|
monitorpoint = #{monitorpoint,jdbcType=VARCHAR},
|
owner_id = #{ownerId,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
</mapper>
|