From a768bf08d33635cff018c6cda0e989245fc0a072 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Thu, 26 Oct 2017 11:04:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/moral/monitor/entity/OrganizationExample.java           | 1291 ++++++++++++++++++++++++
 src/main/java/com/moral/monitor/controller/ScreenApiController.java       |   84 -
 src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java       |   87 +
 src/main/java/com/moral/monitor/entity/Organization.java                  |  165 +++
 src/main/resources/mapper/HistoryEntityMapper.xml                         |  291 +++++
 src/main/java/com/moral/monitor/service/impl/OrganizationServiceImpl.java |   36 
 src/main/java/com/moral/monitor/dao/HistoryEntityMapper.java              |   13 
 src/main/java/com/moral/monitor/entity/HistoryEntity.java                 |   65 +
 pom.xml                                                                   |    5 
 src/main/java/com/moral/monitor/dao/OrganizationMapper.java               |    7 
 src/main/java/com/moral/monitor/dao/AccountEntityMapper.java              |   25 
 src/main/java/com/moral/monitor/dao/BaseDao.java                          |   24 
 src/main/java/com/moral/monitor/entity/HistoryEntityExample.java          |  591 +++++++++++
 src/main/java/com/moral/monitor/service/OrganizationService.java          |    9 
 src/main/java/com/moral/monitor/service/ScreenService.java                |    5 
 src/main/java/com/moral/monitor/controller/ScreenController.java          |   82 +
 src/main/resources/mapper/OrganizationMapper.xml                          |  385 +++++++
 17 files changed, 3,073 insertions(+), 92 deletions(-)

diff --git a/pom.xml b/pom.xml
index e3f235c..5acddec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -193,6 +193,11 @@
             <artifactId>jedis</artifactId>
             <version>2.9.0</version>
         </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <version>4.1.6.RELEASE</version>
+    </dependency>
 
 	</dependencies>
 
diff --git a/src/main/java/com/moral/monitor/controller/ScreenApiController.java b/src/main/java/com/moral/monitor/controller/ScreenApiController.java
index 18cbeee..4f114a7 100644
--- a/src/main/java/com/moral/monitor/controller/ScreenApiController.java
+++ b/src/main/java/com/moral/monitor/controller/ScreenApiController.java
@@ -1,43 +1,27 @@
 package com.moral.monitor.controller;
 
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.alibaba.fastjson.JSON;
-import com.moral.monitor.entity.AccountEntity;
 import com.moral.monitor.entity.Equipment;
 import com.moral.monitor.entity.State;
 import com.moral.monitor.service.ScreenApiService;
-import com.moral.monitor.service.ScreenService;
-import com.moral.monitor.util.Crypto;
 import com.moral.monitor.util.ScreenApiData;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import javax.annotation.Resource;
+import java.util.LinkedHashMap;
+import java.util.List;
 
 /**
  * Created by a on 2017/7/12.
  */
