1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
| <?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.EquDao">
|
| <!--所有设备列表-->
| <select id="allEqus" parameterType="com.moral.monitor.entity.QueryHelper" resultType="com.moral.monitor.entity.Equipment">
| select * from equipment
| <where>
| <if test="search!=''">
| and name LIKE '%${search}%'
| </if>
| </where>
| limit #{offset},#{limit}
| </select>
|
| <select id="equscount" parameterType="com.moral.monitor.entity.QueryHelper" resultType="int">
| select COUNT(id) from equipment
| <where>
| <if test="search!=''">
| and name LIKE '%${search}%'
| </if>
| </where>
| </select>
|
|
|
| <!-- 删除设备-->
| <select id="deleteEqu" parameterType="String" >
| DELETE FROM `equipment` WHERE id=#{id}
| </select>
|
|
|
| <!--增加设备-->
| <select id="deletefrommac">
| DELETE FROM mac WHERE mac=#{mac}
| </select>
|
| <select id="addequ" parameterType="com.moral.monitor.entity.Equipment">
| insert into `equipment`(name,address,mac,longitude,latitude,province,city,area,time) VALUES(#{name},#{address},#{mac},#{longitude},#{latitude},#{province},#{city},#{area},NOW())
| </select>
|
| <select id="findsensor" resultType="com.moral.monitor.entity.Sensor">
| SELECT * from sensor WHERE ver=#{0} and type=#{1}
| </select>
|
| <select id="insertmac">
| insert into `mac`(mac,sensor) VALUES(#{0},#{1})
| </select>
|
| <!--修改设备-->
| <select id="editequ" parameterType="com.moral.monitor.entity.Equipment">
| update `equipment` set
| name=#{name},
| address=#{address},
| longitude=#{longitude},
| latitude=#{latitude},
| province=#{province},
| city=#{city},
| area=#{area}
| WHERE id=#{id}
| </select>
|
|
|
| </mapper>
|
|