作者 钟来

修改设备模块查询列表得排序和状态筛选

@@ -19,26 +19,7 @@ public class SysMonitorServerLog { @@ -19,26 +19,7 @@ public class SysMonitorServerLog {
19 private Integer connection_count; 19 private Integer connection_count;
20 @ApiModelProperty("创建时间") 20 @ApiModelProperty("创建时间")
21 private Long create_time; 21 private Long create_time;
22 - @ApiModelProperty("内存信息")  
23 - private String memory_info;  
24 - @ApiModelProperty("cpu信息")  
25 - private String cpu_info;  
26 22
27 - public String getMemory_info() {  
28 - return memory_info;  
29 - }  
30 -  
31 - public void setMemory_info(String memory_info) {  
32 - this.memory_info = memory_info;  
33 - }  
34 -  
35 - public String getCpu_info() {  
36 - return cpu_info;  
37 - }  
38 -  
39 - public void setCpu_info(String cpu_info) {  
40 - this.cpu_info = cpu_info;  
41 - }  
42 public Integer getId() { 23 public Integer getId() {
43 return id; 24 return id;
44 } 25 }
@@ -48,26 +48,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -48,26 +48,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
48 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id 48 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id
49 <where> 49 <where>
50 <if test="status !=null"> 50 <if test="status !=null">
51 - and `status` = #{status} 51 + and a.`status` = #{status}
52 </if> 52 </if>
53 <if test="product_id !=null and product_id != ''"> 53 <if test="product_id !=null and product_id != ''">
54 - and product_id = #{product_id} 54 + and a.product_id = #{product_id}
55 </if> 55 </if>
56 <if test="mqtt_username !=null and mqtt_username != ''"> 56 <if test="mqtt_username !=null and mqtt_username != ''">
57 - and mqtt_username = #{mqtt_username} 57 + and a.mqtt_username = #{mqtt_username}
58 </if> 58 </if>
59 <if test="client_id != null and client_id != ''"> 59 <if test="client_id != null and client_id != ''">
60 - AND client_id like concat('%', #{client_id}, '%') 60 + AND a.client_id like concat('%', #{client_id}, '%')
61 </if> 61 </if>
62 <if test="sys_user_id !=null"> 62 <if test="sys_user_id !=null">
63 - and `sys_user_id` = #{sys_user_id} 63 + and a.`sys_user_id` = #{sys_user_id}
64 </if> 64 </if>
65 - <if test="params.dataScope !=null and params.dataScope!=''"> 65 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
66 <!-- 数据范围过滤 --> 66 <!-- 数据范围过滤 -->
67 ${params.dataScope} 67 ${params.dataScope}
68 </if> 68 </if>
69 </where> 69 </where>
70 - 70 + order by a.create_time desc
71 </select> 71 </select>
72 72
73 <select id="selectIotDeviceByClient_id" parameterType="String" resultMap="IotDeviceResult"> 73 <select id="selectIotDeviceByClient_id" parameterType="String" resultMap="IotDeviceResult">
@@ -47,11 +47,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -47,11 +47,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
47 <if test="sys_user_id !=null and sys_user_id != ''"> 47 <if test="sys_user_id !=null and sys_user_id != ''">
48 and sys_user_id = #{sys_user_id} 48 and sys_user_id = #{sys_user_id}
49 </if> 49 </if>
50 - <if test="params.dataScope !=null and params.dataScope!=''"> 50 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
51 <!-- 数据范围过滤 --> 51 <!-- 数据范围过滤 -->
52 ${params.dataScope} 52 ${params.dataScope}
53 </if> 53 </if>
54 </where> 54 </where>
  55 +
  56 + order by a.create_time desc
55 </select> 57 </select>
56 58
57 <select id="selectIotProductById" parameterType="Integer" resultMap="IotProductResult"> 59 <select id="selectIotProductById" parameterType="Integer" resultMap="IotProductResult">
@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
21 <include refid="selectIotRoleVo"/> 21 <include refid="selectIotRoleVo"/>
22 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id 22 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id
23 <where> 23 <where>
24 - <if test="params.dataScope !=null and params.dataScope!=''"> 24 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
25 <!-- 数据范围过滤 --> 25 <!-- 数据范围过滤 -->
26 ${params.dataScope} 26 ${params.dataScope}
27 </if> 27 </if>
@@ -74,25 +74,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -74,25 +74,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
74 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id 74 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id
75 <where> 75 <where>
76 <if test="device_id !=null and device_id != ''"> 76 <if test="device_id !=null and device_id != ''">
77 - and device_id = #{device_id} 77 + and a.device_id = #{device_id}
  78 + </if>
  79 + <if test="online !=null">
  80 + and a.online = #{online}
78 </if> 81 </if>
79 <if test="name != null and name != ''"> 82 <if test="name != null and name != ''">
80 - AND `name` like concat('%', #{name}, '%') 83 + AND a.`name` like concat('%', #{name}, '%')
81 </if> 84 </if>
82 <if test="product_id !=null and product_id != ''"> 85 <if test="product_id !=null and product_id != ''">
83 - and product_id = #{product_id} 86 + and a.product_id = #{product_id}
84 </if> 87 </if>
85 <if test="mqtt_username != null and mqtt_username != ''"> 88 <if test="mqtt_username != null and mqtt_username != ''">
86 - AND `mqtt_username` like concat('%', #{mqtt_username}, '%') 89 + AND a.`mqtt_username` like concat('%', #{mqtt_username}, '%')
87 </if> 90 </if>
88 <if test="sys_user_id !=null and sys_user_id != ''"> 91 <if test="sys_user_id !=null and sys_user_id != ''">
89 - and sys_user_id = #{sys_user_id} 92 + and a.sys_user_id = #{sys_user_id}
90 </if> 93 </if>
91 - <if test="params.dataScope !=null and params.dataScope!=''"> 94 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
92 <!-- 数据范围过滤 --> 95 <!-- 数据范围过滤 -->
93 ${params.dataScope} 96 ${params.dataScope}
94 </if> 97 </if>
95 </where> 98 </where>
  99 + order by a.create_time desc
96 </select> 100 </select>
97 101
98 <select id="selectIotTerminalListByUserId" parameterType="IotTerminal" resultMap="IotTerminalResult"> 102 <select id="selectIotTerminalListByUserId" parameterType="IotTerminal" resultMap="IotTerminalResult">
@@ -38,46 +38,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -38,46 +38,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
38 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id 38 LEFT JOIN `sys_user` u ON u.user_id = a.sys_user_id
39 <where> 39 <where>
40 <if test="create_by !=null and create_by != ''"> 40 <if test="create_by !=null and create_by != ''">
41 - and create_by = #{create_by} 41 + and a.create_by = #{create_by}
42 </if> 42 </if>
43 <if test="data_type !=null and data_type != ''"> 43 <if test="data_type !=null and data_type != ''">
44 - and data_type = #{data_type} 44 + and a.data_type = #{data_type}
45 </if> 45 </if>
46 <if test="identifier !=null and identifier != ''"> 46 <if test="identifier !=null and identifier != ''">
47 - and identifier = #{identifier} 47 + and a.identifier = #{identifier}
48 </if> 48 </if>
49 <if test="is_save_log !=null and is_save_log != ''"> 49 <if test="is_save_log !=null and is_save_log != ''">
50 - and is_save_log = #{is_save_log} 50 + and a.is_save_log = #{is_save_log}
51 </if> 51 </if>
52 <if test="is_monitor !=null and is_monitor != ''"> 52 <if test="is_monitor !=null and is_monitor != ''">
53 - and is_monitor = #{is_monitor} 53 + and a.is_monitor = #{is_monitor}
54 </if> 54 </if>
55 <if test="model_id !=null and model_id != ''"> 55 <if test="model_id !=null and model_id != ''">
56 - and model_id = #{model_id} 56 + and a.model_id = #{model_id}
57 </if> 57 </if>
58 <if test="model_name !=null and model_name != ''"> 58 <if test="model_name !=null and model_name != ''">
59 - and model_name = #{model_name} 59 + and a.model_name = #{model_name}
60 </if> 60 </if>
61 <if test="type !=null and type != ''"> 61 <if test="type !=null and type != ''">
62 and `type` = #{type} 62 and `type` = #{type}
63 </if> 63 </if>
64 <if test="product_id !=null and product_id != ''"> 64 <if test="product_id !=null and product_id != ''">
65 - and product_id = #{product_id} 65 + and a.product_id = #{product_id}
66 </if> 66 </if>
67 <if test="mqtt_username !=null and mqtt_username != ''"> 67 <if test="mqtt_username !=null and mqtt_username != ''">
68 - and mqtt_username = #{mqtt_username} 68 + and a.mqtt_username = #{mqtt_username}
69 </if> 69 </if>
70 <if test="ascription !=null and ascription != ''"> 70 <if test="ascription !=null and ascription != ''">
71 - and ascription = #{ascription} 71 + and a.ascription = #{ascription}
72 </if> 72 </if>
73 <if test="sys_user_id !=null and sys_user_id != ''"> 73 <if test="sys_user_id !=null and sys_user_id != ''">
74 - and sys_user_id = #{sys_user_id} 74 + and a.sys_user_id = #{sys_user_id}
75 </if> 75 </if>
76 - <if test="params.dataScope !=null and params.dataScope!=''"> 76 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
77 <!-- 数据范围过滤 --> 77 <!-- 数据范围过滤 -->
78 ${params.dataScope} 78 ${params.dataScope}
79 </if> 79 </if>
80 </where> 80 </where>
  81 + order by a.create_time desc
81 </select> 82 </select>
82 83
83 <select id="selectIotThingsModelListByIds" parameterType="Integer" resultMap="IotThingsModelResult"> 84 <select id="selectIotThingsModelListByIds" parameterType="Integer" resultMap="IotThingsModelResult">
@@ -42,8 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -42,8 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
42 <if test="status != null and status != ''"> 42 <if test="status != null and status != ''">
43 AND status = #{status} 43 AND status = #{status}
44 </if> 44 </if>
45 - <!-- 数据范围过滤 -->  
46 - ${params.dataScope} 45 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
  46 + <!-- 数据范围过滤 -->
  47 + ${params.dataScope}
  48 + </if>
47 order by d.parent_id, d.order_num 49 order by d.parent_id, d.order_num
48 </select> 50 </select>
49 51
@@ -52,7 +52,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -52,7 +52,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
52 and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') 52 and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
53 </if> 53 </if>
54 <!-- 数据范围过滤 --> 54 <!-- 数据范围过滤 -->
55 - ${params.dataScope} 55 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
  56 + <!-- 数据范围过滤 -->
  57 + ${params.dataScope}
  58 + </if>
56 order by r.role_sort 59 order by r.role_sort
57 </select> 60 </select>
58 61
@@ -81,8 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -81,8 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
81 <if test="deptId != null and deptId != 0"> 81 <if test="deptId != null and deptId != 0">
82 AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) 82 AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
83 </if> 83 </if>
84 - <!-- 数据范围过滤 -->  
85 - ${params.dataScope} 84 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
  85 + <!-- 数据范围过滤 -->
  86 + ${params.dataScope}
  87 + </if>
86 </select> 88 </select>
87 89
88 <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> 90 <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
@@ -98,8 +100,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -98,8 +100,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
98 <if test="phonenumber != null and phonenumber != ''"> 100 <if test="phonenumber != null and phonenumber != ''">
99 AND u.phonenumber like concat('%', #{phonenumber}, '%') 101 AND u.phonenumber like concat('%', #{phonenumber}, '%')
100 </if> 102 </if>
101 - <!-- 数据范围过滤 -->  
102 - ${params.dataScope} 103 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
  104 + <!-- 数据范围过滤 -->
  105 + ${params.dataScope}
  106 + </if>
103 </select> 107 </select>
104 108
105 <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> 109 <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
@@ -116,8 +120,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -116,8 +120,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
116 <if test="phonenumber != null and phonenumber != ''"> 120 <if test="phonenumber != null and phonenumber != ''">
117 AND u.phonenumber like concat('%', #{phonenumber}, '%') 121 AND u.phonenumber like concat('%', #{phonenumber}, '%')
118 </if> 122 </if>
119 - <!-- 数据范围过滤 -->  
120 - ${params.dataScope} 123 + <if test="params!=null and params.dataScope !=null and params.dataScope!=''">
  124 + <!-- 数据范围过滤 -->
  125 + ${params.dataScope}
  126 + </if>
121 </select> 127 </select>
122 128
123 <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> 129 <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
@@ -106,8 +106,6 @@ public class ServerController extends BaseController @@ -106,8 +106,6 @@ public class ServerController extends BaseController
106 sysMonitorServerLog.setMemory_usage(sysMonitorServer.getMemory_usage()); 106 sysMonitorServerLog.setMemory_usage(sysMonitorServer.getMemory_usage());
107 sysMonitorServerLog.setDisk_usage(sysMonitorServer.getDisk_usage()); 107 sysMonitorServerLog.setDisk_usage(sysMonitorServer.getDisk_usage());
108 sysMonitorServerLog.setCreate_time(System.currentTimeMillis()); 108 sysMonitorServerLog.setCreate_time(System.currentTimeMillis());
109 - sysMonitorServerLog.setCpu_info(sysMonitorServer.getCpu_info());  
110 - sysMonitorServerLog.setMemory_info(sysMonitorServer.getMemory_info());  
111 publicService.insert(sysMonitorServerLog); 109 publicService.insert(sysMonitorServerLog);
112 return AjaxResult.success(); 110 return AjaxResult.success();
113 } 111 }