-@RestController
-@RequestMapping(value = "screen")
-@CrossOrigin(origins = "*", maxAge = 3600)
+//@Controller
+//@RequestMapping(value = "screen")
 public class ScreenApiController {
 
-	@Autowired
+    @Resource
     ScreenApiService screenApiService;
 
-    @Autowired
-    private ScreenService screenService;
     /**
      * ������������/������������ ���������������������������������������������������������������������
      * @param area  ������������������������ ������������������������������
@@ -148,45 +132,13 @@
     }
 
 
-    
-	/**
-	 * Screen login.
-	 *
-	 * @param request the request
-	 * @return the map
-	 */
-	@RequestMapping(value = "/login", method = RequestMethod.GET)
-	public Map<String, Object> screenLogin(HttpServletRequest request) {
-		Map<String, Object> resultMap = new HashMap<String, Object>();
-		String msg = "";
-		Integer accountId = -1;
-		String account = request.getParameter("account");
-		String password = request.getParameter("password");
-		if (StringUtils.isBlank(account) || StringUtils.isBlank(password)) {
-			msg = "������������������������������������";
-		} else {
-			try {
-				password = Crypto.md5(password);
-				List<AccountEntity> accountLists = screenService.getAccountLists(account, password);
-				if (CollectionUtils.isEmpty(accountLists) || accountLists.size() != 1) {
-					msg = "���������������������������������";
-				} else {
-					AccountEntity accountEntity = accountLists.get(0);
-					if ("1".equals(accountEntity.getEnable())) {
-						msg = "���������������";
-						accountId = accountEntity.getId();
-					} else {
-						msg = "���������������������������������������������";
-					}
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				msg = "���������������������������������";
-			}
-		}
-		resultMap.put("msg", msg);
-		resultMap.put("accountId", accountId);
-		return resultMap;
-	}
-	
+
+
+
+
+
+
+
+
+
 }
diff --git a/src/main/java/com/moral/monitor/controller/ScreenController.java b/src/main/java/com/moral/monitor/controller/ScreenController.java
new file mode 100644
index 0000000..6a5b52b
--- /dev/null
+++ b/src/main/java/com/moral/monitor/controller/ScreenController.java
@@ -0,0 +1,82 @@
+package com.moral.monitor.controller;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.util.WebUtils;
+
+import com.moral.monitor.entity.AccountEntity;
+import com.moral.monitor.service.ScreenService;
+import com.moral.monitor.util.Crypto;
+
+@RestController
+@RequestMapping(value = "screen")
+@CrossOrigin(origins = "*", maxAge = 3600)
+public class ScreenController {
+
+	@Autowired
+    private ScreenService screenService;
+	/**
+	 * Screen login.
+	 *
+	 * @param request the request
+	 * @return the map
+	 */
+	@RequestMapping(value = "/login", method = RequestMethod.GET)
+	public Map<String, Object> screenLogin(HttpServletRequest request) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		String msg = "";
+		Integer accountId = -1;
+		String account = request.getParameter("account");
+		String password = request.getParameter("password");
+		if (StringUtils.isBlank(account) || StringUtils.isBlank(password)) {
+			msg = "������������������������������������";
+		} else {
+			try {
+				password = Crypto.md5(password);
+				List<AccountEntity> accountLists = screenService.getAccountLists(account, password);
+				if (CollectionUtils.isEmpty(accountLists) || accountLists.size() != 1) {
+					msg = "���������������������������������";
+				} else {
+					AccountEntity accountEntity = accountLists.get(0);
+					if ("1".equals(accountEntity.getEnable())) {
+						msg = "���������������";
+						accountId = accountEntity.getId();
+					} else {
+						msg = "���������������������������������������������";
+					}
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+				msg = "���������������������������������";
+			}
+		}
+		resultMap.put("msg", msg);
+		resultMap.put("accountId", accountId);
+		return resultMap;
+	}
+	
+	@RequestMapping(value = "/month-average", method = RequestMethod.GET)
+	public Map<String, Object> getDataByEquipmentMac(HttpServletRequest request) {
+		Map<String, Object> parameters = WebUtils.getParametersStartingWith(request,null);
+		Map<String, Object> resu =  screenService.getDataByEquipmentMac(parameters);
+		return resu;
+	}
+
+	@RequestMapping(value = "/all-average", method = RequestMethod.GET)
+	public Map<String, Object> getAverageByAll(HttpServletRequest request) {
+		Map<String, Object> parameters = WebUtils.getParametersStartingWith(request,null);
+		Map<String, Object> resu =  screenService.getAverageByAll(parameters);
+		return resu;
+	}
+}
diff --git a/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java b/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java
index 40407ce..8775c52 100644
--- a/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java
+++ b/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java
@@ -2,29 +2,6 @@
 
 import com.moral.monitor.entity.AccountEntity;
 import com.moral.monitor.entity.AccountEntityExample;
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
 
-public interface AccountEntityMapper {
-    int countByExample(AccountEntityExample example);
-
-    int deleteByExample(AccountEntityExample example);
-
-    int deleteByPrimaryKey(Integer id);
-
-    int insert(AccountEntity record);
-
-    int insertSelective(AccountEntity record);
-
-    List<AccountEntity> selectByExample(AccountEntityExample example);
-
-    AccountEntity selectByPrimaryKey(Integer id);
-
-    int updateByExampleSelective(@Param("record") AccountEntity record, @Param("example") AccountEntityExample example);
-
-    int updateByExample(@Param("record") AccountEntity record, @Param("example") AccountEntityExample example);
-
-    int updateByPrimaryKeySelective(AccountEntity record);
-
-    int updateByPrimaryKey(AccountEntity record);
+public interface AccountEntityMapper extends BaseDao<AccountEntity, AccountEntityExample, Integer>{
 }
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/dao/BaseDao.java b/src/main/java/com/moral/monitor/dao/BaseDao.java
new file mode 100644
index 0000000..777c7f4
--- /dev/null
+++ b/src/main/java/com/moral/monitor/dao/BaseDao.java
@@ -0,0 +1,24 @@
+package com.moral.monitor.dao;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.dao.DataAccessException;
+
+public interface BaseDao <Entity, Example,PK extends Serializable> extends Serializable{
+	int insert(Entity record) throws DataAccessException;
+	int insertSelective(Entity record) throws DataAccessException;
+
+	int deleteByPrimaryKey(PK PK) throws DataAccessException;
+	int deleteByExample(Example example) throws DataAccessException;
+
+	int updateByPrimaryKeySelective(Entity record) throws DataAccessException;
+	int updateByPrimaryKey(Entity record) throws DataAccessException;
+	int updateByExampleSelective(@Param("record") Entity record, @Param("example") Example example) throws DataAccessException;
+	int updateByExample(@Param("record") Entity record, @Param("example") Example example) throws DataAccessException;
+
+	int countByExample(Example example) throws DataAccessException;
+	Entity selectByPrimaryKey(PK pk) throws DataAccessException;
+	List<Entity> selectByExample(Example example) throws DataAccessException;
+}
diff --git a/src/main/java/com/moral/monitor/dao/HistoryEntityMapper.java b/src/main/java/com/moral/monitor/dao/HistoryEntityMapper.java
new file mode 100644
index 0000000..39789e9
--- /dev/null
+++ b/src/main/java/com/moral/monitor/dao/HistoryEntityMapper.java
@@ -0,0 +1,13 @@
+package com.moral.monitor.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import com.moral.monitor.entity.HistoryEntity;
+import com.moral.monitor.entity.HistoryEntityExample;
+
+public interface HistoryEntityMapper extends BaseDao<HistoryEntity, HistoryEntityExample, Integer>{
+    Map<String, Object> getMonthAverageBySensor(Map<String, Object> parameters);
+
+	List<Map<String, Object>> getAverageByAll(Map<String, Object> parameters); 
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/dao/OrganizationMapper.java b/src/main/java/com/moral/monitor/dao/OrganizationMapper.java
new file mode 100644
index 0000000..e7b9335
--- /dev/null
+++ b/src/main/java/com/moral/monitor/dao/OrganizationMapper.java
@@ -0,0 +1,7 @@
+package com.moral.monitor.dao;
+
+import com.moral.monitor.entity.Organization;
+import com.moral.monitor.entity.OrganizationExample;
+
+public interface OrganizationMapper extends BaseDao<Organization, OrganizationExample, String>{
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/entity/HistoryEntity.java b/src/main/java/com/moral/monitor/entity/HistoryEntity.java
new file mode 100644
index 0000000..cefe167
--- /dev/null
+++ b/src/main/java/com/moral/monitor/entity/HistoryEntity.java
@@ -0,0 +1,65 @@
+package com.moral.monitor.entity;
+
+import java.util.Date;
+
+public class HistoryEntity {
+    private Integer id;
+
+    private String mac;
+
+    private String sensor;
+
+    private String macKey;
+
+    private Double macValue;
+
+    private Date time;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getMac() {
+        return mac;
+    }
+
+    public void setMac(String mac) {
+        this.mac = mac;
+    }
+
+    public String getSensor() {
+        return sensor;
+    }
+
+    public void setSensor(String sensor) {
+        this.sensor = sensor;
+    }
+
+    public String getMacKey() {
+        return macKey;
+    }
+
+    public void setMacKey(String macKey) {
+        this.macKey = macKey;
+    }
+
+    public Double getMacValue() {
+        return macValue;
+    }
+
+    public void setMacValue(Double macValue) {
+        this.macValue = macValue;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/entity/HistoryEntityExample.java b/src/main/java/com/moral/monitor/entity/HistoryEntityExample.java
new file mode 100644
index 0000000..42a036e
--- /dev/null
+++ b/src/main/java/com/moral/monitor/entity/HistoryEntityExample.java
@@ -0,0 +1,591 @@
+package com.moral.monitor.entity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class HistoryEntityExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    public HistoryEntityExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Integer value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Integer value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Integer value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Integer value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Integer value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Integer> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Integer> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Integer value1, Integer value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacIsNull() {
+            addCriterion("mac is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacIsNotNull() {
+            addCriterion("mac is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacEqualTo(String value) {
+            addCriterion("mac =", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacNotEqualTo(String value) {
+            addCriterion("mac <>", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacGreaterThan(String value) {
+            addCriterion("mac >", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacGreaterThanOrEqualTo(String value) {
+            addCriterion("mac >=", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacLessThan(String value) {
+            addCriterion("mac <", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacLessThanOrEqualTo(String value) {
+            addCriterion("mac <=", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacLike(String value) {
+            addCriterion("mac like", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacNotLike(String value) {
+            addCriterion("mac not like", value, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacIn(List<String> values) {
+            addCriterion("mac in", values, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacNotIn(List<String> values) {
+            addCriterion("mac not in", values, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacBetween(String value1, String value2) {
+            addCriterion("mac between", value1, value2, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacNotBetween(String value1, String value2) {
+            addCriterion("mac not between", value1, value2, "mac");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorIsNull() {
+            addCriterion("sensor is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorIsNotNull() {
+            addCriterion("sensor is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorEqualTo(String value) {
+            addCriterion("sensor =", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorNotEqualTo(String value) {
+            addCriterion("sensor <>", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorGreaterThan(String value) {
+            addCriterion("sensor >", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorGreaterThanOrEqualTo(String value) {
+            addCriterion("sensor >=", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorLessThan(String value) {
+            addCriterion("sensor <", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorLessThanOrEqualTo(String value) {
+            addCriterion("sensor <=", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorLike(String value) {
+            addCriterion("sensor like", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorNotLike(String value) {
+            addCriterion("sensor not like", value, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorIn(List<String> values) {
+            addCriterion("sensor in", values, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorNotIn(List<String> values) {
+            addCriterion("sensor not in", values, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorBetween(String value1, String value2) {
+            addCriterion("sensor between", value1, value2, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andSensorNotBetween(String value1, String value2) {
+            addCriterion("sensor not between", value1, value2, "sensor");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyIsNull() {
+            addCriterion("mac_key is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyIsNotNull() {
+            addCriterion("mac_key is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyEqualTo(String value) {
+            addCriterion("mac_key =", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyNotEqualTo(String value) {
+            addCriterion("mac_key <>", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyGreaterThan(String value) {
+            addCriterion("mac_key >", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyGreaterThanOrEqualTo(String value) {
+            addCriterion("mac_key >=", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyLessThan(String value) {
+            addCriterion("mac_key <", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyLessThanOrEqualTo(String value) {
+            addCriterion("mac_key <=", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyLike(String value) {
+            addCriterion("mac_key like", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyNotLike(String value) {
+            addCriterion("mac_key not like", value, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyIn(List<String> values) {
+            addCriterion("mac_key in", values, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyNotIn(List<String> values) {
+            addCriterion("mac_key not in", values, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyBetween(String value1, String value2) {
+            addCriterion("mac_key between", value1, value2, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacKeyNotBetween(String value1, String value2) {
+            addCriterion("mac_key not between", value1, value2, "macKey");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueIsNull() {
+            addCriterion("mac_value is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueIsNotNull() {
+            addCriterion("mac_value is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueEqualTo(Double value) {
+            addCriterion("mac_value =", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueNotEqualTo(Double value) {
+            addCriterion("mac_value <>", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueGreaterThan(Double value) {
+            addCriterion("mac_value >", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueGreaterThanOrEqualTo(Double value) {
+            addCriterion("mac_value >=", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueLessThan(Double value) {
+            addCriterion("mac_value <", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueLessThanOrEqualTo(Double value) {
+            addCriterion("mac_value <=", value, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueIn(List<Double> values) {
+            addCriterion("mac_value in", values, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueNotIn(List<Double> values) {
+            addCriterion("mac_value not in", values, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueBetween(Double value1, Double value2) {
+            addCriterion("mac_value between", value1, value2, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andMacValueNotBetween(Double value1, Double value2) {
+            addCriterion("mac_value not between", value1, value2, "macValue");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeIsNull() {
+            addCriterion("time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeIsNotNull() {
+            addCriterion("time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeEqualTo(Date value) {
+            addCriterion("time =", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeNotEqualTo(Date value) {
+            addCriterion("time <>", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeGreaterThan(Date value) {
+            addCriterion("time >", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("time >=", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeLessThan(Date value) {
+            addCriterion("time <", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeLessThanOrEqualTo(Date value) {
+            addCriterion("time <=", value, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeIn(List<Date> values) {
+            addCriterion("time in", values, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeNotIn(List<Date> values) {
+            addCriterion("time not in", values, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeBetween(Date value1, Date value2) {
+            addCriterion("time between", value1, value2, "time");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeNotBetween(Date value1, Date value2) {
+            addCriterion("time not between", value1, value2, "time");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/entity/Organization.java b/src/main/java/com/moral/monitor/entity/Organization.java
new file mode 100644
index 0000000..d9e9bdf
--- /dev/null
+++ b/src/main/java/com/moral/monitor/entity/Organization.java
@@ -0,0 +1,165 @@
+package com.moral.monitor.entity;
+
+import java.util.Date;
+
+public class Organization {
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String type;
+
+    private String rank;
+
+    private Date establishtime;
+
+    private Date updatetime;
+
+    private String establishuser;
+
+    private String updateuser;
+
+    private String pid;
+
+    private String areacode;
+
+    private String address;
+
+    private String telephone;
+
+    private String email;
+
+    private Integer enable;
+
+    private String remark;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getRank() {
+        return rank;
+    }
+
+    public void setRank(String rank) {
+        this.rank = rank;
+    }
+
+    public Date getEstablishtime() {
+        return establishtime;
+    }
+
+    public void setEstablishtime(Date establishtime) {
+        this.establishtime = establishtime;
+    }
+
+    public Date getUpdatetime() {
+        return updatetime;
+    }
+
+    public void setUpdatetime(Date updatetime) {
+        this.updatetime = updatetime;
+    }
+
+    public String getEstablishuser() {
+        return establishuser;
+    }
+
+    public void setEstablishuser(String establishuser) {
+        this.establishuser = establishuser;
+    }
+
+    public String getUpdateuser() {
+        return updateuser;
+    }
+
+    public void setUpdateuser(String updateuser) {
+        this.updateuser = updateuser;
+    }
+
+    public String getPid() {
+        return pid;
+    }
+
+    public void setPid(String pid) {
+        this.pid = pid;
+    }
+
+    public String getAreacode() {
+        return areacode;
+    }
+
+    public void setAreacode(String areacode) {
+        this.areacode = areacode;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Integer getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Integer enable) {
+        this.enable = enable;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/entity/OrganizationExample.java b/src/main/java/com/moral/monitor/entity/OrganizationExample.java
new file mode 100644
index 0000000..52348b9
--- /dev/null
+++ b/src/main/java/com/moral/monitor/entity/OrganizationExample.java
@@ -0,0 +1,1291 @@
+package com.moral.monitor.entity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class OrganizationExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    public OrganizationExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(String value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(String value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(String value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(String value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(String value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(String value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLike(String value) {
+            addCriterion("id like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotLike(String value) {
+            addCriterion("id not like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<String> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<String> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(String value1, String value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(String value1, String value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeIsNull() {
+            addCriterion("code is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeIsNotNull() {
+            addCriterion("code is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeEqualTo(String value) {
+            addCriterion("code =", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeNotEqualTo(String value) {
+            addCriterion("code <>", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeGreaterThan(String value) {
+            addCriterion("code >", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeGreaterThanOrEqualTo(String value) {
+            addCriterion("code >=", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeLessThan(String value) {
+            addCriterion("code <", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeLessThanOrEqualTo(String value) {
+            addCriterion("code <=", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeLike(String value) {
+            addCriterion("code like", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeNotLike(String value) {
+            addCriterion("code not like", value, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeIn(List<String> values) {
+            addCriterion("code in", values, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeNotIn(List<String> values) {
+            addCriterion("code not in", values, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeBetween(String value1, String value2) {
+            addCriterion("code between", value1, value2, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andCodeNotBetween(String value1, String value2) {
+            addCriterion("code not between", value1, value2, "code");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIsNull() {
+            addCriterion("name is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIsNotNull() {
+            addCriterion("name is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameEqualTo(String value) {
+            addCriterion("name =", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotEqualTo(String value) {
+            addCriterion("name <>", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameGreaterThan(String value) {
+            addCriterion("name >", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameGreaterThanOrEqualTo(String value) {
+            addCriterion("name >=", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLessThan(String value) {
+            addCriterion("name <", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLessThanOrEqualTo(String value) {
+            addCriterion("name <=", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameLike(String value) {
+            addCriterion("name like", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotLike(String value) {
+            addCriterion("name not like", value, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameIn(List<String> values) {
+            addCriterion("name in", values, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotIn(List<String> values) {
+            addCriterion("name not in", values, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameBetween(String value1, String value2) {
+            addCriterion("name between", value1, value2, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andNameNotBetween(String value1, String value2) {
+            addCriterion("name not between", value1, value2, "name");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNull() {
+            addCriterion("type is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNotNull() {
+            addCriterion("type is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeEqualTo(String value) {
+            addCriterion("type =", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotEqualTo(String value) {
+            addCriterion("type <>", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThan(String value) {
+            addCriterion("type >", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThanOrEqualTo(String value) {
+            addCriterion("type >=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThan(String value) {
+            addCriterion("type <", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThanOrEqualTo(String value) {
+            addCriterion("type <=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLike(String value) {
+            addCriterion("type like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotLike(String value) {
+            addCriterion("type not like", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIn(List<String> values) {
+            addCriterion("type in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotIn(List<String> values) {
+            addCriterion("type not in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeBetween(String value1, String value2) {
+            addCriterion("type between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotBetween(String value1, String value2) {
+            addCriterion("type not between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankIsNull() {
+            addCriterion("rank is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankIsNotNull() {
+            addCriterion("rank is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankEqualTo(String value) {
+            addCriterion("rank =", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankNotEqualTo(String value) {
+            addCriterion("rank <>", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankGreaterThan(String value) {
+            addCriterion("rank >", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankGreaterThanOrEqualTo(String value) {
+            addCriterion("rank >=", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankLessThan(String value) {
+            addCriterion("rank <", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankLessThanOrEqualTo(String value) {
+            addCriterion("rank <=", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankLike(String value) {
+            addCriterion("rank like", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankNotLike(String value) {
+            addCriterion("rank not like", value, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankIn(List<String> values) {
+            addCriterion("rank in", values, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankNotIn(List<String> values) {
+            addCriterion("rank not in", values, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankBetween(String value1, String value2) {
+            addCriterion("rank between", value1, value2, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andRankNotBetween(String value1, String value2) {
+            addCriterion("rank not between", value1, value2, "rank");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeIsNull() {
+            addCriterion("establishtime is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeIsNotNull() {
+            addCriterion("establishtime is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeEqualTo(Date value) {
+            addCriterion("establishtime =", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeNotEqualTo(Date value) {
+            addCriterion("establishtime <>", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeGreaterThan(Date value) {
+            addCriterion("establishtime >", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("establishtime >=", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeLessThan(Date value) {
+            addCriterion("establishtime <", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeLessThanOrEqualTo(Date value) {
+            addCriterion("establishtime <=", value, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeIn(List<Date> values) {
+            addCriterion("establishtime in", values, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeNotIn(List<Date> values) {
+            addCriterion("establishtime not in", values, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeBetween(Date value1, Date value2) {
+            addCriterion("establishtime between", value1, value2, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishtimeNotBetween(Date value1, Date value2) {
+            addCriterion("establishtime not between", value1, value2, "establishtime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeIsNull() {
+            addCriterion("updatetime is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeIsNotNull() {
+            addCriterion("updatetime is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeEqualTo(Date value) {
+            addCriterion("updatetime =", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeNotEqualTo(Date value) {
+            addCriterion("updatetime <>", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeGreaterThan(Date value) {
+            addCriterion("updatetime >", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("updatetime >=", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeLessThan(Date value) {
+            addCriterion("updatetime <", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeLessThanOrEqualTo(Date value) {
+            addCriterion("updatetime <=", value, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeIn(List<Date> values) {
+            addCriterion("updatetime in", values, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeNotIn(List<Date> values) {
+            addCriterion("updatetime not in", values, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeBetween(Date value1, Date value2) {
+            addCriterion("updatetime between", value1, value2, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdatetimeNotBetween(Date value1, Date value2) {
+            addCriterion("updatetime not between", value1, value2, "updatetime");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserIsNull() {
+            addCriterion("establishuser is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserIsNotNull() {
+            addCriterion("establishuser is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserEqualTo(String value) {
+            addCriterion("establishuser =", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserNotEqualTo(String value) {
+            addCriterion("establishuser <>", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserGreaterThan(String value) {
+            addCriterion("establishuser >", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserGreaterThanOrEqualTo(String value) {
+            addCriterion("establishuser >=", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserLessThan(String value) {
+            addCriterion("establishuser <", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserLessThanOrEqualTo(String value) {
+            addCriterion("establishuser <=", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserLike(String value) {
+            addCriterion("establishuser like", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserNotLike(String value) {
+            addCriterion("establishuser not like", value, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserIn(List<String> values) {
+            addCriterion("establishuser in", values, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserNotIn(List<String> values) {
+            addCriterion("establishuser not in", values, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserBetween(String value1, String value2) {
+            addCriterion("establishuser between", value1, value2, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andEstablishuserNotBetween(String value1, String value2) {
+            addCriterion("establishuser not between", value1, value2, "establishuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserIsNull() {
+            addCriterion("updateuser is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserIsNotNull() {
+            addCriterion("updateuser is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserEqualTo(String value) {
+            addCriterion("updateuser =", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserNotEqualTo(String value) {
+            addCriterion("updateuser <>", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserGreaterThan(String value) {
+            addCriterion("updateuser >", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserGreaterThanOrEqualTo(String value) {
+            addCriterion("updateuser >=", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserLessThan(String value) {
+            addCriterion("updateuser <", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserLessThanOrEqualTo(String value) {
+            addCriterion("updateuser <=", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserLike(String value) {
+            addCriterion("updateuser like", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserNotLike(String value) {
+            addCriterion("updateuser not like", value, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserIn(List<String> values) {
+            addCriterion("updateuser in", values, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserNotIn(List<String> values) {
+            addCriterion("updateuser not in", values, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserBetween(String value1, String value2) {
+            addCriterion("updateuser between", value1, value2, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateuserNotBetween(String value1, String value2) {
+            addCriterion("updateuser not between", value1, value2, "updateuser");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidIsNull() {
+            addCriterion("pid is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidIsNotNull() {
+            addCriterion("pid is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidEqualTo(String value) {
+            addCriterion("pid =", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidNotEqualTo(String value) {
+            addCriterion("pid <>", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidGreaterThan(String value) {
+            addCriterion("pid >", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidGreaterThanOrEqualTo(String value) {
+            addCriterion("pid >=", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidLessThan(String value) {
+            addCriterion("pid <", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidLessThanOrEqualTo(String value) {
+            addCriterion("pid <=", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidLike(String value) {
+            addCriterion("pid like", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidNotLike(String value) {
+            addCriterion("pid not like", value, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidIn(List<String> values) {
+            addCriterion("pid in", values, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidNotIn(List<String> values) {
+            addCriterion("pid not in", values, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidBetween(String value1, String value2) {
+            addCriterion("pid between", value1, value2, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andPidNotBetween(String value1, String value2) {
+            addCriterion("pid not between", value1, value2, "pid");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeIsNull() {
+            addCriterion("areacode is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeIsNotNull() {
+            addCriterion("areacode is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeEqualTo(String value) {
+            addCriterion("areacode =", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeNotEqualTo(String value) {
+            addCriterion("areacode <>", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeGreaterThan(String value) {
+            addCriterion("areacode >", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeGreaterThanOrEqualTo(String value) {
+            addCriterion("areacode >=", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeLessThan(String value) {
+            addCriterion("areacode <", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeLessThanOrEqualTo(String value) {
+            addCriterion("areacode <=", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeLike(String value) {
+            addCriterion("areacode like", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeNotLike(String value) {
+            addCriterion("areacode not like", value, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeIn(List<String> values) {
+            addCriterion("areacode in", values, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeNotIn(List<String> values) {
+            addCriterion("areacode not in", values, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeBetween(String value1, String value2) {
+            addCriterion("areacode between", value1, value2, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAreacodeNotBetween(String value1, String value2) {
+            addCriterion("areacode not between", value1, value2, "areacode");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressIsNull() {
+            addCriterion("address is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressIsNotNull() {
+            addCriterion("address is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressEqualTo(String value) {
+            addCriterion("address =", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressNotEqualTo(String value) {
+            addCriterion("address <>", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressGreaterThan(String value) {
+            addCriterion("address >", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressGreaterThanOrEqualTo(String value) {
+            addCriterion("address >=", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressLessThan(String value) {
+            addCriterion("address <", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressLessThanOrEqualTo(String value) {
+            addCriterion("address <=", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressLike(String value) {
+            addCriterion("address like", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressNotLike(String value) {
+            addCriterion("address not like", value, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressIn(List<String> values) {
+            addCriterion("address in", values, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressNotIn(List<String> values) {
+            addCriterion("address not in", values, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressBetween(String value1, String value2) {
+            addCriterion("address between", value1, value2, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddressNotBetween(String value1, String value2) {
+            addCriterion("address not between", value1, value2, "address");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneIsNull() {
+            addCriterion("telephone is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneIsNotNull() {
+            addCriterion("telephone is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneEqualTo(String value) {
+            addCriterion("telephone =", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneNotEqualTo(String value) {
+            addCriterion("telephone <>", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneGreaterThan(String value) {
+            addCriterion("telephone >", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneGreaterThanOrEqualTo(String value) {
+            addCriterion("telephone >=", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneLessThan(String value) {
+            addCriterion("telephone <", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneLessThanOrEqualTo(String value) {
+            addCriterion("telephone <=", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneLike(String value) {
+            addCriterion("telephone like", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneNotLike(String value) {
+            addCriterion("telephone not like", value, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneIn(List<String> values) {
+            addCriterion("telephone in", values, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneNotIn(List<String> values) {
+            addCriterion("telephone not in", values, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneBetween(String value1, String value2) {
+            addCriterion("telephone between", value1, value2, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andTelephoneNotBetween(String value1, String value2) {
+            addCriterion("telephone not between", value1, value2, "telephone");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIsNull() {
+            addCriterion("email is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIsNotNull() {
+            addCriterion("email is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailEqualTo(String value) {
+            addCriterion("email =", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotEqualTo(String value) {
+            addCriterion("email <>", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailGreaterThan(String value) {
+            addCriterion("email >", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailGreaterThanOrEqualTo(String value) {
+            addCriterion("email >=", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLessThan(String value) {
+            addCriterion("email <", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLessThanOrEqualTo(String value) {
+            addCriterion("email <=", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailLike(String value) {
+            addCriterion("email like", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotLike(String value) {
+            addCriterion("email not like", value, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailIn(List<String> values) {
+            addCriterion("email in", values, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotIn(List<String> values) {
+            addCriterion("email not in", values, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailBetween(String value1, String value2) {
+            addCriterion("email between", value1, value2, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEmailNotBetween(String value1, String value2) {
+            addCriterion("email not between", value1, value2, "email");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIsNull() {
+            addCriterion("enable is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIsNotNull() {
+            addCriterion("enable is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableEqualTo(Integer value) {
+            addCriterion("enable =", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotEqualTo(Integer value) {
+            addCriterion("enable <>", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableGreaterThan(Integer value) {
+            addCriterion("enable >", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableGreaterThanOrEqualTo(Integer value) {
+            addCriterion("enable >=", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableLessThan(Integer value) {
+            addCriterion("enable <", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableLessThanOrEqualTo(Integer value) {
+            addCriterion("enable <=", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIn(List<Integer> values) {
+            addCriterion("enable in", values, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotIn(List<Integer> values) {
+            addCriterion("enable not in", values, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableBetween(Integer value1, Integer value2) {
+            addCriterion("enable between", value1, value2, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotBetween(Integer value1, Integer value2) {
+            addCriterion("enable not between", value1, value2, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIsNull() {
+            addCriterion("remark is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIsNotNull() {
+            addCriterion("remark is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkEqualTo(String value) {
+            addCriterion("remark =", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotEqualTo(String value) {
+            addCriterion("remark <>", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkGreaterThan(String value) {
+            addCriterion("remark >", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkGreaterThanOrEqualTo(String value) {
+            addCriterion("remark >=", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLessThan(String value) {
+            addCriterion("remark <", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLessThanOrEqualTo(String value) {
+            addCriterion("remark <=", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkLike(String value) {
+            addCriterion("remark like", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotLike(String value) {
+            addCriterion("remark not like", value, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkIn(List<String> values) {
+            addCriterion("remark in", values, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotIn(List<String> values) {
+            addCriterion("remark not in", values, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkBetween(String value1, String value2) {
+            addCriterion("remark between", value1, value2, "remark");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemarkNotBetween(String value1, String value2) {
+            addCriterion("remark not between", value1, value2, "remark");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/moral/monitor/service/OrganizationService.java b/src/main/java/com/moral/monitor/service/OrganizationService.java
new file mode 100644
index 0000000..a4caeae
--- /dev/null
+++ b/src/main/java/com/moral/monitor/service/OrganizationService.java
@@ -0,0 +1,9 @@
+package com.moral.monitor.service;
+
+import java.util.Set;
+
+public interface OrganizationService {
+
+	Set<String> getChildOrganizationIds(String orgId);
+
+}
diff --git a/src/main/java/com/moral/monitor/service/ScreenService.java b/src/main/java/com/moral/monitor/service/ScreenService.java
index 7e217b7..7265a13 100644
--- a/src/main/java/com/moral/monitor/service/ScreenService.java
+++ b/src/main/java/com/moral/monitor/service/ScreenService.java
@@ -1,6 +1,7 @@
 package com.moral.monitor.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.moral.monitor.entity.AccountEntity;
 
@@ -8,4 +9,8 @@
 
 	List<AccountEntity> getAccountLists(String account, String password);
 
+	Map<String, Object> getDataByEquipmentMac(Map<String, Object> parameters);
+
+	Map<String, Object> getAverageByAll(Map<String, Object> parameters);
+
 }
diff --git a/src/main/java/com/moral/monitor/service/impl/OrganizationServiceImpl.java b/src/main/java/com/moral/monitor/service/impl/OrganizationServiceImpl.java
new file mode 100644
index 0000000..54b11f6
--- /dev/null
+++ b/src/main/java/com/moral/monitor/service/impl/OrganizationServiceImpl.java
@@ -0,0 +1,36 @@
+package com.moral.monitor.service.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.moral.monitor.dao.OrganizationMapper;
+import com.moral.monitor.entity.Organization;
+import com.moral.monitor.entity.OrganizationExample;
+import com.moral.monitor.entity.OrganizationExample.Criteria;
+import com.moral.monitor.service.OrganizationService;
+
+@Service
+public class OrganizationServiceImpl implements OrganizationService {
+	
+    @Autowired
+    private OrganizationMapper organizationDao;
+
+    public Set<String> getChildOrganizationIds(String orgId){
+    	Set<String> orgIds = new HashSet<String>();
+    	orgIds.add(orgId);
+    	OrganizationExample example = new OrganizationExample();
+    	Criteria criteria = example.createCriteria();
+    	criteria.andPidEqualTo(orgId).andEnableEqualTo(1);
+    	List<Organization> organizations = organizationDao.selectByExample(example);
+    	for (Organization organization : organizations) {
+    		Set<String> organizationIds = getChildOrganizationIds(organization.getId());
+    		orgIds.addAll(organizationIds);
+		}
+    	return orgIds;
+    }
+
+}
diff --git a/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java b/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java
index 080d5ba..db35e29 100644
--- a/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java
+++ b/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java
@@ -1,25 +1,108 @@
 package com.moral.monitor.service.impl;
 
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.moral.monitor.dao.AccountEntityMapper;
+import com.moral.monitor.dao.HistoryEntityMapper;
 import com.moral.monitor.entity.AccountEntity;
 import com.moral.monitor.entity.AccountEntityExample;
+import com.moral.monitor.service.OrganizationService;
 import com.moral.monitor.service.ScreenService;
 
 @Service
 public class ScreenServiceImpl implements ScreenService {
 
 	@Autowired
-	private AccountEntityMapper accountDao;
+	private AccountEntityMapper accountMapper;
+
+	@Autowired
+	private HistoryEntityMapper historyMapper;
+
+	@Autowired
+	private OrganizationService organizationService;
 
 	public List<AccountEntity> getAccountLists(String account, String password) {
 		AccountEntityExample example = new AccountEntityExample();
 		example.or().andAccountEqualTo(account).andPasswordEqualTo(password);
-		return accountDao.selectByExample(example);
+		return accountMapper.selectByExample(example);
+	}
+
+	@SuppressWarnings("deprecation")
+	public Map<String, Object> getDataByEquipmentMac(Map<String, Object> parameters) {
+		Map<String, Object> resultMap = new HashMap<String, Object>();
+		Date date = new Date();
+
+		/** ������������ ������������������������ **/
+		date.setMonth(6);
+		int day = date.getDate();
+		if (day < 13) {
+			day = 31 - day;
+		}else if (day < 19) {
+			day += 10;
+		}else if (day > 29) {
+			day -= 10;
+		}
+		date.setDate(day);
+		/** ������������ ������ **/
+
+		parameters.put("end", DateUtils.truncate(date, Calendar.DATE));
+		
+		//���������������������������������������
+		/*if (1 == Calendar.getInstance().get(Calendar.DAY_OF_MONTH)) {
+			date = DateUtils.setMonths(date, -1);
+			parameters.put("end", DateUtils.ceiling(date, Calendar.MONTH));
+		}*/
+		parameters.put("start", DateUtils.truncate(date, Calendar.MONTH));
+		parameters.put("mac", "898602b8191630065884");
+		parameters.put("macKey", "e1");
+		Map<String, Object> monthAverageBySensor = historyMapper.getMonthAverageBySensor(parameters);
+		if (MapUtils.isNotEmpty(monthAverageBySensor)) {
+			resultMap.putAll(monthAverageBySensor);
+		} else {
+			resultMap.put("monthAverage", 0);
+		}
+		return resultMap;
+	}
+
+	@SuppressWarnings("deprecation")
+	public Map<String, Object> getAverageByAll(Map<String, Object> parameters) {
+
+		AccountEntity account = accountMapper.selectByPrimaryKey((Integer.valueOf((String) parameters.get("accountId"))));
+		String organization = account.getOrganization();
+		//���������������������������������������������������������������
+		if (!("-1".equals(organization) || "5212b9dfb55448e699889e01fa0fa6a2".equals(organization))) {
+			Set<String> orgIds = organizationService.getChildOrganizationIds(account.getOrganization());
+			parameters.put("orgIds", orgIds);
+		}
+		Date date = new Date();
+		
+		/** ������������ ������������������������ **/
+		date.setMonth(6);
+		int day = date.getDate();
+		if (day < 19 || day > 29) {
+			day = (int) Math.floor(Math.random() * (29 - 19 + 1) + 19);
+			date.setDate(day);
+		}
+		/** ������������ ������ **/
+
+		parameters.put("start", DateUtils.addMinutes(date, -10));
+		parameters.put("end", DateUtils.addMinutes(date, -5));
+		List<Map<String, Object>> averageByAll = historyMapper.getAverageByAll(parameters);
+		Map<String, Object> result = new HashMap<String, Object>();
+		for (Map<String, Object> map : averageByAll) {
+			result.put((String) map.get("mac_key"), map.get("avg"));
+		}
+		return result;
 	}
 
 }
diff --git a/src/main/resources/mapper/HistoryEntityMapper.xml b/src/main/resources/mapper/HistoryEntityMapper.xml
new file mode 100644
index 0000000..5df5dd4
--- /dev/null
+++ b/src/main/resources/mapper/HistoryEntityMapper.xml
@@ -0,0 +1,291 @@
+<?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.HistoryEntityMapper" >
+  <resultMap id="BaseResultMap" type="com.moral.monitor.entity.HistoryEntity" >
+    <id column="id" property="id" jdbcType="INTEGER" />
+    <result column="mac" property="mac" jdbcType="VARCHAR" />
+    <result column="sensor" property="sensor" jdbcType="VARCHAR" />
+    <result column="mac_key" property="macKey" jdbcType="VARCHAR" />
+    <result column="mac_value" property="macValue" jdbcType="DOUBLE" />
+    <result column="time" property="time" jdbcType="TIMESTAMP" />
+  </resultMap>
+  <sql id="Example_Where_Clause" >
+    <where >
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
+        <if test="criteria.valid" >
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List" >
+    id, mac, sensor, mac_key, mac_value, time
+  </sql>
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.monitor.entity.HistoryEntityExample" >
+    select
+    <if test="distinct" >
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from history
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null" >
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    from history
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    delete from history
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.moral.monitor.entity.HistoryEntityExample" >
+    delete from history
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.moral.monitor.entity.HistoryEntity" >
+    insert into history (id, mac, sensor, 
+      mac_key, mac_value, time
+      )
+    values (#{id,jdbcType=INTEGER}, #{mac,jdbcType=VARCHAR}, #{sensor,jdbcType=VARCHAR}, 
+      #{macKey,jdbcType=VARCHAR}, #{macValue,jdbcType=DOUBLE}, #{time,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.moral.monitor.entity.HistoryEntity" >
+    insert into history
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="mac != null" >
+        mac,
+      </if>
+      <if test="sensor != null" >
+        sensor,
+      </if>
+      <if test="macKey != null" >
+        mac_key,
+      </if>
+      <if test="macValue != null" >
+        mac_value,
+      </if>
+      <if test="time != null" >
+        time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="mac != null" >
+        #{mac,jdbcType=VARCHAR},
+      </if>
+      <if test="sensor != null" >
+        #{sensor,jdbcType=VARCHAR},
+      </if>
+      <if test="macKey != null" >
+        #{macKey,jdbcType=VARCHAR},
+      </if>
+      <if test="macValue != null" >
+        #{macValue,jdbcType=DOUBLE},
+      </if>
+      <if test="time != null" >
+        #{time,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.moral.monitor.entity.HistoryEntityExample" resultType="java.lang.Integer" >
+    select count(*) from history
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map" >
+    update history
+    <set >
+      <if test="record.id != null" >
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.mac != null" >
+        mac = #{record.mac,jdbcType=VARCHAR},
+      </if>
+      <if test="record.sensor != null" >
+        sensor = #{record.sensor,jdbcType=VARCHAR},
+      </if>
+      <if test="record.macKey != null" >
+        mac_key = #{record.macKey,jdbcType=VARCHAR},
+      </if>
+      <if test="record.macValue != null" >
+        mac_value = #{record.macValue,jdbcType=DOUBLE},
+      </if>
+      <if test="record.time != null" >
+        time = #{record.time,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map" >
+    update history
+    set id = #{record.id,jdbcType=INTEGER},
+      mac = #{record.mac,jdbcType=VARCHAR},
+      sensor = #{record.sensor,jdbcType=VARCHAR},
+      mac_key = #{record.macKey,jdbcType=VARCHAR},
+      mac_value = #{record.macValue,jdbcType=DOUBLE},
+      time = #{record.time,jdbcType=TIMESTAMP}
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.moral.monitor.entity.HistoryEntity" >
+    update history
+    <set >
+      <if test="mac != null" >
+        mac = #{mac,jdbcType=VARCHAR},
+      </if>
+      <if test="sensor != null" >
+        sensor = #{sensor,jdbcType=VARCHAR},
+      </if>
+      <if test="macKey != null" >
+        mac_key = #{macKey,jdbcType=VARCHAR},
+      </if>
+      <if test="macValue != null" >
+        mac_value = #{macValue,jdbcType=DOUBLE},
+      </if>
+      <if test="time != null" >
+        time = #{time,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.moral.monitor.entity.HistoryEntity" >
+    update history
+    set mac = #{mac,jdbcType=VARCHAR},
+      sensor = #{sensor,jdbcType=VARCHAR},
+      mac_key = #{macKey,jdbcType=VARCHAR},
+      mac_value = #{macValue,jdbcType=DOUBLE},
+      time = #{time,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <select id="getMonthAverageBySensor" resultType="map">
+		SELECT
+			AVG(mac_value) monthAverage
+		FROM
+			history
+		WHERE
+			mac = #{mac}
+		AND mac_key = #{macKey}
+		AND time &gt; #{start}
+		AND time &lt; #{end}
+  </select>
+
+	<select id="getAverageByAll" resultType="map">
+<!-- 
+		SELECT
+			h.mac_key,
+			AVG(h.mac_value) avg
+		FROM
+			history h,
+			monitorpoint m,
+			equipment e
+		<if test="orgIds != null and orgIds.size > 0">
+			JOIN org_equ oe ON e.id = oe.equid
+			AND oe.orgid IN
+			<foreach collection="orgIds" item="listItem" open="(" separator="," close=")" >
+				#{listItem}
+			</foreach>
+		</if>
+		WHERE
+			m.areacode = #{areaCode}
+		AND m.id = e.monitorpoint
+		AND e.mac = h.mac
+		AND h.time &gt; #{start}
+		AND h.time &lt; #{end}
+		GROUP BY
+			h.mac_key
+ -->
+
+		SELECT
+			mac_key,
+			AVG(mac_value) avg
+		FROM
+			history h
+			<if test="orgIds!=null and orgIds.size > 0">
+				JOIN (
+					SELECT
+						e.mac
+					FROM
+						equipment e,
+						org_equ oe
+					WHERE
+						e.id = oe.equid
+					AND oe.orgid IN
+					<foreach collection="orgIds" item="listItem" open="(" separator="," close=")" >
+						#{listItem}
+					</foreach>
+				) e ON h.mac = e.mac
+			</if>
+			WHERE h.time &gt; #{start}
+			AND h.time &lt; #{end}
+		GROUP BY
+			mac_key
+	</select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/OrganizationMapper.xml b/src/main/resources/mapper/OrganizationMapper.xml
new file mode 100644
index 0000000..f4a657d
--- /dev/null
+++ b/src/main/resources/mapper/OrganizationMapper.xml
@@ -0,0 +1,385 @@
+<?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.OrganizationMapper" >
+  <resultMap id="BaseResultMap" type="com.moral.monitor.entity.Organization" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="code" property="code" jdbcType="VARCHAR" />
+    <result column="name" property="name" jdbcType="VARCHAR" />
+    <result column="type" property="type" jdbcType="VARCHAR" />
+    <result column="rank" property="rank" jdbcType="VARCHAR" />
+    <result column="establishtime" property="establishtime" jdbcType="TIMESTAMP" />
+    <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+    <result column="establishuser" property="establishuser" jdbcType="VARCHAR" />
+    <result column="updateuser" property="updateuser" jdbcType="VARCHAR" />
+    <result column="pid" property="pid" jdbcType="VARCHAR" />
+    <result column="areacode" property="areacode" jdbcType="VARCHAR" />
+    <result column="address" property="address" jdbcType="VARCHAR" />
+    <result column="telephone" property="telephone" jdbcType="VARCHAR" />
+    <result column="email" property="email" jdbcType="VARCHAR" />
+    <result column="enable" property="enable" jdbcType="INTEGER" />
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Example_Where_Clause" >
+    <where >
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
+        <if test="criteria.valid" >
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
+            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List" >
+    id, code, name, type, rank, establishtime, updatetime, establishuser, updateuser, 
+    pid, areacode, address, telephone, email, enable, remark
+  </sql>
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.monitor.entity.OrganizationExample" >
+    select
+    <if test="distinct" >
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from organization
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null" >
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from organization
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from organization
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.moral.monitor.entity.OrganizationExample" >
+    delete from organization
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.moral.monitor.entity.Organization" >
+    insert into organization (id, code, name, 
+      type, rank, establishtime, 
+      updatetime, establishuser, updateuser, 
+      pid, areacode, address, 
+      telephone, email, enable, 
+      remark)
+    values (#{id,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
+      #{type,jdbcType=VARCHAR}, #{rank,jdbcType=VARCHAR}, #{establishtime,jdbcType=TIMESTAMP}, 
+      #{updatetime,jdbcType=TIMESTAMP}, #{establishuser,jdbcType=VARCHAR}, #{updateuser,jdbcType=VARCHAR}, 
+      #{pid,jdbcType=VARCHAR}, #{areacode,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, 
+      #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{enable,jdbcType=INTEGER}, 
+      #{remark,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.moral.monitor.entity.Organization" >
+    insert into organization
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="code != null" >
+        code,
+      </if>
+      <if test="name != null" >
+        name,
+      </if>
+      <if test="type != null" >
+        type,
+      </if>
+      <if test="rank != null" >
+        rank,
+      </if>
+      <if test="establishtime != null" >
+        establishtime,
+      </if>
+      <if test="updatetime != null" >
+        updatetime,
+      </if>
+      <if test="establishuser != null" >
+        establishuser,
+      </if>
+      <if test="updateuser != null" >
+        updateuser,
+      </if>
+      <if test="pid != null" >
+        pid,
+      </if>
+      <if test="areacode != null" >
+        areacode,
+      </if>
+      <if test="address != null" >
+        address,
+      </if>
+      <if test="telephone != null" >
+        telephone,
+      </if>
+      <if test="email != null" >
+        email,
+      </if>
+      <if test="enable != null" >
+        enable,
+      </if>
+      <if test="remark != null" >
+        remark,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="code != null" >
+        #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null" >
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null" >
+        #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="rank != null" >
+        #{rank,jdbcType=VARCHAR},
+      </if>
+      <if test="establishtime != null" >
+        #{establishtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updatetime != null" >
+        #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="establishuser != null" >
+        #{establishuser,jdbcType=VARCHAR},
+      </if>
+      <if test="updateuser != null" >
+        #{updateuser,jdbcType=VARCHAR},
+      </if>
+      <if test="pid != null" >
+        #{pid,jdbcType=VARCHAR},
+      </if>
+      <if test="areacode != null" >
+        #{areacode,jdbcType=VARCHAR},
+      </if>
+      <if test="address != null" >
+        #{address,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null" >
+        #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null" >
+        #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="enable != null" >
+        #{enable,jdbcType=INTEGER},
+      </if>
+      <if test="remark != null" >
+        #{remark,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.moral.monitor.entity.OrganizationExample" resultType="java.lang.Integer" >
+    select count(*) from organization
+    <if test="_parameter != null" >
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map" >
+    update organization
+    <set >
+      <if test="record.id != null" >
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.code != null" >
+        code = #{record.code,jdbcType=VARCHAR},
+      </if>
+      <if test="record.name != null" >
+        name = #{record.name,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null" >
+        type = #{record.type,jdbcType=VARCHAR},
+      </if>
+      <if test="record.rank != null" >
+        rank = #{record.rank,jdbcType=VARCHAR},
+      </if>
+      <if test="record.establishtime != null" >
+        establishtime = #{record.establishtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updatetime != null" >
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.establishuser != null" >
+        establishuser = #{record.establishuser,jdbcType=VARCHAR},
+      </if>
+      <if test="record.updateuser != null" >
+        updateuser = #{record.updateuser,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pid != null" >
+        pid = #{record.pid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.areacode != null" >
+        areacode = #{record.areacode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.address != null" >
+        address = #{record.address,jdbcType=VARCHAR},
+      </if>
+      <if test="record.telephone != null" >
+        telephone = #{record.telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="record.email != null" >
+        email = #{record.email,jdbcType=VARCHAR},
+      </if>
+      <if test="record.enable != null" >
+        enable = #{record.enable,jdbcType=INTEGER},
+      </if>
+      <if test="record.remark != null" >
+        remark = #{record.remark,jdbcType=VARCHAR},
+      </if>
+    </set>
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map" >
+    update organization
+    set id = #{record.id,jdbcType=VARCHAR},
+      code = #{record.code,jdbcType=VARCHAR},
+      name = #{record.name,jdbcType=VARCHAR},
+      type = #{record.type,jdbcType=VARCHAR},
+      rank = #{record.rank,jdbcType=VARCHAR},
+      establishtime = #{record.establishtime,jdbcType=TIMESTAMP},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      establishuser = #{record.establishuser,jdbcType=VARCHAR},
+      updateuser = #{record.updateuser,jdbcType=VARCHAR},
+      pid = #{record.pid,jdbcType=VARCHAR},
+      areacode = #{record.areacode,jdbcType=VARCHAR},
+      address = #{record.address,jdbcType=VARCHAR},
+      telephone = #{record.telephone,jdbcType=VARCHAR},
+      email = #{record.email,jdbcType=VARCHAR},
+      enable = #{record.enable,jdbcType=INTEGER},
+      remark = #{record.remark,jdbcType=VARCHAR}
+    <if test="_parameter != null" >
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.moral.monitor.entity.Organization" >
+    update organization
+    <set >
+      <if test="code != null" >
+        code = #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null" >
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null" >
+        type = #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="rank != null" >
+        rank = #{rank,jdbcType=VARCHAR},
+      </if>
+      <if test="establishtime != null" >
+        establishtime = #{establishtime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updatetime != null" >
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="establishuser != null" >
+        establishuser = #{establishuser,jdbcType=VARCHAR},
+      </if>
+      <if test="updateuser != null" >
+        updateuser = #{updateuser,jdbcType=VARCHAR},
+      </if>
+      <if test="pid != null" >
+        pid = #{pid,jdbcType=VARCHAR},
+      </if>
+      <if test="areacode != null" >
+        areacode = #{areacode,jdbcType=VARCHAR},
+      </if>
+      <if test="address != null" >
+        address = #{address,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null" >
+        telephone = #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="email != null" >
+        email = #{email,jdbcType=VARCHAR},
+      </if>
+      <if test="enable != null" >
+        enable = #{enable,jdbcType=INTEGER},
+      </if>
+      <if test="remark != null" >
+        remark = #{remark,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.moral.monitor.entity.Organization" >
+    update organization
+    set code = #{code,jdbcType=VARCHAR},
+      name = #{name,jdbcType=VARCHAR},
+      type = #{type,jdbcType=VARCHAR},
+      rank = #{rank,jdbcType=VARCHAR},
+      establishtime = #{establishtime,jdbcType=TIMESTAMP},
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      establishuser = #{establishuser,jdbcType=VARCHAR},
+      updateuser = #{updateuser,jdbcType=VARCHAR},
+      pid = #{pid,jdbcType=VARCHAR},
+      areacode = #{areacode,jdbcType=VARCHAR},
+      address = #{address,jdbcType=VARCHAR},
+      telephone = #{telephone,jdbcType=VARCHAR},
+      email = #{email,jdbcType=VARCHAR},
+      enable = #{enable,jdbcType=INTEGER},
+      remark = #{remark,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0