Commit 4304a011 by yinyong

周转销量大于过去7天 50%权重 14天50%权重取7、14平均销量加配置增量百分比

parent 1b9affdf
package com.bailuntec.domain.entity;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class DcAutoUprushConfig {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_uprush_config.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_uprush_config.warehouse_code
*
* @mbg.generated
*/
private String warehouseCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_uprush_config.percentage
*
* @mbg.generated
*/
private BigDecimal percentage;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
@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(", warehouseCode=").append(warehouseCode);
sb.append(", percentage=").append(percentage);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DcAutoUprushConfig other = (DcAutoUprushConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getWarehouseCode() == null ? other.getWarehouseCode() == null : this.getWarehouseCode().equals(other.getWarehouseCode()))
&& (this.getPercentage() == null ? other.getPercentage() == null : this.getPercentage().equals(other.getPercentage()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getWarehouseCode() == null) ? 0 : getWarehouseCode().hashCode());
result = prime * result + ((getPercentage() == null) ? 0 : getPercentage().hashCode());
return result;
}
}
\ No newline at end of file
package com.bailuntec.domain.example;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class DcAutoUprushConfigExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Integer offset;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Integer rows;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public DcAutoUprushConfigExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @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 dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @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 dc_auto_uprush_config
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
rows = null;
offset = null;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
DcAutoUprushConfigExample example = new DcAutoUprushConfigExample();
return example.createCriteria();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample when(boolean condition, IExampleWhen then) {
if (condition) {
then.example(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) {
if (condition) {
then.example(this);
} else {
otherwise.example(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void setOffset(Integer offset) {
this.offset = offset;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Integer getOffset() {
return this.offset;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public void setRows(Integer rows) {
this.rows = rows;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Integer getRows() {
return this.rows;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample limit(Integer rows) {
this.rows = rows;
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample limit(Integer offset, Integer rows) {
this.offset = offset;
this.rows = rows;
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample page(Integer page, Integer pageSize) {
this.offset = page * pageSize;
this.rows = pageSize;
return this;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andWarehouseCodeIsNull() {
addCriterion("warehouse_code is null");
return (Criteria) this;
}
public Criteria andWarehouseCodeIsNotNull() {
addCriterion("warehouse_code is not null");
return (Criteria) this;
}
public Criteria andWarehouseCodeEqualTo(String value) {
addCriterion("warehouse_code =", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeNotEqualTo(String value) {
addCriterion("warehouse_code <>", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeGreaterThan(String value) {
addCriterion("warehouse_code >", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeGreaterThanOrEqualTo(String value) {
addCriterion("warehouse_code >=", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeLessThan(String value) {
addCriterion("warehouse_code <", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeLessThanOrEqualTo(String value) {
addCriterion("warehouse_code <=", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeLike(String value) {
addCriterion("warehouse_code like", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeNotLike(String value) {
addCriterion("warehouse_code not like", value, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeIn(List<String> values) {
addCriterion("warehouse_code in", values, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeNotIn(List<String> values) {
addCriterion("warehouse_code not in", values, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeBetween(String value1, String value2) {
addCriterion("warehouse_code between", value1, value2, "warehouseCode");
return (Criteria) this;
}
public Criteria andWarehouseCodeNotBetween(String value1, String value2) {
addCriterion("warehouse_code not between", value1, value2, "warehouseCode");
return (Criteria) this;
}
public Criteria andPercentageIsNull() {
addCriterion("percentage is null");
return (Criteria) this;
}
public Criteria andPercentageIsNotNull() {
addCriterion("percentage is not null");
return (Criteria) this;
}
public Criteria andPercentageEqualTo(BigDecimal value) {
addCriterion("percentage =", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageNotEqualTo(BigDecimal value) {
addCriterion("percentage <>", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageGreaterThan(BigDecimal value) {
addCriterion("percentage >", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("percentage >=", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageLessThan(BigDecimal value) {
addCriterion("percentage <", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageLessThanOrEqualTo(BigDecimal value) {
addCriterion("percentage <=", value, "percentage");
return (Criteria) this;
}
public Criteria andPercentageIn(List<BigDecimal> values) {
addCriterion("percentage in", values, "percentage");
return (Criteria) this;
}
public Criteria andPercentageNotIn(List<BigDecimal> values) {
addCriterion("percentage not in", values, "percentage");
return (Criteria) this;
}
public Criteria andPercentageBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("percentage between", value1, value2, "percentage");
return (Criteria) this;
}
public Criteria andPercentageNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("percentage not between", value1, value2, "percentage");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private DcAutoUprushConfigExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(DcAutoUprushConfigExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public DcAutoUprushConfigExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
@Deprecated
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria when(boolean condition, ICriteriaWhen then) {
if (condition) {
then.criteria(this);
}
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) {
if (condition) {
then.criteria(this);
} else {
otherwise.criteria(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
@Deprecated
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table dc_auto_uprush_config
*
* @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);
}
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaWhen {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
void criteria(Criteria criteria);
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface IExampleWhen {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
void example(DcAutoUprushConfigExample example);
}
}
\ No newline at end of file
......@@ -7,7 +7,9 @@ import com.bailuntec.domain.entity.DcAutoTurnover;
import com.bailuntec.domain.example.DcAutoSalesExample;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface DcAutoSalesMapper {
/**
......@@ -125,7 +127,11 @@ public interface DcAutoSalesMapper {
*/
int upsertSelective(DcAutoSales record);
SalesVolumeDTO getSalesVolumeDTO(@Param("queryTime") String queryTime, @Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode);
Map<String, BigDecimal> getSalesAvg(@Param("queryTime") String queryTime, @Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode);
SalesVolumeDTO getSalesVolumeDTONoCompare(@Param("queryTime") String queryTime, @Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode);
SalesVolumeDTO getSalesVolumeDTO(@Param("queryTime") String queryTime, @Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode, @Param("compareSales") BigDecimal compareSales);
SalesVolumeAvgDTO getPlatformHistorySales( @Param("bailunSku") String bailunSku,@Param("warehouseCode") String warehouseCode,@Param("platform") String platform);
}
\ No newline at end of file
......@@ -2388,6 +2388,22 @@
limit 1
</select>
<select id="getSalesAvg" resultType="java.util.Map">
SELECT
sum(case when paid_time &lt; #{queryTime} and paid_time &gt;= DATE_SUB(#{queryTime}, INTERVAL 7 DAY) then bailun_sku_quantity_ordered else 0 end) as 'seven_sales' ,
sum(case when paid_time &lt; #{queryTime} and paid_time &gt;= DATE_SUB(#{queryTime}, INTERVAL 14 DAY) then bailun_sku_quantity_ordered else 0 end) as 'fourteen_sales'
FROM `dc_base_oms_sku`
where paid_time &gt;= DATE_SUB(#{queryTime}, INTERVAL 14 DAY)
and paid_time &lt; #{queryTime}
and bailun_order_status != 'Canceled'
and has_fba_s = 0
and has_delete = 0
and has_scalp = 0
and has_innersale = 0
and bailun_sku = #{bailunSku}
and warehouse_code = #{warehouseCode}
</select>
<select id="getSalesVolumeDTO" resultType="com.bailuntec.domain.dto.SalesVolumeDTO">
SELECT bailun_sku, warehouse_code,warehouse_name,title, bailun_category_id as category_id,
thirtyday_sales,twenty_nineday_sales,twenty_eightday_sales,twenty_seveneday_sales,twenty_sixday_sales,twenty_fiveday_sales,twenty_fourthday_sales,twenty_threeday_sales,twenty_twoday_sales,twenty_oneday_sales
......@@ -2398,6 +2414,58 @@
,tenday_sales,nineday_sales,eightday_sales,sevenday_sales,sixday_sales,fiveday_sales,fourthday_sales,threeday_sales,twoday_sales,oneday_sales) as 'history_sales'
from
(SELECT bailun_sku, warehouse_code,warehouse_name,bailun_sku_title_cn title, bailun_category_id,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 1 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 1 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'oneday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 2 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 2 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twoday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 3 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 3 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'threeday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 4 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 4 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'fourthday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 5 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 5 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'fiveday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 6 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 6 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'sixday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 7 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 7 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'sevenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 8 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 8 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'eightday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 9 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 9 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'nineday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 10 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 10 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'tenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 11 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 11 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'elevenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 12 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 12 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twelveday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 13 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 13 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'thridteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 14 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 14 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'fourteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 15 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 15 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'fifteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 16 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 16 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'sixteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 17 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 17 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'seventeenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 18 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 18 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'eighteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 19 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 19 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'nineteenday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 20 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 20 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twentyday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 21 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 21 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_oneday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 22 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 22 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_twoday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 23 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 23 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_threeday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 24 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 24 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_fourthday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 25 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 25 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_fiveday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 26 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 26 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_sixday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 27 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 27 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_seveneday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 28 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 28 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_eightday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 29 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 29 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'twenty_nineday_sales' ,
if(sum(case when (DATE_SUB(#{queryTime}, INTERVAL 30 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) &gt; #{compareSales}, #{compareSales}, sum(case when (DATE_SUB(#{queryTime}, INTERVAL 30 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end)) as 'thirtyday_sales'
FROM `dc_base_oms_sku`
where paid_time >= DATE_SUB(#{queryTime}, INTERVAL 30 DAY)
and paid_time &lt; #{queryTime}
and bailun_order_status != 'Canceled'
and has_fba_s = 0
and has_delete = 0
and has_scalp = 0
and has_innersale = 0
and bailun_sku = #{bailunSku}
and warehouse_code = #{warehouseCode}) sales_table
</select>
<select id="getSalesVolumeDTONoCompare" resultType="com.bailuntec.domain.dto.SalesVolumeDTO">
SELECT bailun_sku, warehouse_code,warehouse_name,title, bailun_category_id as category_id,
thirtyday_sales,twenty_nineday_sales,twenty_eightday_sales,twenty_seveneday_sales,twenty_sixday_sales,twenty_fiveday_sales,twenty_fourthday_sales,twenty_threeday_sales,twenty_twoday_sales,twenty_oneday_sales
,twentyday_sales,nineteenday_sales,eighteenday_sales,seventeenday_sales,sixteenday_sales,fifteenday_sales,fourteenday_sales,thridteenday_sales,twelveday_sales,elevenday_sales
,tenday_sales,nineday_sales,eightday_sales,sevenday_sales,sixday_sales,fiveday_sales,fourthday_sales,threeday_sales,twoday_sales,oneday_sales,
CONCAT_WS(',', thirtyday_sales,twenty_nineday_sales,twenty_eightday_sales,twenty_seveneday_sales,twenty_sixday_sales,twenty_fiveday_sales,twenty_fourthday_sales,twenty_threeday_sales,twenty_twoday_sales,twenty_oneday_sales
,twentyday_sales,nineteenday_sales,eighteenday_sales,seventeenday_sales,sixteenday_sales,fifteenday_sales,fourteenday_sales,thridteenday_sales,twelveday_sales,elevenday_sales
,tenday_sales,nineday_sales,eightday_sales,sevenday_sales,sixday_sales,fiveday_sales,fourthday_sales,threeday_sales,twoday_sales,oneday_sales) as 'history_sales'
from
(SELECT bailun_sku, warehouse_code,warehouse_name,bailun_sku_title_cn title, bailun_category_id,
sum(case when (platform_type = 'Aliexpress' and paid_time &gt;= '2019-11-11 16:00:00' and paid_time &lt;= '2019-11-13 16:00:00') then 0 when (DATE_SUB(#{queryTime}, INTERVAL 1 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) as 'oneday_sales' ,
sum(case when (platform_type = 'Aliexpress' and paid_time &gt;= '2019-11-11 16:00:00' and paid_time &lt;= '2019-11-13 16:00:00') then 0 when (DATE_SUB(#{queryTime}, INTERVAL 2 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) as 'twoday_sales' ,
sum(case when (platform_type = 'Aliexpress' and paid_time &gt;= '2019-11-11 16:00:00' and paid_time &lt;= '2019-11-13 16:00:00') then 0 when (DATE_SUB(#{queryTime}, INTERVAL 3 DAY) = DATE_FORMAT(paid_time,'%Y-%m-%d')) then bailun_sku_quantity_ordered else 0 end) as 'threeday_sales' ,
......@@ -2439,6 +2507,7 @@
and bailun_sku = #{bailunSku}
and warehouse_code = #{warehouseCode}) sales_table
</select>
<select id="getPlatformHistorySales" resultType="com.bailuntec.domain.dto.SalesVolumeAvgDTO">
SELECT
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'sevenday_sales',
......
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcAutoUprushConfig;
import com.bailuntec.domain.example.DcAutoUprushConfigExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DcAutoUprushConfigMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
long countByExample(DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int deleteByExample(DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int insert(DcAutoUprushConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int insertSelective(DcAutoUprushConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcAutoUprushConfig selectOneByExample(DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
List<DcAutoUprushConfig> selectByExample(DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
DcAutoUprushConfig selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcAutoUprushConfig record, @Param("example") DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcAutoUprushConfig record, @Param("example") DcAutoUprushConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcAutoUprushConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
*/
int updateByPrimaryKey(DcAutoUprushConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcAutoUprushConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_uprush_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcAutoUprushConfig record);
}
\ No newline at end of file
<?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.bailuntec.mapper.DcAutoUprushConfigMapper">
<resultMap id="BaseResultMap" type="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" />
<result column="percentage" jdbcType="DECIMAL" property="percentage" />
</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.
-->
id, warehouse_code, percentage
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcAutoUprushConfigExample" 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 dc_auto_uprush_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="rows != null">
<if test="offset != null">
limit ${offset}, ${rows}
</if>
<if test="offset == null">
limit ${rows}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from dc_auto_uprush_config
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from dc_auto_uprush_config
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.bailuntec.domain.example.DcAutoUprushConfigExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from dc_auto_uprush_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into dc_auto_uprush_config (id, warehouse_code, percentage
)
values (#{id,jdbcType=INTEGER}, #{warehouseCode,jdbcType=VARCHAR}, #{percentage,jdbcType=DECIMAL}
)
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into dc_auto_uprush_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="warehouseCode != null">
warehouse_code,
</if>
<if test="percentage != null">
percentage,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="warehouseCode != null">
#{warehouseCode,jdbcType=VARCHAR},
</if>
<if test="percentage != null">
#{percentage,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcAutoUprushConfigExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from dc_auto_uprush_config
<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 dc_auto_uprush_config
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.warehouseCode != null">
warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
</if>
<if test="record.percentage != null">
percentage = #{record.percentage,jdbcType=DECIMAL},
</if>
</set>
<if test="_parameter != 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 dc_auto_uprush_config
set id = #{record.id,jdbcType=INTEGER},
warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
percentage = #{record.percentage,jdbcType=DECIMAL}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dc_auto_uprush_config
<set>
<if test="warehouseCode != null">
warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
</if>
<if test="percentage != null">
percentage = #{percentage,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dc_auto_uprush_config
set warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
percentage = #{percentage,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
insert into dc_auto_uprush_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="warehouseCode != null">
warehouse_code,
</if>
<if test="percentage != null">
percentage,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="warehouseCode != null">
#{warehouseCode,jdbcType=VARCHAR},
</if>
<if test="percentage != null">
#{percentage,jdbcType=DECIMAL},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
<if test="warehouseCode != null">
warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
</if>
<if test="percentage != null">
percentage = #{percentage,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcAutoUprushConfig">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
insert into dc_auto_uprush_config
(id, warehouse_code, percentage)
values
(#{id,jdbcType=INTEGER}, #{warehouseCode,jdbcType=VARCHAR}, #{percentage,jdbcType=DECIMAL}
)
on duplicate key update
id = #{id,jdbcType=INTEGER},
warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
percentage = #{percentage,jdbcType=DECIMAL}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcAutoUprushConfigExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from dc_auto_uprush_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -145,8 +145,25 @@ public class AutoTurnoverJob extends PointJob {
String warehouseCode = dcBaseStock.getWarehouseCode();
DcAutoSales dcAutoSales = null;
try {
DcAutoSalesMapper autoSalesMapper = SessionUtil.getSession().getMapper(DcAutoSalesMapper.class);
SalesVolumeDTO salesVolumeDTO = autoSalesMapper.getSalesVolumeDTO(queryTime, bailunSku, warehouseCode);
BigDecimal incrementalRatio = BigDecimal.ONE;
BigDecimal compareSales = BigDecimal.ZERO;
DcAutoSalesMapper autoSalesMapper = null;
SalesVolumeDTO salesVolumeDTO = null;
autoSalesMapper = SessionUtil.getSession().getMapper(DcAutoSalesMapper.class);
Map<String, BigDecimal> map = autoSalesMapper.getSalesAvg(queryTime, bailunSku, warehouseCode);
DcAutoUprushConfigMapper dcAutoUprushConfigMapper = SessionUtil.getSession().getMapper(DcAutoUprushConfigMapper.class);
DcAutoUprushConfig dcAutoUprushConfig = dcAutoUprushConfigMapper.selectOneByExample(DcAutoUprushConfigExample.newAndCreateCriteria().andWarehouseCodeEqualTo(warehouseCode).example());
if(dcAutoUprushConfig != null && map != null) {
incrementalRatio = incrementalRatio.add(dcAutoUprushConfig.getPercentage());
compareSales = (map.get("seven_sales").add(map.get("fourteen_sales"))).divide(BigDecimal.valueOf(2), RoundingMode.HALF_EVEN).multiply(incrementalRatio);
}
autoSalesMapper = SessionUtil.getSession().getMapper(DcAutoSalesMapper.class);
if(compareSales.compareTo(BigDecimal.ZERO) == 0) {
salesVolumeDTO = autoSalesMapper.getSalesVolumeDTONoCompare(queryTime, bailunSku, warehouseCode);
}else {
salesVolumeDTO = autoSalesMapper.getSalesVolumeDTO(queryTime, bailunSku, warehouseCode, compareSales);
}
if (StringUtils.isEmpty(salesVolumeDTO.getHistorySales().trim())) {
DcAutoSalesMapper dcAutoSalesMapper = SessionUtil.getSession().getMapper(DcAutoSalesMapper.class);
dcAutoSales = new DcAutoSales(bailunSku, warehouseCode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment