Prechádzať zdrojové kódy

云模盒硬件历史数据

quyueting 5 rokov pred
rodič
commit
86c20f936d

+ 1 - 1
cloud-socket/src/com/js/kbt/UserTempGenConfig.xml

@@ -11,7 +11,7 @@
     <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="cloud-socket" />
     <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" />
     <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" type="XMLMAPPER" />
-    <table schema="cloud_model" tableName="tb_user" >
+    <table schema="cloud_model" tableName="mould_history_time" >
     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
     </table>
 <!--     <table schema="cloud_model" tableName="tb_mould_equipment" > -->

+ 7 - 7
cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.java

@@ -9,44 +9,44 @@ public interface MouldHistoryTimeMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	long countByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int deleteByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int insert(MouldHistoryTime record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int insertSelective(MouldHistoryTime record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	List<MouldHistoryTime> selectByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int updateByExampleSelective(@Param("record") MouldHistoryTime record,
 			@Param("example") MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int updateByExample(@Param("record") MouldHistoryTime record, @Param("example") MouldHistoryTimeExample example);
 }

+ 28 - 15
cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.xml

@@ -5,19 +5,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <result column="history_id" jdbcType="BIGINT" property="historyId" />
     <result column="seq" jdbcType="INTEGER" property="seq" />
     <result column="close_time" jdbcType="TIMESTAMP" property="closeTime" />
     <result column="open_time" jdbcType="TIMESTAMP" property="openTime" />
     <result column="time_cost" jdbcType="INTEGER" property="timeCost" />
+    <result column="equipment_no" jdbcType="VARCHAR" property="equipmentNo" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -51,7 +52,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -85,15 +86,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
-    history_id, seq, close_time, open_time, time_cost
+    history_id, seq, close_time, open_time, time_cost, equipment_no
   </sql>
   <select id="selectByExample" parameterType="com.js.kbt.model.MouldHistoryTimeExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     select
     <if test="distinct">
@@ -112,7 +113,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     delete from mould_history_time
     <if test="_parameter != null">
@@ -123,18 +124,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     insert into mould_history_time (history_id, seq, close_time, 
-      open_time, time_cost)
+      open_time, time_cost, equipment_no
+      )
     values (#{historyId,jdbcType=BIGINT}, #{seq,jdbcType=INTEGER}, #{closeTime,jdbcType=TIMESTAMP}, 
-      #{openTime,jdbcType=TIMESTAMP}, #{timeCost,jdbcType=INTEGER})
+      #{openTime,jdbcType=TIMESTAMP}, #{timeCost,jdbcType=INTEGER}, #{equipmentNo,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.js.kbt.model.MouldHistoryTime">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     insert into mould_history_time
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -153,6 +156,9 @@
       <if test="timeCost != null">
         time_cost,
       </if>
+      <if test="equipmentNo != null">
+        equipment_no,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="historyId != null">
@@ -170,13 +176,16 @@
       <if test="timeCost != null">
         #{timeCost,jdbcType=INTEGER},
       </if>
+      <if test="equipmentNo != null">
+        #{equipmentNo,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.js.kbt.model.MouldHistoryTimeExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     select count(*) from mould_history_time
     <if test="_parameter != null">
@@ -187,7 +196,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     update mould_history_time
     <set>
@@ -206,6 +215,9 @@
       <if test="record.timeCost != null">
         time_cost = #{record.timeCost,jdbcType=INTEGER},
       </if>
+      <if test="record.equipmentNo != null">
+        equipment_no = #{record.equipmentNo,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -215,14 +227,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     update mould_history_time
     set history_id = #{record.historyId,jdbcType=BIGINT},
       seq = #{record.seq,jdbcType=INTEGER},
       close_time = #{record.closeTime,jdbcType=TIMESTAMP},
       open_time = #{record.openTime,jdbcType=TIMESTAMP},
-      time_cost = #{record.timeCost,jdbcType=INTEGER}
+      time_cost = #{record.timeCost,jdbcType=INTEGER},
+      equipment_no = #{record.equipmentNo,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>

+ 38 - 15
cloud-socket/src/com/js/kbt/model/MouldHistoryTime.java

@@ -6,34 +6,39 @@ public class MouldHistoryTime {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Long historyId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Integer seq;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Date closeTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Date openTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Integer timeCost;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	private String equipmentNo;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.history_id
 	 * @return  the value of mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Long getHistoryId() {
 		return historyId;
@@ -42,7 +47,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.history_id
 	 * @param historyId  the value for mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setHistoryId(Long historyId) {
 		this.historyId = historyId;
@@ -51,7 +56,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.seq
 	 * @return  the value of mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Integer getSeq() {
 		return seq;
@@ -60,7 +65,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.seq
 	 * @param seq  the value for mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setSeq(Integer seq) {
 		this.seq = seq;
@@ -69,7 +74,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.close_time
 	 * @return  the value of mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Date getCloseTime() {
 		return closeTime;
@@ -78,7 +83,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.close_time
 	 * @param closeTime  the value for mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setCloseTime(Date closeTime) {
 		this.closeTime = closeTime;
@@ -87,7 +92,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.open_time
 	 * @return  the value of mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Date getOpenTime() {
 		return openTime;
@@ -96,7 +101,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.open_time
 	 * @param openTime  the value for mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setOpenTime(Date openTime) {
 		this.openTime = openTime;
@@ -105,7 +110,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.time_cost
 	 * @return  the value of mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Integer getTimeCost() {
 		return timeCost;
@@ -114,9 +119,27 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.time_cost
 	 * @param timeCost  the value for mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setTimeCost(Integer timeCost) {
 		this.timeCost = timeCost;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.equipment_no
+	 * @return  the value of mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	public String getEquipmentNo() {
+		return equipmentNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.equipment_no
+	 * @param equipmentNo  the value for mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	public void setEquipmentNo(String equipmentNo) {
+		this.equipmentNo = equipmentNo;
+	}
 }

+ 86 - 16
cloud-socket/src/com/js/kbt/model/MouldHistoryTimeExample.java

@@ -7,23 +7,23 @@ import java.util.List;
 public class MouldHistoryTimeExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public MouldHistoryTimeExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -31,7 +31,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -39,7 +39,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -47,7 +47,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -55,7 +55,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -63,7 +63,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -71,7 +71,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -79,7 +79,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -89,7 +89,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -101,7 +101,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -110,7 +110,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -120,7 +120,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -462,11 +462,81 @@ public class MouldHistoryTimeExample {
 			addCriterion("time_cost not between", value1, value2, "timeCost");
 			return (Criteria) this;
 		}
+
+		public Criteria andEquipmentNoIsNull() {
+			addCriterion("equipment_no is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoIsNotNull() {
+			addCriterion("equipment_no is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoEqualTo(String value) {
+			addCriterion("equipment_no =", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotEqualTo(String value) {
+			addCriterion("equipment_no <>", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoGreaterThan(String value) {
+			addCriterion("equipment_no >", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoGreaterThanOrEqualTo(String value) {
+			addCriterion("equipment_no >=", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLessThan(String value) {
+			addCriterion("equipment_no <", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLessThanOrEqualTo(String value) {
+			addCriterion("equipment_no <=", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLike(String value) {
+			addCriterion("equipment_no like", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotLike(String value) {
+			addCriterion("equipment_no not like", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoIn(List<String> values) {
+			addCriterion("equipment_no in", values, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotIn(List<String> values) {
+			addCriterion("equipment_no not in", values, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoBetween(String value1, String value2) {
+			addCriterion("equipment_no between", value1, value2, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotBetween(String value1, String value2) {
+			addCriterion("equipment_no not between", value1, value2, "equipmentNo");
+			return (Criteria) this;
+		}
 	}
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public static class Criterion {
 		private String condition;

+ 42 - 12
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -62,6 +62,10 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
     private String processMsg(String input) {
     	String ret = "FA AF 00 07 02 1e 78 1e 50 00 3C";
     	logger.info("=====接收到======"+input);
+    	if (!input.startsWith("FAAF")) {
+    		logger.info("非云模盒消息,不处理");
+    		return ret;
+    	}
     	MouldHistory item = new MouldHistory();
     	
     	//抽取手机号码
@@ -73,7 +77,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
     	//获取设备编码15-24
     	String deviceNumPart = input.substring(15*2, 25*2);
     	String deviceNum = getStringFromHexStr(deviceNumPart);
-    	System.out.println(deviceNum);
+    	System.out.println("设备No="+deviceNum);
     	item.setEquipmentNo(deviceNum);
     	//软件版本号25
     	String version = input.substring(25*2, 26*2);
@@ -126,14 +130,18 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
     	//模具开合记录
     	int cnt = item.getRunCnt();
     	int start = 69;
-    	System.out.println("开合模次数="+cnt);
-    	logger.info("时间=="+input.substring(start*2));
-    	int end = (start+(cnt-1)*6+5 + 6)*2;
-    	if (input.length() >= end) {//防止传过来的只有开合模次数,却没有时间
-    		for (int pos=0; pos<cnt; pos++ ) {
+    	logger.info("累计开合模次数="+cnt);
+    	int end = input.length() - 4; //最后2位 0xXX,0xXX ,是CRC校验位
+    	logger.info("时间信息=="+input.substring(start*2, end));
+    	if (end - start*2 >= 24) {//时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
+    		//本次运行周期内的开合模次数
+    		int periodCnt = (end-start*2)/24;
+    		logger.info("本次开合模次数=="+periodCnt);
+    		for (int pos=0; pos<periodCnt; pos++ ) {
         		//合模时间
         		MouldHistoryTime time = new MouldHistoryTime();
         		time.setHistoryId(item.getId());
+        		time.setEquipmentNo(item.getEquipmentNo());
         		time.setSeq(pos + 1);
         		Date closeTime = parseDate(input, start, pos, 0);
         		time.setCloseTime(closeTime);
@@ -144,10 +152,12 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
         		time.setTimeCost(timeCost);
         		mouldHistoryTimeMapper.insertSelective(time);
         	}
+    	} else {
+    		logger.info("本次开合模次数==0");
     	}
-    	
+    	//统计该模盒的平均开合周期
     	MouldHistoryTimeExample exp = new MouldHistoryTimeExample();
-    	exp.createCriteria().andHistoryIdEqualTo(item.getId());
+    	exp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
     	List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(exp);
     	int avgTime = 0;
     	int totalTime = 0;
@@ -371,7 +381,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 	
 	public static void main(String[] args) {
 //		String str = "1F51";
-		String str = "FAAF470000000000000000000000003137333030303239333810010000000000000000000000000000000000000000001F51E85F0000000000004800646400010001000000ACE1";
+		String input = "FAAF530000000000000000000000003137333030303239343310010000000000000000000000000000000000000000001F51E85F00000000000045004A54000100110000001308160F171F1308160F2D188FCA";
 //		String temp = "0x"+str;
 //		int i = Integer.decode(temp);
 //		System.out.println(i);
@@ -381,9 +391,29 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 //		System.out.println(str.substring(69*2));
 //		Date d = parseDate(str, start, 0, 0);
 //		System.out.println(d.toGMTString());
-		str = str.substring(str.length() - 4);
-		System.out.println(str);
-		System.out.println(reverseParseHex(str));
+		
+    	int start = 69;
+    	int end = input.length() - 4; //最后2位 0xXX,0xXX ,是CRC校验位
+    	logger.info("时间信息=="+input.substring(start*2, end));
+    	if (end - start*2 >= 24) {//时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
+    		//本次运行周期内的开合模次数
+    		int periodCnt = (end-start*2)/24;
+    		logger.info("本次开合模次数=="+periodCnt);
+    		for (int pos=0; pos<periodCnt; pos++ ) {
+        		//合模时间
+        		MouldHistoryTime time = new MouldHistoryTime();
+        		time.setSeq(pos + 1);
+        		Date closeTime = parseDate(input, start, pos, 0);
+        		time.setCloseTime(closeTime);
+        		//开模时间
+        		Date openTime = parseDate(input, start, pos, 6);
+        		time.setOpenTime(openTime);
+        		int timeCost = (int) (openTime.getTime() - closeTime.getTime());
+        		time.setTimeCost(timeCost);
+        	}
+    	} else {
+    		logger.info("本次开合模次数==0");
+    	}
 	}
 	
 }