40 changed files with 2151 additions and 454 deletions
@ -0,0 +1,24 @@ |
|||
package com.ccsens.yanyuan.bean.dto.message; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: whj |
|||
* @time: 2021/12/20 14:28 |
|||
*/ |
|||
public class CoordinateDto { |
|||
@Data |
|||
public static class Point{ |
|||
private long x; |
|||
private long y; |
|||
|
|||
public Point() { |
|||
} |
|||
|
|||
public Point(long x, long y) { |
|||
this.x = x; |
|||
this.y = y; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
package com.ccsens.yanyuan.bean.po; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
public class TrainCorrect implements Serializable { |
|||
private Long id; |
|||
|
|||
private Long cardId; |
|||
|
|||
private Byte whichPlace; |
|||
|
|||
private Long operator; |
|||
|
|||
private Date createdAt; |
|||
|
|||
private Date updatedAt; |
|||
|
|||
private Byte recStatus; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public Long getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Long id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getCardId() { |
|||
return cardId; |
|||
} |
|||
|
|||
public void setCardId(Long cardId) { |
|||
this.cardId = cardId; |
|||
} |
|||
|
|||
public Byte getWhichPlace() { |
|||
return whichPlace; |
|||
} |
|||
|
|||
public void setWhichPlace(Byte whichPlace) { |
|||
this.whichPlace = whichPlace; |
|||
} |
|||
|
|||
public Long getOperator() { |
|||
return operator; |
|||
} |
|||
|
|||
public void setOperator(Long operator) { |
|||
this.operator = operator; |
|||
} |
|||
|
|||
public Date getCreatedAt() { |
|||
return createdAt; |
|||
} |
|||
|
|||
public void setCreatedAt(Date createdAt) { |
|||
this.createdAt = createdAt; |
|||
} |
|||
|
|||
public Date getUpdatedAt() { |
|||
return updatedAt; |
|||
} |
|||
|
|||
public void setUpdatedAt(Date updatedAt) { |
|||
this.updatedAt = updatedAt; |
|||
} |
|||
|
|||
public Byte getRecStatus() { |
|||
return recStatus; |
|||
} |
|||
|
|||
public void setRecStatus(Byte recStatus) { |
|||
this.recStatus = recStatus; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
StringBuilder sb = new StringBuilder(); |
|||
sb.append(getClass().getSimpleName()); |
|||
sb.append(" ["); |
|||
sb.append("Hash = ").append(hashCode()); |
|||
sb.append(", id=").append(id); |
|||
sb.append(", cardId=").append(cardId); |
|||
sb.append(", whichPlace=").append(whichPlace); |
|||
sb.append(", operator=").append(operator); |
|||
sb.append(", createdAt=").append(createdAt); |
|||
sb.append(", updatedAt=").append(updatedAt); |
|||
sb.append(", recStatus=").append(recStatus); |
|||
sb.append("]"); |
|||
return sb.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,621 @@ |
|||
package com.ccsens.yanyuan.bean.po; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
public class TrainCorrectExample { |
|||
protected String orderByClause; |
|||
|
|||
protected boolean distinct; |
|||
|
|||
protected List<Criteria> oredCriteria; |
|||
|
|||
public TrainCorrectExample() { |
|||
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(Long value) { |
|||
addCriterion("id =", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdNotEqualTo(Long value) { |
|||
addCriterion("id <>", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdGreaterThan(Long value) { |
|||
addCriterion("id >", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
|||
addCriterion("id >=", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdLessThan(Long value) { |
|||
addCriterion("id <", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdLessThanOrEqualTo(Long value) { |
|||
addCriterion("id <=", value, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdIn(List<Long> values) { |
|||
addCriterion("id in", values, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdNotIn(List<Long> values) { |
|||
addCriterion("id not in", values, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdBetween(Long value1, Long value2) { |
|||
addCriterion("id between", value1, value2, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andIdNotBetween(Long value1, Long value2) { |
|||
addCriterion("id not between", value1, value2, "id"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdIsNull() { |
|||
addCriterion("card_id is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdIsNotNull() { |
|||
addCriterion("card_id is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdEqualTo(Long value) { |
|||
addCriterion("card_id =", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdNotEqualTo(Long value) { |
|||
addCriterion("card_id <>", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdGreaterThan(Long value) { |
|||
addCriterion("card_id >", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdGreaterThanOrEqualTo(Long value) { |
|||
addCriterion("card_id >=", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdLessThan(Long value) { |
|||
addCriterion("card_id <", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdLessThanOrEqualTo(Long value) { |
|||
addCriterion("card_id <=", value, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdIn(List<Long> values) { |
|||
addCriterion("card_id in", values, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdNotIn(List<Long> values) { |
|||
addCriterion("card_id not in", values, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdBetween(Long value1, Long value2) { |
|||
addCriterion("card_id between", value1, value2, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCardIdNotBetween(Long value1, Long value2) { |
|||
addCriterion("card_id not between", value1, value2, "cardId"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceIsNull() { |
|||
addCriterion("which_place is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceIsNotNull() { |
|||
addCriterion("which_place is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceEqualTo(Byte value) { |
|||
addCriterion("which_place =", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceNotEqualTo(Byte value) { |
|||
addCriterion("which_place <>", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceGreaterThan(Byte value) { |
|||
addCriterion("which_place >", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceGreaterThanOrEqualTo(Byte value) { |
|||
addCriterion("which_place >=", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceLessThan(Byte value) { |
|||
addCriterion("which_place <", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceLessThanOrEqualTo(Byte value) { |
|||
addCriterion("which_place <=", value, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceIn(List<Byte> values) { |
|||
addCriterion("which_place in", values, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceNotIn(List<Byte> values) { |
|||
addCriterion("which_place not in", values, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceBetween(Byte value1, Byte value2) { |
|||
addCriterion("which_place between", value1, value2, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andWhichPlaceNotBetween(Byte value1, Byte value2) { |
|||
addCriterion("which_place not between", value1, value2, "whichPlace"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorIsNull() { |
|||
addCriterion("operator is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorIsNotNull() { |
|||
addCriterion("operator is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorEqualTo(Long value) { |
|||
addCriterion("operator =", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorNotEqualTo(Long value) { |
|||
addCriterion("operator <>", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorGreaterThan(Long value) { |
|||
addCriterion("operator >", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorGreaterThanOrEqualTo(Long value) { |
|||
addCriterion("operator >=", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorLessThan(Long value) { |
|||
addCriterion("operator <", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorLessThanOrEqualTo(Long value) { |
|||
addCriterion("operator <=", value, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorIn(List<Long> values) { |
|||
addCriterion("operator in", values, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorNotIn(List<Long> values) { |
|||
addCriterion("operator not in", values, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorBetween(Long value1, Long value2) { |
|||
addCriterion("operator between", value1, value2, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andOperatorNotBetween(Long value1, Long value2) { |
|||
addCriterion("operator not between", value1, value2, "operator"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtIsNull() { |
|||
addCriterion("created_at is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtIsNotNull() { |
|||
addCriterion("created_at is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtEqualTo(Date value) { |
|||
addCriterion("created_at =", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtNotEqualTo(Date value) { |
|||
addCriterion("created_at <>", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtGreaterThan(Date value) { |
|||
addCriterion("created_at >", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { |
|||
addCriterion("created_at >=", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtLessThan(Date value) { |
|||
addCriterion("created_at <", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtLessThanOrEqualTo(Date value) { |
|||
addCriterion("created_at <=", value, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtIn(List<Date> values) { |
|||
addCriterion("created_at in", values, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtNotIn(List<Date> values) { |
|||
addCriterion("created_at not in", values, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtBetween(Date value1, Date value2) { |
|||
addCriterion("created_at between", value1, value2, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andCreatedAtNotBetween(Date value1, Date value2) { |
|||
addCriterion("created_at not between", value1, value2, "createdAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtIsNull() { |
|||
addCriterion("updated_at is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtIsNotNull() { |
|||
addCriterion("updated_at is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtEqualTo(Date value) { |
|||
addCriterion("updated_at =", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtNotEqualTo(Date value) { |
|||
addCriterion("updated_at <>", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtGreaterThan(Date value) { |
|||
addCriterion("updated_at >", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { |
|||
addCriterion("updated_at >=", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtLessThan(Date value) { |
|||
addCriterion("updated_at <", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { |
|||
addCriterion("updated_at <=", value, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtIn(List<Date> values) { |
|||
addCriterion("updated_at in", values, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtNotIn(List<Date> values) { |
|||
addCriterion("updated_at not in", values, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtBetween(Date value1, Date value2) { |
|||
addCriterion("updated_at between", value1, value2, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { |
|||
addCriterion("updated_at not between", value1, value2, "updatedAt"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusIsNull() { |
|||
addCriterion("rec_status is null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusIsNotNull() { |
|||
addCriterion("rec_status is not null"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusEqualTo(Byte value) { |
|||
addCriterion("rec_status =", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusNotEqualTo(Byte value) { |
|||
addCriterion("rec_status <>", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusGreaterThan(Byte value) { |
|||
addCriterion("rec_status >", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { |
|||
addCriterion("rec_status >=", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusLessThan(Byte value) { |
|||
addCriterion("rec_status <", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusLessThanOrEqualTo(Byte value) { |
|||
addCriterion("rec_status <=", value, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusIn(List<Byte> values) { |
|||
addCriterion("rec_status in", values, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusNotIn(List<Byte> values) { |
|||
addCriterion("rec_status not in", values, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusBetween(Byte value1, Byte value2) { |
|||
addCriterion("rec_status between", value1, value2, "recStatus"); |
|||
return (Criteria) this; |
|||
} |
|||
|
|||
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { |
|||
addCriterion("rec_status not between", value1, value2, "recStatus"); |
|||
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); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.ccsens.yanyuan.persist.dao; |
|||
|
|||
import com.ccsens.yanyuan.persist.mapper.ToolFindDifferenceMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
public interface ToolFindDifferenceDao extends ToolFindDifferenceMapper { |
|||
/** |
|||
* 查找几处不同 |
|||
* @param cardId 卡片ID |
|||
* @return 不同数量 |
|||
*/ |
|||
int getDifferenceNum(@Param("cardId") Long cardId); |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.ccsens.yanyuan.persist.dao; |
|||
|
|||
import com.ccsens.yanyuan.persist.mapper.TrainCorrectMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
public interface TrainCorrectDao extends TrainCorrectMapper { |
|||
/** |
|||
* 查询某次找不同正确的位置 |
|||
* @param cardId 点读笔选择的卡片ID |
|||
* @return 正确位置 |
|||
*/ |
|||
List<Integer> queryPlace(@Param("cardId") Long cardId); |
|||
} |
|||
@ -1,18 +1,29 @@ |
|||
package com.ccsens.yanyuan.persist.dao; |
|||
|
|||
import com.ccsens.yanyuan.bean.dto.message.CoordinateDto; |
|||
import com.ccsens.yanyuan.bean.vo.TrainBelongVo; |
|||
import com.ccsens.yanyuan.persist.mapper.TrainProcessCardMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
public interface TrainProcessCardDao { |
|||
public interface TrainProcessCardDao extends TrainProcessCardMapper { |
|||
/** |
|||
* 查询线条 |
|||
* @param recordIds 点读笔卡片ID |
|||
* @return |
|||
*/ |
|||
List<TrainBelongVo.RecordLine> queryLines(@Param("recordIds") List<Long> recordIds); |
|||
|
|||
/** |
|||
* 统计正确点的数量 |
|||
* @param cardId 卡片ID |
|||
* @param coordinates 上传坐标 |
|||
* @return 统计数量 |
|||
*/ |
|||
List<Integer> count(@Param("cardId") Long cardId, @Param("coordinates") List<CoordinateDto.Point> coordinates); |
|||
} |
|||
|
|||
@ -0,0 +1,30 @@ |
|||
package com.ccsens.yanyuan.persist.mapper; |
|||
|
|||
import com.ccsens.yanyuan.bean.po.TrainCorrect; |
|||
import com.ccsens.yanyuan.bean.po.TrainCorrectExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface TrainCorrectMapper { |
|||
long countByExample(TrainCorrectExample example); |
|||
|
|||
int deleteByExample(TrainCorrectExample example); |
|||
|
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
int insert(TrainCorrect record); |
|||
|
|||
int insertSelective(TrainCorrect record); |
|||
|
|||
List<TrainCorrect> selectByExample(TrainCorrectExample example); |
|||
|
|||
TrainCorrect selectByPrimaryKey(Long id); |
|||
|
|||
int updateByExampleSelective(@Param("record") TrainCorrect record, @Param("example") TrainCorrectExample example); |
|||
|
|||
int updateByExample(@Param("record") TrainCorrect record, @Param("example") TrainCorrectExample example); |
|||
|
|||
int updateByPrimaryKeySelective(TrainCorrect record); |
|||
|
|||
int updateByPrimaryKey(TrainCorrect record); |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
package com.ccsens.yanyuan.service; |
|||
|
|||
import com.ccsens.yanyuan.bean.dto.ToolDto; |
|||
import com.ccsens.yanyuan.bean.dto.message.TalkingPenDto; |
|||
import com.ccsens.yanyuan.bean.vo.ToolVo; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author whj |
|||
*/ |
|||
public interface ITalkingPenService { |
|||
/** |
|||
* 处理点读笔状态 |
|||
* @param talkingPen 状态 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealStatus(TalkingPenDto talkingPen) throws Exception; |
|||
/** |
|||
* 处理wifi |
|||
* @param talkingPen wifi |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealWifi(TalkingPenDto talkingPen) throws Exception; |
|||
/** |
|||
* 处理电量状态 |
|||
* @param talkingPen 电量状态 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealElectric(TalkingPenDto talkingPen) throws Exception; |
|||
/** |
|||
* 处理查询试题 |
|||
* @param talkingPen 试题 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealQuestion(TalkingPenDto talkingPen) throws Exception; |
|||
/** |
|||
* 处理序号 |
|||
* @param talkingPen 序号或结果 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealIndex(TalkingPenDto talkingPen) throws Exception; |
|||
/** |
|||
* 处理过程日志 |
|||
* @param packageDto 包 |
|||
* @param frameDto 诊 |
|||
* @param processList 坐标数据 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void dealProcess(TalkingPenDto packageDto, TalkingPenDto frameDto, List<TalkingPenDto> processList) throws Exception; |
|||
/** |
|||
* 存储日志 |
|||
* @param messageMap 数据信息 |
|||
* @throws Exception Exception |
|||
*/ |
|||
void saveLog(Map<Byte, List<TalkingPenDto>> messageMap); |
|||
|
|||
/** |
|||
* 获取正在使用设备的使用者信息 |
|||
* @param param 点读笔信息 |
|||
* @param userId 操作者ID |
|||
* @return 使用者信息 |
|||
*/ |
|||
ToolVo.UserInfoSimple getUserName(ToolDto.GetUser param, Long userId); |
|||
} |
|||
@ -0,0 +1,634 @@ |
|||
package com.ccsens.yanyuan.service; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.ArrayUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.ccsens.common.service.IMessageService; |
|||
import com.ccsens.util.CRCUtil; |
|||
import com.ccsens.util.DateUtil; |
|||
import com.ccsens.util.RedisUtil; |
|||
import com.ccsens.util.bean.message.common.InMessage; |
|||
import com.ccsens.util.bean.message.common.MessageConstant; |
|||
import com.ccsens.util.bean.message.common.MessageRule; |
|||
import com.ccsens.yanyuan.bean.dto.ToolDto; |
|||
import com.ccsens.yanyuan.bean.dto.message.CoordinateDto; |
|||
import com.ccsens.yanyuan.bean.dto.message.TalkingPenDto; |
|||
import com.ccsens.yanyuan.bean.po.*; |
|||
import com.ccsens.yanyuan.bean.vo.ToolVo; |
|||
import com.ccsens.yanyuan.bean.vo.TrainContentVo; |
|||
import com.ccsens.yanyuan.persist.dao.*; |
|||
import com.ccsens.yanyuan.persist.mapper.EquipmentLogMapper; |
|||
import com.ccsens.yanyuan.persist.mapper.ToolCardMapper; |
|||
import com.ccsens.yanyuan.persist.mapper.ToolEquipmentMapper; |
|||
import com.ccsens.yanyuan.util.YanYuanConstant; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.math.BigDecimal; |
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: whj |
|||
* @time: 2021/12/21 16:31 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class TalkingPenService implements ITalkingPenService { |
|||
@Resource |
|||
private RedisUtil redisUtil; |
|||
@Resource |
|||
private IMessageService messageService; |
|||
@Resource |
|||
private Snowflake snowflake; |
|||
@Resource |
|||
private TrainEquipmentDao trainEquipmentDao; |
|||
@Resource |
|||
private ToolEquipmentMapper toolEquipmentMapper; |
|||
@Resource |
|||
private IConstantService constantService; |
|||
@Resource |
|||
private UserRelationDao userRelationDao; |
|||
@Resource |
|||
private TrainContentDao trainContentDao; |
|||
@Resource |
|||
private EquipmentLogMapper equipmentLogMapper; |
|||
@Resource |
|||
private TrainResultDao trainResultDao; |
|||
@Resource |
|||
private ToolCardMapper toolCardMapper; |
|||
@Resource |
|||
private TrainCardDao trainCardDao; |
|||
@Resource |
|||
private TrainRecordDao trainRecordDao; |
|||
@Resource |
|||
private TrainProcessCardDao trainProcessCardDao; |
|||
@Resource |
|||
private ToolFindDifferenceDao toolFindDifferenceDao; |
|||
@Resource |
|||
private TrainCorrectDao trainCorrectDao; |
|||
@Resource |
|||
private TraineeDao traineeDao; |
|||
|
|||
/** |
|||
* 处理序号 |
|||
* @param talkingPen 序号或结果 |
|||
*/ |
|||
@Override |
|||
public void dealIndex(TalkingPenDto talkingPen) throws Exception { |
|||
YanYuanConstant.Card card = YanYuanConstant.Card.getByCardIndex(talkingPen.getValue()); |
|||
byte type = card == null ? YanYuanConstant.CardType.INDEX : card.getType(); |
|||
long value = card == null ? talkingPen.getValue() : card.getRealIndex(); |
|||
// 查找点读笔
|
|||
ToolEquipment toolEquipment = getToolEquipment(talkingPen.getAuthId()); |
|||
if (toolEquipment == null) { |
|||
return; |
|||
} |
|||
Long equipmentId = toolEquipment.getId(); |
|||
// 查找使用者
|
|||
Long keyUserId = getUser(equipmentId, talkingPen.getAuthId()); |
|||
if (keyUserId < 0) { |
|||
// 未找到题目
|
|||
saveResult(type, 0L, toolEquipment.getId(), value); |
|||
return; |
|||
} |
|||
// 如果是序号,查找卡片对应题目code
|
|||
ToolCard toolCard = null; |
|||
if (type == YanYuanConstant.CardType.INDEX) { |
|||
ToolCardExample cardExample = new ToolCardExample(); |
|||
cardExample.createCriteria().andRealNumEqualTo(Math.toIntExact(value)); |
|||
cardExample.setOrderByClause(" id desc limit 1"); |
|||
List<ToolCard> toolCards = toolCardMapper.selectByExample(cardExample); |
|||
log.info("卡片对应类型:{}", toolCards); |
|||
if (CollectionUtil.isEmpty(toolCards)) { |
|||
saveResult(type, 0L, toolEquipment.getId(), value); |
|||
return; |
|||
} |
|||
toolCard = toolCards.get(0); |
|||
} |
|||
// 查询点读笔正在读的题目
|
|||
String key = StrUtil.format(YanYuanConstant.Equipment.TALKING_PEN_QUESTION, toolEquipment.getId(), keyUserId); |
|||
Object o = redisUtil.get(key); |
|||
log.info("点读笔{}正在读的题目:{}", key, o); |
|||
// 有正在读的题目,结果直接保存,序号判断类型一致保存
|
|||
if (o!=null) { |
|||
TrainContentVo.Audio audioRedis = (TrainContentVo.Audio) o; |
|||
//
|
|||
boolean save = type == YanYuanConstant.CardType.RESULT || |
|||
(type == YanYuanConstant.CardType.INDEX && toolCard.getType().equals(audioRedis.getCode())); |
|||
if (save) { |
|||
// 结果 或 序号,判断类型是否一致
|
|||
saveResult(type, audioRedis.getRecordId(), toolEquipment.getId(), value); |
|||
return; |
|||
} |
|||
} |
|||
long today = DateUtil.beginOfDay(new Date()).getTime(); |
|||
// 点读笔没有正在进行的题目
|
|||
if (type == YanYuanConstant.CardType.INDEX) { |
|||
// 查询前后一周的、同类型的训练计划
|
|||
saveCard(toolCard, toolEquipment.getId(), keyUserId, today); |
|||
} else { |
|||
// 查询今天的训练计划和结果
|
|||
saveTrainResult(value, toolEquipment.getId(), keyUserId, today); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 保存卡片序号 |
|||
* @param toolCard 卡片 |
|||
* @param toolEquipmentId 设备ID |
|||
* @param keyUserId 使用者 |
|||
* @param today 今天 |
|||
*/ |
|||
private void saveCard(ToolCard toolCard, Long toolEquipmentId, Long keyUserId, long today) { |
|||
long startTime = today - YanYuanConstant.MentalTest.PERIOD / 2 * YanYuanConstant.DAY_TIME; |
|||
long endTime = today + YanYuanConstant.MentalTest.PERIOD / 2 * YanYuanConstant.DAY_TIME; |
|||
List<TrainContentVo.RecordTime> times = trainRecordDao.queryTime(keyUserId, startTime, endTime, toolCard.getType()); |
|||
if (CollectionUtil.isEmpty(times)) { |
|||
saveCard(toolCard, 0L, keyUserId, today); |
|||
return; |
|||
} |
|||
Long recordId = null; |
|||
Long subTime = null; |
|||
for (TrainContentVo.RecordTime time: times) { |
|||
if (subTime == null || subTime > Math.abs(today - time.getStartTime())) { |
|||
recordId = time.getRecordId(); |
|||
subTime = Math.abs(today - time.getStartTime()); |
|||
} |
|||
} |
|||
saveResult(YanYuanConstant.CardType.INDEX, recordId, toolEquipmentId, toolCard.getRealNum()); |
|||
} |
|||
|
|||
/** |
|||
* 保存答案 |
|||
* @param value 答案 |
|||
* @param toolEquipmentId 设备ID |
|||
* @param keyUserId 用户ID |
|||
* @param today 时间 |
|||
*/ |
|||
private void saveTrainResult(Long value, Long toolEquipmentId, Long keyUserId, long today) { |
|||
List<TrainContentVo.RecordResultCount> records = trainRecordDao.queryCount(keyUserId, today); |
|||
log.info("{}今天{}的训练计划:{}", keyUserId, today, records); |
|||
if (CollectionUtil.isEmpty(records)) { |
|||
saveResult(YanYuanConstant.CardType.RESULT, 0L, toolEquipmentId, value); |
|||
} else if (records.size() == 1) { |
|||
saveResult(YanYuanConstant.CardType.RESULT, records.get(0).getRecordId(), toolEquipmentId, value); |
|||
} else { |
|||
// 找到第一个没有答案的进行记录
|
|||
for (TrainContentVo.RecordResultCount record: records) { |
|||
if (record.getCount() == 0) { |
|||
saveResult(YanYuanConstant.CardType.RESULT, record.getRecordId(), toolEquipmentId, value); |
|||
return; |
|||
} |
|||
} |
|||
// 都有答案,记录在最后一道题下
|
|||
saveResult(YanYuanConstant.CardType.RESULT, records.get(records.size()-1).getRecordId(), toolEquipmentId, value); |
|||
} |
|||
} |
|||
|
|||
private void saveResult(Byte type, Long recordId, Long equipmentId, long value) { |
|||
log.info("保存类型为:{}的结果,recordId:{}, equipmentId:{}, value:{}", type, recordId, equipmentId, value); |
|||
if (type == null || type == YanYuanConstant.CardType.INDEX) { |
|||
// 序号
|
|||
// 根据序号查询卡片
|
|||
ToolCardExample example = new ToolCardExample(); |
|||
example.createCriteria().andRealNumEqualTo((int)value); |
|||
example.setOrderByClause("id desc limit 1"); |
|||
List<ToolCard> cards = toolCardMapper.selectByExample(example); |
|||
// 存储训练结果
|
|||
TrainCard trainCard = new TrainCard(); |
|||
trainCard.setId(snowflake.nextId()); |
|||
trainCard.setRecordId(recordId); |
|||
trainCard.setAssistId(CollectionUtil.isEmpty(cards) ? 0 : cards.get(0).getId()); |
|||
trainCard.setEquipmentId(equipmentId); |
|||
trainCardDao.insertSelective(trainCard); |
|||
} else if (type == YanYuanConstant.CardType.RESULT) { |
|||
// 结果
|
|||
TrainResult result = new TrainResult(); |
|||
result.setId(snowflake.nextId()); |
|||
result.setRecordId(recordId); |
|||
result.setEquipmentId(equipmentId); |
|||
result.setFinishResult(new BigDecimal(value)); |
|||
trainResultDao.insertSelective(result); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 存储日志 |
|||
* @param messageMap 数据信息 |
|||
*/ |
|||
@Override |
|||
public void saveLog(Map<Byte, List<TalkingPenDto>> messageMap) { |
|||
List<Byte> keys = CollectionUtil.sort(messageMap.keySet(), Byte::compare); |
|||
StringBuilder builder = new StringBuilder(); |
|||
TalkingPenDto first = new TalkingPenDto(); |
|||
keys.forEach(key -> CollectionUtil.sort(messageMap.get(key), |
|||
Comparator.comparingInt(TalkingPenDto::getAddr)) |
|||
.forEach(dto->{ |
|||
if (first.getAuthId() == null) { |
|||
first.setAuthId(dto.getAuthId()); |
|||
first.setAddr(dto.getAddr()); |
|||
} |
|||
builder.append(dto.getValue()).append(","); |
|||
})); |
|||
EquipmentLog log = new EquipmentLog(); |
|||
log.setId(snowflake.nextId()); |
|||
log.setSerial(Long.parseLong(first.getAuthId())); |
|||
log.setAddr(first.getAddr()); |
|||
log.setValue(builder.toString()); |
|||
equipmentLogMapper.insertSelective(log); |
|||
} |
|||
|
|||
@Override |
|||
public ToolVo.UserInfoSimple getUserName(ToolDto.GetUser param, Long userId) { |
|||
long traineeId = getUserId(param.getEquipmentId()); |
|||
if (traineeId == YanYuanConstant.Equipment.BIND_USER_NUM_ZERO |
|||
|| traineeId == YanYuanConstant.Equipment.BIND_USER_NUM_MORE) { |
|||
ToolVo.UserInfoSimple simple = new ToolVo.UserInfoSimple(); |
|||
simple.setStatus((byte)traineeId); |
|||
return simple; |
|||
} else { |
|||
return traineeDao.getSimpleByKeyId(traineeId); |
|||
} |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 处理过程日志 |
|||
* @param packageDto 包 |
|||
* @param frameDto 诊 |
|||
* @param processList 坐标数据 |
|||
*/ |
|||
@Override |
|||
public void dealProcess(TalkingPenDto packageDto, TalkingPenDto frameDto, List<TalkingPenDto> processList) throws Exception { |
|||
// 判断点读笔坐标位数是不是3的倍数
|
|||
int group = 3; |
|||
if (CollectionUtil.isEmpty(processList) || processList.size() % group != 0) { |
|||
log.info("点读笔过程坐标码位数不正确:{}", processList); |
|||
return; |
|||
} |
|||
String indexTime = constantService.getValue(YanYuanConstant.Equipment.VALID_INDEX_TIME_KEY); |
|||
// 查询点读笔对应的序号
|
|||
TrainCard trainCard = trainCardDao.getRecent(packageDto.getAuthId(), (System.currentTimeMillis()/1000 - Long.parseLong(indexTime)* 3600 ) ); |
|||
log.info("trainCard:{}", trainCard); |
|||
// 重新整理数据,存储过程
|
|||
List<TalkingPenDto> points = CollectionUtil.sort(processList, Comparator.comparingInt(TalkingPenDto::getAddr)); |
|||
List<CoordinateDto.Point> coordinates = new ArrayList<>(); |
|||
StringBuilder builder = new StringBuilder(); |
|||
|
|||
for (int i = 0; i < points.size() ; i+=group) { |
|||
builder.append(points.get(i).getValue()).append(",") |
|||
.append(points.get(i + 1).getValue()).append(",") |
|||
.append(points.get(i + 2).getValue()).append(";"); |
|||
coordinates.add(new CoordinateDto.Point(points.get(i).getValue(), points.get(i + 1).getValue())); |
|||
} |
|||
// 保存过程
|
|||
TrainProcessCard process = new TrainProcessCard(); |
|||
process.setId(snowflake.nextId()); |
|||
process.setCardId(trainCard == null ? 0 : trainCard.getId()); |
|||
process.setOperateTime(packageDto.getTime()); |
|||
process.setPackageIndex(packageDto.getValue().intValue()); |
|||
process.setFrameIndex(frameDto.getValue().intValue()); |
|||
process.setPoints(builder.toString()); |
|||
trainProcessCardDao.insertSelective(process); |
|||
log.info("保存点读笔训练过程记录:{}", process); |
|||
// 判断正误
|
|||
judgeProcess(trainCard, coordinates, packageDto.getAuthId()); |
|||
} |
|||
|
|||
/** |
|||
* 判断过程的正确错误 |
|||
* @param trainCard 训练卡片 |
|||
* @param coordinates 点坐标 |
|||
* @param authId 授权ID |
|||
*/ |
|||
private void judgeProcess(TrainCard trainCard, List<CoordinateDto.Point> coordinates, String authId) throws Exception { |
|||
// 判断有无卡片序号
|
|||
if (trainCard == null || trainCard.getAssistId() == null || trainCard.getAssistId() == 0) { |
|||
log.info("没有先点击卡片序号,不判断正误"); |
|||
return; |
|||
} |
|||
// 查询
|
|||
// 查找核心点,无则不判断
|
|||
ToolFindDifferenceExample differenceExample = new ToolFindDifferenceExample(); |
|||
differenceExample.createCriteria().andCardIdEqualTo(trainCard.getAssistId()) |
|||
.andPositionEqualTo(YanYuanConstant.Coordinate.POSITION_CENTER); |
|||
List<ToolFindDifference> differences = toolFindDifferenceDao.selectByExample(differenceExample); |
|||
if (CollectionUtil.isEmpty(differences)) { |
|||
log.info("没有找到卡片对应的正确点,不判断正误"); |
|||
return; |
|||
} |
|||
// 查找卡片共几处不同
|
|||
int max = toolFindDifferenceDao.getDifferenceNum(trainCard.getAssistId()); |
|||
// 判断有无正确的点
|
|||
List<Integer> curPointPlaces = trainProcessCardDao.count(trainCard.getAssistId(), coordinates); |
|||
if (CollectionUtil.isNotEmpty(curPointPlaces)) { |
|||
// 正确, 判断找到了几个,发送对应语音
|
|||
saveCurrentPoint(trainCard.getId(), curPointPlaces.get(0), max, authId); |
|||
return; |
|||
} |
|||
//计算正确的数和错误的数
|
|||
int current = 0; |
|||
int error = 0; |
|||
int percentNum = 0; |
|||
int maxDistance = Integer.parseInt(constantService.getValue(YanYuanConstant.Coordinate.MAX_DISTANCE)); |
|||
int minPercent = Integer.parseInt(constantService.getValue(YanYuanConstant.Coordinate.MIN_PERCENT)); |
|||
double pow = Math.pow((double) maxDistance * YanYuanConstant.Coordinate.MAX_X / YanYuanConstant.Coordinate.REAL_WIDTH, 2); |
|||
int curPlace = -1; |
|||
for (ToolFindDifference d : differences) { |
|||
for (CoordinateDto.Point p : coordinates) { |
|||
// 计算点到距离的平方和
|
|||
double supplier = Math.pow(p.getX() - d.getCoordinatesX().intValue(), 2) + Math.pow(p.getX() - d.getCoordinatesX().intValue(), 2); |
|||
if (supplier <= pow) { |
|||
current++; |
|||
} else { |
|||
error++; |
|||
} |
|||
} |
|||
int currentRate = current * 100 / (current + error); |
|||
if (currentRate > percentNum) { |
|||
percentNum = currentRate; |
|||
curPlace = d.getWhichPlace(); |
|||
} |
|||
current = 0; |
|||
error = 0; |
|||
} |
|||
// 比较比例
|
|||
if (percentNum >= minPercent) { |
|||
// 大于标准比例
|
|||
saveCurrentPoint(trainCard.getId(), curPlace, max, authId); |
|||
} else { |
|||
// 小于比例
|
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_DIFFERENCE_ERROR, authId); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 存储正确的结点,并根据正确的个数等发送语音 |
|||
* @param trainCardId 训练卡片ID |
|||
* @param curPointPlace 正确的位置 |
|||
* @param max 卡片对应的正确个数 |
|||
* @param authId 点读笔编码(授权ID) |
|||
*/ |
|||
private void saveCurrentPoint(Long trainCardId, int curPointPlace, int max, String authId) throws Exception { |
|||
// 判断当前共几个,是否大等于最大正确个数
|
|||
List<Integer> currents = trainCorrectDao.queryPlace(trainCardId); |
|||
if (currents.size() >= max) { |
|||
log.info("{}正确数量已经大等于最大正确数:{}", trainCardId, max); |
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_DIFFERENCE_COMPLETE, authId); |
|||
return; |
|||
} |
|||
if (!currents.contains(curPointPlace)) { |
|||
// 若未存储,则存储
|
|||
TrainCorrect correct = new TrainCorrect(); |
|||
correct.setId(snowflake.nextId()); |
|||
correct.setWhichPlace((byte) curPointPlace); |
|||
correct.setCardId(trainCardId); |
|||
trainCorrectDao.insertSelective(correct); |
|||
currents.add(curPointPlace); |
|||
} |
|||
int audioIndex = currents.size() >= max ? YanYuanConstant.Equipment.AUDIO_DIFFERENCE_COMPLETE : |
|||
YanYuanConstant.Equipment.AUDIO_DIFFERENCE_CURRENT; |
|||
sendAudio(audioIndex, authId); |
|||
log.info("{}继续找下一个,播放语音:{}", trainCardId, audioIndex); |
|||
} |
|||
|
|||
/** |
|||
* 处理查询试题 |
|||
* @param talkingPen 试题 |
|||
*/ |
|||
@Override |
|||
public void dealQuestion(TalkingPenDto talkingPen) throws Exception { |
|||
// 查找点读笔
|
|||
ToolEquipment toolEquipment = getToolEquipment(talkingPen.getAuthId()); |
|||
if (toolEquipment == null) { |
|||
return; |
|||
} |
|||
// 查找使用者
|
|||
Long keyUserId = getUser(toolEquipment.getId(), talkingPen.getAuthId()); |
|||
if (keyUserId < 0) { |
|||
return; |
|||
} |
|||
// 查找题目
|
|||
TrainContentVo.Audio nextPlan = getNextPlan(talkingPen, toolEquipment.getId(), keyUserId, talkingPen.getAuthId()); |
|||
log.info("{}的下一个训练计划:{}", toolEquipment.getId(), nextPlan); |
|||
if (nextPlan == null) { |
|||
return; |
|||
} |
|||
String key = StrUtil.format(YanYuanConstant.Equipment.TALKING_PEN_QUESTION, toolEquipment.getId(), keyUserId); |
|||
redisUtil.set(key, nextPlan, YanYuanConstant.Train.TALKING_PEN_WRITE_TIME); |
|||
//通知点读笔
|
|||
sendAudio(nextPlan.getAudioPosition() == null ? YanYuanConstant.Equipment.AUDIO_DEFAULT : nextPlan.getAudioPosition(), talkingPen.getAuthId()); |
|||
} |
|||
|
|||
/** |
|||
* 获取下一个训练计划 |
|||
* @param talkingPen 点读笔上传信息 |
|||
* @param equipmentId 设备ID |
|||
* @param keyUserId 使用者ID |
|||
* @param serial 点读笔序号 |
|||
* @return 语音信息 |
|||
* @throws Exception exception |
|||
*/ |
|||
private TrainContentVo.Audio getNextPlan(TalkingPenDto talkingPen, Long equipmentId, Long keyUserId, String serial) throws Exception { |
|||
String key = StrUtil.format(YanYuanConstant.Equipment.TALKING_PEN_QUESTION, equipmentId, keyUserId); |
|||
Object o = redisUtil.get(key); |
|||
log.info("{}的缓存对象:{}", key, o); |
|||
// 今天开始的时间
|
|||
Date now = new Date(); |
|||
long todayBegin = DateUtil.beginOfDay(now).getTime(); |
|||
TrainContentVo.Audio audio; |
|||
if (ObjectUtil.isNull(o)) { |
|||
// 查询今天的第一个训练计划
|
|||
audio = trainContentDao.getFirst(keyUserId, todayBegin); |
|||
if (audio == null) { |
|||
// 提醒登录小程序进行脑力测评
|
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_MENTAL, serial); |
|||
return null; |
|||
} else { |
|||
return audio; |
|||
} |
|||
} |
|||
TrainContentVo.Audio audioRedis = (TrainContentVo.Audio) o; |
|||
audio = trainContentDao.getNext(audioRedis.getRecordId(), talkingPen.getValue()); |
|||
if (audio == null) { |
|||
if (talkingPen.getValue() != YanYuanConstant.Equipment.NEXT) { |
|||
// 上一道为空 提醒没有更多题目
|
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_TRAIN_PLAN_NO, serial); |
|||
} else { |
|||
// 下一道为空
|
|||
//当前题目日期小于今天 提醒登录小程序进行脑力测评, 否则 提醒没有更多题目
|
|||
int audioIndex = audioRedis.getStartTime() < todayBegin ? YanYuanConstant.Equipment.AUDIO_MENTAL : YanYuanConstant.Equipment.AUDIO_TRAIN_PLAN_NO; |
|||
sendAudio(audioIndex, serial); |
|||
} |
|||
return null; |
|||
} |
|||
return audio; |
|||
} |
|||
|
|||
/** |
|||
* 查询设备的使用者ID |
|||
* @param equipmentId 设备ID |
|||
* @return 使用者ID |
|||
*/ |
|||
private Long getUser(Long equipmentId, String authId) throws Exception { |
|||
// 查询时间
|
|||
long userId = getUserId(equipmentId); |
|||
log.info("{}关联的使用者:{}", equipmentId, userId); |
|||
if (userId == YanYuanConstant.Equipment.BIND_USER_NUM_ZERO) { |
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_NO_TRAINEE, authId); |
|||
} else if (userId == YanYuanConstant.Equipment.BIND_USER_NUM_MORE) { |
|||
sendAudio(YanYuanConstant.Equipment.AUDIO_MORE_TRAINEE, authId); |
|||
} |
|||
return userId; |
|||
} |
|||
|
|||
/** |
|||
* 获取正在使用设备的使用者ID |
|||
* @param equipmentId 点读笔ID |
|||
* @return 使用者ID |
|||
*/ |
|||
private long getUserId(Long equipmentId) { |
|||
// 查询时间
|
|||
String key = YanYuanConstant.Equipment.VALID_TIME_KEY; |
|||
String value = constantService.getValue(key); |
|||
long time = System.currentTimeMillis() - Long.parseLong(value) * YanYuanConstant.DAY_TIME; |
|||
Date date = new Date(); |
|||
date.setTime(time); |
|||
Long keyUserId = trainEquipmentDao.queryRecentUserId(equipmentId, date); |
|||
log.info("{}有效期内选择的用户:{}", equipmentId, keyUserId); |
|||
if (keyUserId != null) { |
|||
return keyUserId; |
|||
} |
|||
// 查询购买者关联的用户
|
|||
List<Long> userIds = userRelationDao.countUserByEquipment(equipmentId); |
|||
log.info("{}关联的使用者:{}", equipmentId, userIds); |
|||
if (CollectionUtil.isEmpty(userIds)) { |
|||
return YanYuanConstant.Equipment.BIND_USER_NUM_ZERO; |
|||
} else if (userIds.size() == 1) { |
|||
return userIds.get(0); |
|||
} else { |
|||
return YanYuanConstant.Equipment.BIND_USER_NUM_MORE; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 查询设备信息 |
|||
* @param authId 授权ID |
|||
* @return 设备 |
|||
*/ |
|||
private ToolEquipment getToolEquipment(String authId) { |
|||
long serial = Long.parseLong(authId); |
|||
ToolEquipmentExample toolEquipmentExample = new ToolEquipmentExample(); |
|||
toolEquipmentExample.createCriteria().andSerialEqualTo(serial); |
|||
List<ToolEquipment> toolEquipments = toolEquipmentMapper.selectByExample(toolEquipmentExample); |
|||
if (CollectionUtil.isEmpty(toolEquipments)) { |
|||
return null; |
|||
} |
|||
return toolEquipments.get(0); |
|||
} |
|||
|
|||
/** |
|||
* 处理电量状态 |
|||
* @param talkingPen 电量状态 |
|||
*/ |
|||
@Override |
|||
public void dealElectric(TalkingPenDto talkingPen) { |
|||
log.info("更新电量:{}", talkingPen); |
|||
ToolEquipmentExample example = new ToolEquipmentExample(); |
|||
example.createCriteria().andSerialEqualTo(Long.parseLong(talkingPen.getAuthId())); |
|||
ToolEquipment equipment = new ToolEquipment(); |
|||
equipment.setElectricQuantity(talkingPen.getValue().intValue()); |
|||
toolEquipmentMapper.updateByExampleSelective(equipment, example); |
|||
} |
|||
|
|||
/** |
|||
* 处理wifi |
|||
* @param talkingPen wifi |
|||
*/ |
|||
@Override |
|||
public void dealWifi(TalkingPenDto talkingPen) { |
|||
log.info("更新wifi状态:{}", talkingPen); |
|||
ToolEquipmentExample example = new ToolEquipmentExample(); |
|||
example.createCriteria().andSerialEqualTo(Long.parseLong(talkingPen.getAuthId())); |
|||
ToolEquipment equipment = new ToolEquipment(); |
|||
equipment.setWifiStatus(talkingPen.getValue().byteValue()); |
|||
toolEquipmentMapper.updateByExampleSelective(equipment, example); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 处理点读笔状态 |
|||
* @param talkingPen 状态 |
|||
*/ |
|||
@Override |
|||
public void dealStatus(TalkingPenDto talkingPen) { |
|||
log.info("更新处理点读笔状态:{}", talkingPen); |
|||
ToolEquipmentExample example = new ToolEquipmentExample(); |
|||
example.createCriteria().andSerialEqualTo(Long.parseLong(talkingPen.getAuthId())); |
|||
ToolEquipment equipment = new ToolEquipment(); |
|||
equipment.setEquipmentStatus(talkingPen.getValue().byteValue()); |
|||
toolEquipmentMapper.updateByExampleSelective(equipment, example); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通知点读笔,应该播放什么语音 |
|||
* @param value 语音位置 |
|||
* @param talkingPenSerial 点读笔序列号(标识ID) |
|||
* @throws Exception 异常 |
|||
*/ |
|||
private void sendAudio(int value, String talkingPenSerial) throws Exception { |
|||
//记录一下点读笔发送的语音,时长1分钟,若1分钟内发送过相同的内容,则不再发送(时长待定,该判断待讨论)
|
|||
String key = StrUtil.format(YanYuanConstant.Equipment.TALKING_PEN_AUDIO_KEY, talkingPenSerial); |
|||
Object o = redisUtil.get(key); |
|||
if (o != null) { |
|||
int oldValue = (Integer) o; |
|||
if (oldValue == YanYuanConstant.Equipment.AUDIO_NO_TRAINEE) { |
|||
log.info("给{}发送的语音:{}在一分钟内已经发送过,不再重复发送。", talkingPenSerial, value); |
|||
} |
|||
} |
|||
MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); |
|||
messageRule.setAckRule(MessageRule.AckRule.NONE); |
|||
messageRule.setOfflineDiscard((byte) 1); |
|||
Set<String> userIdSet = new HashSet<>(); |
|||
userIdSet.add(talkingPenSerial); |
|||
// 开始标志
|
|||
byte[] data = new byte[14]; |
|||
System.arraycopy(YanYuanConstant.ModBus.START, 0 , data, 0, YanYuanConstant.ModBus.START.length); |
|||
// 寄存器数量
|
|||
data[2] = 11; |
|||
// 点读笔地址
|
|||
data[3] = YanYuanConstant.ModBus.TALKING_PEN_ADDR; |
|||
// 功能码(1) 10:写多个
|
|||
data[4] = YanYuanConstant.ModBus.WRITE_MORE; |
|||
// 寄存器起始地址(2)
|
|||
System.arraycopy(YanYuanConstant.ModBus.AUDIO_ADDR, 0 , data, 5, YanYuanConstant.ModBus.AUDIO_ADDR.length); |
|||
// 寄存器数量(2)
|
|||
data[7] = 0X00; |
|||
data[8] = 0X01; |
|||
// 寄存器长度(1) 2*寄存器数量
|
|||
data[9] = 2; |
|||
// 音频顺序
|
|||
data[10] = (byte) (value >> 8); |
|||
data[11] = (byte) (value & 0xFF); |
|||
// crc
|
|||
byte[] crc = new byte[2]; |
|||
CRCUtil.crc16(crc,data,3, data[2] - crc.length); |
|||
data[12] = crc[0]; |
|||
data[13] = crc[1]; |
|||
String join = ArrayUtil.join(data, ","); |
|||
InMessage inMessage = InMessage.newToUserMessage(null, userIdSet, null, messageRule, join); |
|||
log.info("给点读笔发送消息:{}", inMessage); |
|||
//发送消息
|
|||
messageService.sendTo(inMessage); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
<?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.ccsens.yanyuan.persist.dao.ToolFindDifferenceDao"> |
|||
<select id="getDifferenceNum" resultType="java.lang.Integer"> |
|||
SELECT count(*) FROM t_tool_find_difference WHERE card_id = #{cardId} and rec_status = 0 |
|||
</select> |
|||
</mapper> |
|||
@ -0,0 +1,7 @@ |
|||
<?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.ccsens.yanyuan.persist.dao.TrainCorrectDao"> |
|||
<select id="queryPlace" resultType="java.lang.Integer"> |
|||
select distinct which_place from u_train_correct where card_id = #{cardId} and rec_status = 0 |
|||
</select> |
|||
</mapper> |
|||
@ -0,0 +1,243 @@ |
|||
<?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.ccsens.yanyuan.persist.mapper.TrainCorrectMapper"> |
|||
<resultMap id="BaseResultMap" type="com.ccsens.yanyuan.bean.po.TrainCorrect"> |
|||
<id column="id" jdbcType="BIGINT" property="id" /> |
|||
<result column="card_id" jdbcType="BIGINT" property="cardId" /> |
|||
<result column="which_place" jdbcType="TINYINT" property="whichPlace" /> |
|||
<result column="operator" jdbcType="BIGINT" property="operator" /> |
|||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" /> |
|||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" /> |
|||
<result column="rec_status" jdbcType="TINYINT" property="recStatus" /> |
|||
</resultMap> |
|||
<sql id="Example_Where_Clause"> |
|||
<where> |
|||
<foreach collection="oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Update_By_Example_Where_Clause"> |
|||
<where> |
|||
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Base_Column_List"> |
|||
id, card_id, which_place, operator, created_at, updated_at, rec_status |
|||
</sql> |
|||
<select id="selectByExample" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrectExample" resultMap="BaseResultMap"> |
|||
select |
|||
<if test="distinct"> |
|||
distinct |
|||
</if> |
|||
<include refid="Base_Column_List" /> |
|||
from u_train_correct |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
<if test="orderByClause != null"> |
|||
order by ${orderByClause} |
|||
</if> |
|||
</select> |
|||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
|||
select |
|||
<include refid="Base_Column_List" /> |
|||
from u_train_correct |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</select> |
|||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
|||
delete from u_train_correct |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</delete> |
|||
<delete id="deleteByExample" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrectExample"> |
|||
delete from u_train_correct |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</delete> |
|||
<insert id="insert" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrect"> |
|||
insert into u_train_correct (id, card_id, which_place, |
|||
operator, created_at, updated_at, |
|||
rec_status) |
|||
values (#{id,jdbcType=BIGINT}, #{cardId,jdbcType=BIGINT}, #{whichPlace,jdbcType=TINYINT}, |
|||
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, |
|||
#{recStatus,jdbcType=TINYINT}) |
|||
</insert> |
|||
<insert id="insertSelective" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrect"> |
|||
insert into u_train_correct |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null"> |
|||
id, |
|||
</if> |
|||
<if test="cardId != null"> |
|||
card_id, |
|||
</if> |
|||
<if test="whichPlace != null"> |
|||
which_place, |
|||
</if> |
|||
<if test="operator != null"> |
|||
operator, |
|||
</if> |
|||
<if test="createdAt != null"> |
|||
created_at, |
|||
</if> |
|||
<if test="updatedAt != null"> |
|||
updated_at, |
|||
</if> |
|||
<if test="recStatus != null"> |
|||
rec_status, |
|||
</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="id != null"> |
|||
#{id,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="cardId != null"> |
|||
#{cardId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="whichPlace != null"> |
|||
#{whichPlace,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="operator != null"> |
|||
#{operator,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="createdAt != null"> |
|||
#{createdAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="updatedAt != null"> |
|||
#{updatedAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="recStatus != null"> |
|||
#{recStatus,jdbcType=TINYINT}, |
|||
</if> |
|||
</trim> |
|||
</insert> |
|||
<select id="countByExample" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrectExample" resultType="java.lang.Long"> |
|||
select count(*) from u_train_correct |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</select> |
|||
<update id="updateByExampleSelective" parameterType="map"> |
|||
update u_train_correct |
|||
<set> |
|||
<if test="record.id != null"> |
|||
id = #{record.id,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.cardId != null"> |
|||
card_id = #{record.cardId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.whichPlace != null"> |
|||
which_place = #{record.whichPlace,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="record.operator != null"> |
|||
operator = #{record.operator,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.createdAt != null"> |
|||
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="record.updatedAt != null"> |
|||
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="record.recStatus != null"> |
|||
rec_status = #{record.recStatus,jdbcType=TINYINT}, |
|||
</if> |
|||
</set> |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByExample" parameterType="map"> |
|||
update u_train_correct |
|||
set id = #{record.id,jdbcType=BIGINT}, |
|||
card_id = #{record.cardId,jdbcType=BIGINT}, |
|||
which_place = #{record.whichPlace,jdbcType=TINYINT}, |
|||
operator = #{record.operator,jdbcType=BIGINT}, |
|||
created_at = #{record.createdAt,jdbcType=TIMESTAMP}, |
|||
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, |
|||
rec_status = #{record.recStatus,jdbcType=TINYINT} |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrect"> |
|||
update u_train_correct |
|||
<set> |
|||
<if test="cardId != null"> |
|||
card_id = #{cardId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="whichPlace != null"> |
|||
which_place = #{whichPlace,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="operator != null"> |
|||
operator = #{operator,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="createdAt != null"> |
|||
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="updatedAt != null"> |
|||
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
|||
</if> |
|||
<if test="recStatus != null"> |
|||
rec_status = #{recStatus,jdbcType=TINYINT}, |
|||
</if> |
|||
</set> |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</update> |
|||
<update id="updateByPrimaryKey" parameterType="com.ccsens.yanyuan.bean.po.TrainCorrect"> |
|||
update u_train_correct |
|||
set card_id = #{cardId,jdbcType=BIGINT}, |
|||
which_place = #{whichPlace,jdbcType=TINYINT}, |
|||
operator = #{operator,jdbcType=BIGINT}, |
|||
created_at = #{createdAt,jdbcType=TIMESTAMP}, |
|||
updated_at = #{updatedAt,jdbcType=TIMESTAMP}, |
|||
rec_status = #{recStatus,jdbcType=TINYINT} |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</update> |
|||
</mapper> |
|||
Loading…
Reference in new issue