feat: 增加定时统计每天上图数并保存的功能
parent
4e292e0e5e
commit
2306b92671
@ -0,0 +1,36 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
public class MntnDayStat extends MntnDayStatKey {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column mntn_day_stat.uploads
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String uploads;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column mntn_day_stat.uploads
|
||||
*
|
||||
* @return the value of mntn_day_stat.uploads
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getUploads() {
|
||||
return uploads;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column mntn_day_stat.uploads
|
||||
*
|
||||
* @param uploads the value for mntn_day_stat.uploads
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setUploads(String uploads) {
|
||||
this.uploads = uploads;
|
||||
}
|
||||
}
|
@ -0,0 +1,492 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class MntnDayStatExample {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected String orderByClause;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected boolean distinct;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public MntnDayStatExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
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 andTermIdIsNull() {
|
||||
addCriterion("term_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdIsNotNull() {
|
||||
addCriterion("term_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdEqualTo(Integer value) {
|
||||
addCriterion("term_id =", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdNotEqualTo(Integer value) {
|
||||
addCriterion("term_id <>", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdGreaterThan(Integer value) {
|
||||
addCriterion("term_id >", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("term_id >=", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdLessThan(Integer value) {
|
||||
addCriterion("term_id <", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("term_id <=", value, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdIn(List<Integer> values) {
|
||||
addCriterion("term_id in", values, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdNotIn(List<Integer> values) {
|
||||
addCriterion("term_id not in", values, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("term_id between", value1, value2, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTermIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("term_id not between", value1, value2, "termId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateIsNull() {
|
||||
addCriterion("`date` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateIsNotNull() {
|
||||
addCriterion("`date` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateEqualTo(Date value) {
|
||||
addCriterion("`date` =", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateNotEqualTo(Date value) {
|
||||
addCriterion("`date` <>", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateGreaterThan(Date value) {
|
||||
addCriterion("`date` >", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("`date` >=", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateLessThan(Date value) {
|
||||
addCriterion("`date` <", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateLessThanOrEqualTo(Date value) {
|
||||
addCriterion("`date` <=", value, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateIn(List<Date> values) {
|
||||
addCriterion("`date` in", values, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateNotIn(List<Date> values) {
|
||||
addCriterion("`date` not in", values, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateBetween(Date value1, Date value2) {
|
||||
addCriterion("`date` between", value1, value2, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDateNotBetween(Date value1, Date value2) {
|
||||
addCriterion("`date` not between", value1, value2, "date");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsIsNull() {
|
||||
addCriterion("uploads is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsIsNotNull() {
|
||||
addCriterion("uploads is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsEqualTo(String value) {
|
||||
addCriterion("uploads =", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsNotEqualTo(String value) {
|
||||
addCriterion("uploads <>", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsGreaterThan(String value) {
|
||||
addCriterion("uploads >", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("uploads >=", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsLessThan(String value) {
|
||||
addCriterion("uploads <", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsLessThanOrEqualTo(String value) {
|
||||
addCriterion("uploads <=", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsLike(String value) {
|
||||
addCriterion("uploads like", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsNotLike(String value) {
|
||||
addCriterion("uploads not like", value, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsIn(List<String> values) {
|
||||
addCriterion("uploads in", values, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsNotIn(List<String> values) {
|
||||
addCriterion("uploads not in", values, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsBetween(String value1, String value2) {
|
||||
addCriterion("uploads between", value1, value2, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUploadsNotBetween(String value1, String value2) {
|
||||
addCriterion("uploads not between", value1, value2, "uploads");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated do_not_delete_during_merge
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
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,71 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MntnDayStatKey {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column mntn_day_stat.term_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer termId;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column mntn_day_stat.date
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column mntn_day_stat.term_id
|
||||
*
|
||||
* @return the value of mntn_day_stat.term_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer getTermId() {
|
||||
return termId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column mntn_day_stat.term_id
|
||||
*
|
||||
* @param termId the value for mntn_day_stat.term_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setTermId(Integer termId) {
|
||||
this.termId = termId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column mntn_day_stat.date
|
||||
*
|
||||
* @return the value of mntn_day_stat.date
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column mntn_day_stat.date
|
||||
*
|
||||
* @param date the value for mntn_day_stat.date
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.shxy.xymanager_dao.dao;
|
||||
|
||||
import com.shxy.xymanager_common.entity.MntnDayStat;
|
||||
import com.shxy.xymanager_common.entity.MntnDayStatExample;
|
||||
import com.shxy.xymanager_common.entity.MntnDayStatKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MntnDayStatMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
long countByExample(MntnDayStatExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByExample(MntnDayStatExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByPrimaryKey(MntnDayStatKey key);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insert(MntnDayStat row);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insertSelective(MntnDayStat row);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
List<MntnDayStat> selectByExample(MntnDayStatExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
MntnDayStat selectByPrimaryKey(MntnDayStatKey key);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("row") MntnDayStat row, @Param("example") MntnDayStatExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExample(@Param("row") MntnDayStat row, @Param("example") MntnDayStatExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(MntnDayStat row);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table mntn_day_stat
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKey(MntnDayStat row);
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
<?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.shxy.xymanager_dao.dao.MntnDayStatMapper">
|
||||
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.MntnDayStat">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="term_id" jdbcType="INTEGER" property="termId" />
|
||||
<id column="date" jdbcType="TIMESTAMP" property="date" />
|
||||
<result column="uploads" jdbcType="VARCHAR" property="uploads" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<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">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<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">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
term_id, `date`, uploads
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.MntnDayStatExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from mntn_day_stat
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnDayStatKey" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from mntn_day_stat
|
||||
where term_id = #{termId,jdbcType=INTEGER}
|
||||
and `date` = #{date,jdbcType=TIMESTAMP}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnDayStatKey">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from mntn_day_stat
|
||||
where term_id = #{termId,jdbcType=INTEGER}
|
||||
and `date` = #{date,jdbcType=TIMESTAMP}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.shxy.xymanager_common.entity.MntnDayStatExample">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from mntn_day_stat
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.MntnDayStat">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into mntn_day_stat (term_id, `date`, uploads
|
||||
)
|
||||
values (#{termId,jdbcType=INTEGER}, #{date,jdbcType=TIMESTAMP}, #{uploads,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnDayStat">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into mntn_day_stat
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="termId != null">
|
||||
term_id,
|
||||
</if>
|
||||
<if test="date != null">
|
||||
`date`,
|
||||
</if>
|
||||
<if test="uploads != null">
|
||||
uploads,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="termId != null">
|
||||
#{termId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="date != null">
|
||||
#{date,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="uploads != null">
|
||||
#{uploads,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.MntnDayStatExample" resultType="java.lang.Long">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select count(*) from mntn_day_stat
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update mntn_day_stat
|
||||
<set>
|
||||
<if test="row.termId != null">
|
||||
term_id = #{row.termId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="row.date != null">
|
||||
`date` = #{row.date,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="row.uploads != null">
|
||||
uploads = #{row.uploads,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="example != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update mntn_day_stat
|
||||
set term_id = #{row.termId,jdbcType=INTEGER},
|
||||
`date` = #{row.date,jdbcType=TIMESTAMP},
|
||||
uploads = #{row.uploads,jdbcType=VARCHAR}
|
||||
<if test="example != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.MntnDayStat">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update mntn_day_stat
|
||||
<set>
|
||||
<if test="uploads != null">
|
||||
uploads = #{uploads,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where term_id = #{termId,jdbcType=INTEGER}
|
||||
and `date` = #{date,jdbcType=TIMESTAMP}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.MntnDayStat">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update mntn_day_stat
|
||||
set uploads = #{uploads,jdbcType=VARCHAR}
|
||||
where term_id = #{termId,jdbcType=INTEGER}
|
||||
and `date` = #{date,jdbcType=TIMESTAMP}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,54 @@
|
||||
package com.shxy.xymanager_framework.timeTask;
|
||||
|
||||
import com.shxy.xymanager_common.entity.Terminals;
|
||||
import com.shxy.xymanager_common.util.DateUtil;
|
||||
import com.shxy.xymanager_service.service.MntnDayStatService;
|
||||
import com.shxy.xymanager_service.service.NewCacheService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MntnDayStatTask {
|
||||
|
||||
@Resource
|
||||
MntnDayStatService dayStatService;
|
||||
@Resource
|
||||
NewCacheService newCacheService;
|
||||
|
||||
@Scheduled(cron = "0 0 10 * * ?")
|
||||
private void storeAll() {
|
||||
try {
|
||||
long total = dayStatService.countTotal();
|
||||
int days = 3;
|
||||
if (total <= 0) {
|
||||
days = 365;
|
||||
}
|
||||
Date today = DateUtil.getTodayZero();
|
||||
|
||||
Map<Integer, Terminals> terminalMap = newCacheService.getTerminalMap();
|
||||
Iterator<Integer> it = terminalMap.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Integer termId = it.next();
|
||||
this.storeOne(termId, today, days);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("MntnDayStatTask.storeAll error.", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void storeOne(Integer termId, Date today, int days) {
|
||||
Date date = today;
|
||||
for (int i = 0; i < days; i++) {
|
||||
dayStatService.storeOneDay(date, termId);
|
||||
date = DateUtil.addDay(date, -1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.shxy.xymanager_service.impl;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.shxy.xymanager_common.entity.*;
|
||||
import com.shxy.xymanager_common.model.StatTerm;
|
||||
import com.shxy.xymanager_dao.dao.MntnDayStatMapper;
|
||||
import com.shxy.xymanager_dao.dao.MntnRawReportsMapper;
|
||||
import com.shxy.xymanager_service.service.MntnDayStatService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MntnDayStatServiceImpl implements MntnDayStatService {
|
||||
|
||||
@Resource
|
||||
MntnDayStatMapper dayStatMapper;
|
||||
@Resource
|
||||
MntnRawReportsMapper rawReportsMapper;
|
||||
|
||||
@Override
|
||||
public long countTotal() {
|
||||
MntnDayStatExample example = new MntnDayStatExample();
|
||||
example.createCriteria();
|
||||
return dayStatMapper.countByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeOneDay(Date day, Integer termId) {
|
||||
Long start = day.getTime() / 1000;
|
||||
Long end = start + 60 * 60 * 24;
|
||||
|
||||
MntnRawReportsExample example = new MntnRawReportsExample();
|
||||
MntnRawReportsExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andTermIdEqualTo(termId);
|
||||
criteria.andCreateTimeGreaterThanOrEqualTo(start);
|
||||
criteria.andCreateTimeLessThan(end);
|
||||
example.setOrderByClause("create_time desc");
|
||||
PageHelper.startPage(1, 1);
|
||||
List<MntnRawReports> reportsList = rawReportsMapper.selectByExample(example);
|
||||
|
||||
if (!CollectionUtils.isEmpty(reportsList)) {
|
||||
MntnRawReports reports = reportsList.get(0);
|
||||
reports.makeRawReport();
|
||||
Object uploads = reports.getReportMap().get("uploads");
|
||||
|
||||
MntnDayStat stat = new MntnDayStat();
|
||||
stat.setTermId(termId);
|
||||
stat.setDate(day);
|
||||
if (uploads != null) {
|
||||
stat.setUploads(uploads.toString());
|
||||
}
|
||||
MntnDayStat old = dayStatMapper.selectByPrimaryKey(stat);
|
||||
if (old == null) {
|
||||
dayStatMapper.insert(stat);
|
||||
} else {
|
||||
dayStatMapper.updateByPrimaryKey(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface MntnDayStatService {
|
||||
|
||||
long countTotal();
|
||||
|
||||
void storeOneDay(Date day, Integer termId);
|
||||
}
|
Loading…
Reference in New Issue