综合销售情况表 查询合计值

This commit is contained in:
king
2026-03-23 16:38:05 +08:00
parent 73addd6656
commit e7bc45add5
14 changed files with 331 additions and 19 deletions

View File

@@ -0,0 +1,84 @@
package com.lideeyunji.core.framework.controller;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.core.framework.service.INewGrBiSaAggMonthCountService;
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
import com.lideeyunji.core.framework.utils.FuncWeb;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import com.lideeyunji.tool.framework.tenant.core.aop.TenantIgnore;
import com.lideeyunji.tool.framework.yunji.model.global.BaseWebResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
* 综合销售情况月维度Controller
*
* @author king
* @date 2026-03-19
*/
@TenantIgnore
@RestController
@RequestMapping(lideeYunJiBaseConstant.REQUEST_URL_START+"/agg/month")
public class NewGrBiSaAggMonthCountController extends BaseController
{
@Autowired
private INewGrBiSaAggMonthCountService newGrBiSaAggMonthCountService;
@Autowired
private INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
/**
* 查询综合销售情况月维度-总计
*/
// @PreAuthorize("@ss.hasPermi('agg:month:total:detail')")
@PostMapping("/total/detail")
public BaseWebResult getTotalDetail(HttpServletRequest req)
{
Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
SaAggParam saAggParam = new SaAggParam();
if (params.containsKey("usemonth")){
saAggParam.setUseMonth(params.get("usemonth").toString());
}
if(params.containsKey("useyear")){
saAggParam.setUseYear(params.get("useyear").toString());
}
if(params.containsKey("customname")){
saAggParam.setCustomName(Arrays.asList(params.get("customname").toString().split(",")));
}
if (params.containsKey("zonename")){
saAggParam.setZoneName(Arrays.asList(params.get("zonename").toString().split( ",")));
}
if (params.containsKey("saletypename")){
saAggParam.setSaleTypeName(Arrays.asList(params.get("saletypename").toString().split( ",")));
}
if (params.containsKey("salername")){
saAggParam.setSalerName(Arrays.asList(params.get("salername").toString().split( ",")));
}
if (params.containsKey("dosagename")){
saAggParam.setDosageName(Arrays.asList(params.get("dosagename").toString().split( ",")));
}
if (params.containsKey("stdGoodsName")){
saAggParam.setStdGoodsName(Arrays.asList(params.get("stdGoodsName").toString().split( ",")));
}
if (params.containsKey("usemonth")){
List<NewGrBiSaAggMonthCount> list = newGrBiSaAggMonthCountService.getTotalDetail(saAggParam);
return BaseWebResult.success(list);
}else{
List<NewGrBiSaAggYearCount> list = newGrBiSaAggYearCountService.getTotalDetail(saAggParam);
return BaseWebResult.success(list);
}
}
}

View File

@@ -0,0 +1,96 @@
package com.lideeyunji.core.framework.controller;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.core.framework.service.INewGrBiSaAggYearCountService;
import com.lideeyunji.core.framework.utils.FuncWeb;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import com.lideeyunji.tool.framework.tenant.core.aop.TenantIgnore;
import com.lideeyunji.tool.framework.yunji.model.global.BaseWebResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* 综合销售情况年维度Controller
*
* @author king
* @date 2026-03-19
*/
@TenantIgnore
@RestController
@RequestMapping(lideeYunJiBaseConstant.REQUEST_URL_START+"/agg/year")
public class NewGrBiSaAggYearCountController extends BaseController
{
@Autowired
private INewGrBiSaAggYearCountService newGrBiSaAggYearCountService;
// /**
// * 查询综合销售情况年维度-总计
// */
//// @PreAuthorize("@ss.hasPermi('agg:month:total:detail')")
// @PostMapping("/total/detail")
// public BaseWebResult getTotalDetail(HttpServletRequest req) {
// Map<String, Object> params = FuncWeb.getParameterBodyMap(req);
// SaAggParam saAggParam = new SaAggParam();
// String groupField = params.get("Group by").toString();
// LinkedList<String> groupFieldList = new LinkedList<>(Arrays.asList(groupField.split(",")));
//
// if (params.containsKey("useyear")) {
// saAggParam.setUseYear(params.get("useyear").toString());
// if (!groupField.contains("useyear")) {
// groupFieldList.addFirst("useyear");
// }
// }
// if (params.containsKey("customname")) {
// saAggParam.setCustomName(Arrays.asList(params.get("customname").toString().split( ",")));
// if (!groupField.contains("customname")) {
// groupFieldList.addLast("customname");
// }
// }
// if (params.containsKey("zonename")) {
// saAggParam.setZoneName(Arrays.asList(params.get("zonename").toString().split( ",")));
// if (!groupField.contains("zonename")) {
// groupFieldList.addLast("zonename");
// }
// }
// if (params.containsKey("saletypename")) {
// saAggParam.setSaleTypeName(Arrays.asList(params.get("saletypename").toString().split( ",")));
// if (!groupField.contains("saletypename")) {
// groupFieldList.addLast("saletypename");
// }
// }
//
// if (params.containsKey("salername")) {
// saAggParam.setSalerName(Arrays.asList(params.get("salername").toString().split( ",")));
// if (!groupField.contains("salername")) {
// groupFieldList.addLast("salername");
// }
// }
// if (params.containsKey("dosagename")) {
// saAggParam.setDosageName(Arrays.asList(params.get("dosagename").toString().split( ",")));
// if (!groupField.contains("dosagename")) {
// groupFieldList.addLast("dosagename");
// }
// }
// if (params.containsKey("stdGoodsName")) {
// saAggParam.setStdGoodsName(Arrays.asList(params.get("stdGoodsName").toString().split( ",")));
// if (!groupField.contains("stdGoodsName")) {
// groupFieldList.addLast("stdGoodsName");
// }
// }
// saAggParam.setGroupFieldList(groupFieldList);
// List<NewGrBiSaAggYearCount> list = newGrBiSaAggYearCountService.getTotalDetail(saAggParam);
// return BaseWebResult.success(list);
// }
}

View File

@@ -68,9 +68,8 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" ROUND(SUM(last_year_data.last_year_profit) / 10000, 2) AS lastYearProfit, \n");//上年毛利额(元) executePluginSql.append(" ROUND(SUM(last_year_data.last_year_profit) / 10000, 2) AS lastYearProfit, \n");//上年毛利额(元)
executePluginSql.append(" ROUND(SUM(last_year_data.last_year_cost) / 10000, 2) AS lastYearCost, \n"); //上年销售成本(元) executePluginSql.append(" ROUND(SUM(last_year_data.last_year_cost) / 10000, 2) AS lastYearCost, \n"); //上年销售成本(元)
// executePluginSql.append(" ROUND(avg(current_year_data.profit_change), 2) as profitchange, \n"); //毛利变动(元) // executePluginSql.append(" CONCAT(ROUND((max(total_year_data.this_year_sa_money_sum))/100000000 ,2), '亿') AS thissamoney_s, \n");
// executePluginSql.append(" ROUND(avg(current_year_data.profit_growth), 2) as profitgrowth, \n"); //毛利额增长率 // executePluginSql.append(" CONCAT(ROUND((max(total_year_data.this_year_profit_sum))/100000000 ,2), '亿') AS thisprofit_s, \n");
// executePluginSql.append(" ROUND(avg(current_year_data.this_profit_rate), 2) as thisprofitrate, \n"); //本年毛利率
executePluginSql.append(" COALESCE(ROUND(sum(current_year_data.this_year_sa_money) / SUM(total_year_data.this_year_sa_money_sum) * 100, 2), 0) AS this_year_sa_money_share, \n");//上年销售金额占比 executePluginSql.append(" COALESCE(ROUND(sum(current_year_data.this_year_sa_money) / SUM(total_year_data.this_year_sa_money_sum) * 100, 2), 0) AS this_year_sa_money_share, \n");//上年销售金额占比
executePluginSql.append(" COALESCE (ROUND( sum(current_year_data.this_year_profit)/SUM(total_year_data.this_year_profit_sum) * 100, 2), 0 ) as thisprofitshare, \n"); //本年毛利额占比 executePluginSql.append(" COALESCE (ROUND( sum(current_year_data.this_year_profit)/SUM(total_year_data.this_year_profit_sum) * 100, 2), 0 ) as thisprofitshare, \n"); //本年毛利额占比
executePluginSql.append(" -- 数量同比(原有) \n"); executePluginSql.append(" -- 数量同比(原有) \n");
@@ -157,7 +156,6 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" SUM(this_year_sa_money) AS this_year_sa_money_sum, \n"); executePluginSql.append(" SUM(this_year_sa_money) AS this_year_sa_money_sum, \n");
executePluginSql.append(" SUM(this_year_profit) AS this_year_profit_sum \n"); executePluginSql.append(" SUM(this_year_profit) AS this_year_profit_sum \n");
executePluginSql.append(" FROM new_gr_bi_sa_agg_year_count \n"); executePluginSql.append(" FROM new_gr_bi_sa_agg_year_count \n");
executePluginSql.append(" WHERE use_year = 2026 \n");
executePluginSql.append(" GROUP BY use_year) as total_year_data \n"); executePluginSql.append(" GROUP BY use_year) as total_year_data \n");
executePluginSql.append(" ON total_year_data.use_year = current_year_data.use_year \n"); executePluginSql.append(" ON total_year_data.use_year = current_year_data.use_year \n");
@@ -236,20 +234,21 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
if (groupFieldList.contains("stdGoodsName") || params.containsKey("stdGoodsName")) { //标准品名 if (groupFieldList.contains("stdGoodsName") || params.containsKey("stdGoodsName")) { //标准品名
executePluginSql.append(" current_month.std_goods_name as stdGoodsName, \n"); executePluginSql.append(" current_month.std_goods_name as stdGoodsName, \n");
} }
executePluginSql.append(" SUM(current_month.this_month_sa_qty) as thisMonthSaQty, "); //本月销售数量(件) executePluginSql.append(" SUM(current_month.this_month_sa_qty) as thisMonthSaQty, \n"); //本月销售数量(件)
executePluginSql.append(" ROUND(SUM(current_month.this_month_sa_money) / 10000, 2) as thisMonthSaMoney, "); //本月销售金额(元) executePluginSql.append(" ROUND(SUM(current_month.this_month_sa_money) / 10000, 2) as thisMonthSaMoney, \n"); //本月销售金额(元)
executePluginSql.append(" ROUND(SUM(current_month.this_month_profit) / 10000, 2) as thisMonthProfit, "); //本月毛利额(元) executePluginSql.append(" ROUND(SUM(current_month.this_month_profit) / 10000, 2) as thisMonthProfit, \n"); //本月毛利额(元)
executePluginSql.append(" ROUND(SUM(current_month.this_month_cost) / 10000, 2) as thisMonthCost, "); //本月成本(元) executePluginSql.append(" ROUND(SUM(current_month.this_month_cost) / 10000, 2) as thisMonthCost, \n"); //本月成本(元)
executePluginSql.append(" SUM(last_month_data.last_month_sa_qty) as lastMonthSaQty, "); //上月销售数量(件) executePluginSql.append(" SUM(last_month_data.last_month_sa_qty) as lastMonthSaQty, \n"); //上月销售数量(件)
executePluginSql.append(" ROUND(SUM(last_month_data.last_month_sa_money) / 10000, 2) as lastMonthSaMoney, "); //上月销售金额(元) executePluginSql.append(" ROUND(SUM(last_month_data.last_month_sa_money) / 10000, 2) as lastMonthSaMoney, \n"); //上月销售金额(元)
executePluginSql.append(" ROUND(SUM(last_month_data.last_month_profit) / 10000, 2) as lastMonthProfit, "); //上月毛利额(元) executePluginSql.append(" ROUND(SUM(last_month_data.last_month_profit) / 10000, 2) as lastMonthProfit, \n"); //上月毛利额(元)
executePluginSql.append(" ROUND(SUM(last_month_data.last_month_cost) / 10000, 2) as lastMonthCost, "); //上月成本(元) executePluginSql.append(" ROUND(SUM(last_month_data.last_month_cost) / 10000, 2) as lastMonthCost, \n"); //上月成本(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_sa_qty)/ 10000, 2) as yoyMonthSaQty, \n"); //同比月销售数量(件)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_sa_money) / 10000, 2) as yoyMonthSaMoney, \n"); //同比月销售金额(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_profit) / 10000, 2) as yoyMonthProfit, \n"); //同比月毛利额(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_cost) / 10000, 2) as yoyMonthCost, \n"); //同比月成本(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_sa_qty)/ 10000, 2) as yoyMonthSaQty, "); //同比月销售数量(件)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_sa_money) / 10000, 2) as yoyMonthSaMoney, "); //同比月销售金额(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_profit) / 10000, 2) as yoyMonthProfit, "); //同比月毛利额(元)
executePluginSql.append(" ROUND(SUM(yoy_month.yoy_month_cost) / 10000, 2) as yoyMonthCost, "); //同比月成本(元)
executePluginSql.append(" GROUP_CONCAT(DISTINCT current_month.province_id ORDER BY current_month.province_id SEPARATOR ',') as province_id, \n"); //行政区域ID executePluginSql.append(" GROUP_CONCAT(DISTINCT current_month.province_id ORDER BY current_month.province_id SEPARATOR ',') as province_id, \n"); //行政区域ID
executePluginSql.append(" GROUP_CONCAT(DISTINCT current_month.province_name ORDER BY current_month.province_name SEPARATOR ',') as province_name, \n"); //行政区域名称 executePluginSql.append(" GROUP_CONCAT(DISTINCT current_month.province_name ORDER BY current_month.province_name SEPARATOR ',') as province_name, \n"); //行政区域名称
executePluginSql.append(" CASE WHEN (CASE WHEN sum(yoy_month.yoy_month_sa_qty) = 0 THEN IF(sum(current_month.this_month_sa_qty) > 0, 100, 0)\n"); executePluginSql.append(" CASE WHEN (CASE WHEN sum(yoy_month.yoy_month_sa_qty) = 0 THEN IF(sum(current_month.this_month_sa_qty) > 0, 100, 0)\n");

View File

@@ -3,6 +3,7 @@ package com.lideeyunji.core.framework.entity;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@@ -149,7 +150,11 @@ public class NewGrBiSaAggMonthCount implements Serializable
private BigDecimal thisMonthProfitShare; private BigDecimal thisMonthProfitShare;
@TableField(value = "thissamoney_s")
private BigDecimal thissamoney_s;
@TableField(value = "thisprofit_s")
private BigDecimal thisprofit_s;
} }

View File

@@ -145,8 +145,10 @@ public class NewGrBiSaAggYearCount implements Serializable
@TableField(value = "this_year_profit_change") @TableField(value = "this_year_profit_change")
private BigDecimal thisYearProfitChange; private BigDecimal thisYearProfitChange;
@TableField(value = "this_year_sa_money_s")
private BigDecimal thisYearSaMoney_s;
@TableField(value = "this_year_profit_s")
private BigDecimal thisYearProfit_s;
} }

View File

@@ -1,8 +1,12 @@
package com.lideeyunji.core.framework.mapper; package com.lideeyunji.core.framework.mapper;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.params.SaAggParam;
import org.apache.ibatis.annotations.Param;
/** /**
* 综合销售情况月维度Mapper接口 * 综合销售情况月维度Mapper接口
@@ -59,4 +63,7 @@ public interface NewGrBiSaAggMonthCountMapper extends BaseMapper<NewGrBiSaAggMon
* @return 结果 * @return 结果
*/ */
public int deleteNewGrBiSaAggMonthCountByIds(Long[] ids); public int deleteNewGrBiSaAggMonthCountByIds(Long[] ids);
@DS(value = "#dataSourceType")
List<NewGrBiSaAggMonthCount> getTotalDetail(@Param("dataSourceType") String dataSourceType, @Param("saAggParam") SaAggParam saAggParam);
} }

View File

@@ -1,8 +1,12 @@
package com.lideeyunji.core.framework.mapper; package com.lideeyunji.core.framework.mapper;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lideeyunji.core.framework.params.SaAggParam;
import org.apache.ibatis.annotations.Param;
/** /**
* 综合销售情况年维度Mapper接口 * 综合销售情况年维度Mapper接口
@@ -59,4 +63,8 @@ public interface NewGrBiSaAggYearCountMapper extends BaseMapper<NewGrBiSaAggYear
* @return 结果 * @return 结果
*/ */
public int deleteNewGrBiSaAggYearCountByIds(Long[] ids); public int deleteNewGrBiSaAggYearCountByIds(Long[] ids);
@DS(value = "#dataSourceType")
List<NewGrBiSaAggYearCount> getTotalDetail(@Param("dataSourceType") String dataSourceType,@Param("saAggParam") SaAggParam saAggParam);
} }

View File

@@ -0,0 +1,19 @@
package com.lideeyunji.core.framework.params;
import lombok.Data;
import java.util.List;
@Data
public class SaAggParam {
private String useYear;
private String useMonth;
private List<String> customName;
private List<String> zoneName;
private List<String> saleTypeName;
private List<String> salerName;
private List<String> dosageName;
private List<String> stdGoodsName;
private List<String> groupFieldList;
}

View File

@@ -2,6 +2,7 @@ package com.lideeyunji.core.framework.service;
import java.util.List; import java.util.List;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
import com.lideeyunji.core.framework.params.SaAggParam;
/** /**
* 综合销售情况月维度Service接口 * 综合销售情况月维度Service接口
@@ -58,4 +59,6 @@ public interface INewGrBiSaAggMonthCountService
* @return 结果 * @return 结果
*/ */
public int deleteNewGrBiSaAggMonthCountById(Long id); public int deleteNewGrBiSaAggMonthCountById(Long id);
List<NewGrBiSaAggMonthCount> getTotalDetail(SaAggParam saAggParam);
} }

View File

@@ -2,6 +2,7 @@ package com.lideeyunji.core.framework.service;
import java.util.List; import java.util.List;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
import com.lideeyunji.core.framework.params.SaAggParam;
/** /**
* 综合销售情况年维度Service接口 * 综合销售情况年维度Service接口
@@ -58,4 +59,6 @@ public interface INewGrBiSaAggYearCountService
* @return 结果 * @return 结果
*/ */
public int deleteNewGrBiSaAggYearCountById(Long id); public int deleteNewGrBiSaAggYearCountById(Long id);
List<NewGrBiSaAggYearCount> getTotalDetail(SaAggParam saAggParam);
} }

View File

@@ -1,7 +1,10 @@
package com.lideeyunji.core.framework.service.impl; package com.lideeyunji.core.framework.service.impl;
import java.util.Collections;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMonthCountMapper; import com.lideeyunji.core.framework.mapper.NewGrBiSaAggMonthCountMapper;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount;
@@ -87,4 +90,9 @@ public class NewGrBiSaAggMonthCountServiceImpl extends ServiceImpl<NewGrBiSaAggM
{ {
return this.baseMapper.deleteNewGrBiSaAggMonthCountById(id); return this.baseMapper.deleteNewGrBiSaAggMonthCountById(id);
} }
@Override
public List<NewGrBiSaAggMonthCount> getTotalDetail(SaAggParam saAggParam) {
return this.baseMapper.getTotalDetail(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam);
}
} }

View File

@@ -1,7 +1,10 @@
package com.lideeyunji.core.framework.service.impl; package com.lideeyunji.core.framework.service.impl;
import java.util.Collections;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lideeyunji.core.framework.params.SaAggParam;
import com.lideeyunji.tool.framework.common.constant.lideeYunJiBaseConstant;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.lideeyunji.core.framework.mapper.NewGrBiSaAggYearCountMapper; import com.lideeyunji.core.framework.mapper.NewGrBiSaAggYearCountMapper;
import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount; import com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount;
@@ -87,4 +90,9 @@ public class NewGrBiSaAggYearCountServiceImpl extends ServiceImpl<NewGrBiSaAggYe
{ {
return this.baseMapper.deleteNewGrBiSaAggYearCountById(id); return this.baseMapper.deleteNewGrBiSaAggYearCountById(id);
} }
@Override
public List<NewGrBiSaAggYearCount> getTotalDetail(SaAggParam saAggParam) {
return this.baseMapper.getTotalDetail(lideeYunJiBaseConstant.DS_ERP_BI_DATA, saAggParam);
}
} }

View File

@@ -38,12 +38,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lastMonthProfitShare" column="last_month_profit_share" /> <result property="lastMonthProfitShare" column="last_month_profit_share" />
<result property="thisMonthSaMoneyShare" column="this_month_sa_money_share" /> <result property="thisMonthSaMoneyShare" column="this_month_sa_money_share" />
<result property="thisMonthProfitShare" column="this_month_profit_share" /> <result property="thisMonthProfitShare" column="this_month_profit_share" />
<result property="thissamoney_s" column="thissamoney_s" />
<result property="thisprofit_s" column="thisprofit_s" />
</resultMap> </resultMap>
<sql id="selectNewGrBiSaAggMonthCountVo"> <sql id="selectNewGrBiSaAggMonthCountVo">
select id, use_year, use_month, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, goods_id, std_goods_name, province_id, province_name, saler_id, saler_name, this_month_sa_qty, last_month_sa_qty, yoy_month_sa_qty, this_month_sa_money, last_month_sa_money, yoy_month_sa_money, this_month_profit, last_month_profit, yoy_month_profit, this_month_cost, last_month_cost, yoy_month_cost, this_month_profit_rate, last_month_profit_rate, last_month_profit_share, this_month_sa_money_share, this_month_profit_share from new_gr_bi_sa_agg_month_count select id, use_year, use_month, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, goods_id, std_goods_name, province_id, province_name, saler_id, saler_name, this_month_sa_qty, last_month_sa_qty, yoy_month_sa_qty, this_month_sa_money, last_month_sa_money, yoy_month_sa_money, this_month_profit, last_month_profit, yoy_month_profit, this_month_cost, last_month_cost, yoy_month_cost, this_month_profit_rate, last_month_profit_rate, last_month_profit_share, this_month_sa_money_share, this_month_profit_share from new_gr_bi_sa_agg_month_count
</sql> </sql>
<select id="getTotalDetail" parameterType="com.lideeyunji.core.framework.params.SaAggParam" resultMap="NewGrBiSaAggMonthCountResult">
SELECT
use_year,
SUM( this_month_sa_money ) AS thissamoney_s,
SUM( this_month_profit ) AS thisprofit_s
FROM new_gr_bi_sa_agg_month_count
<where>
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>
<if test="saAggParam.useMonth != null and saAggParam.useMonth != ''"> and use_month = #{saAggParam.useMonth}</if>
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
<foreach collection="saAggParam.zoneName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
<foreach collection="saAggParam.saleTypeName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.salerName != null and saAggParam.salerName != '' "> and saler_name in
<foreach collection="saAggParam.salerName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
<foreach collection="saAggParam.dosageName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.stdGoodsName != null and saAggParam.stdGoodsName != '' "> and std_goods_name in
<foreach item="field" collection="saAggParam.stdGoodsName" separator="," open="(" close=")">#{field}</foreach>
</if>
</where>
</select>
<select id="selectNewGrBiSaAggMonthCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" resultMap="NewGrBiSaAggMonthCountResult"> <select id="selectNewGrBiSaAggMonthCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" resultMap="NewGrBiSaAggMonthCountResult">
<include refid="selectNewGrBiSaAggMonthCountVo"/> <include refid="selectNewGrBiSaAggMonthCountVo"/>
<where> <where>

View File

@@ -37,12 +37,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="thisYearSaMoneyGrowth" column="this_year_sa_money_growth" /> <result property="thisYearSaMoneyGrowth" column="this_year_sa_money_growth" />
<result property="thisYearProfitGrowth" column="this_year_profit_growth" /> <result property="thisYearProfitGrowth" column="this_year_profit_growth" />
<result property="thisYearProfitChange" column="this_year_profit_change" /> <result property="thisYearProfitChange" column="this_year_profit_change" />
<result property="thisYearSaMoney_s" column="this_year_sa_money_s" />
<result property="thisYearProfit_s" column="this_year_profit_s" />
</resultMap> </resultMap>
<sql id="selectNewGrBiSaAggYearCountVo"> <sql id="selectNewGrBiSaAggYearCountVo">
select id, use_year, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, std_goods_name, province_id, province_name, saler_id, saler_name, this_year_sa_qty, last_year_sa_qty, this_year_sa_money, last_year_sa_money, this_year_profit, last_year_profit, this_year_cost, last_year_cost, this_year_profit_rate, last_year_profit_rate, this_year_profit_share, last_year_profit_share, this_year_sa_money_share, last_year_sa_money_share, this_year_sa_money_growth, this_year_profit_growth, this_year_profit_change from new_gr_bi_sa_agg_year_count select id, use_year, zone_id, zone_name, sale_type_id, sale_type_name, custom_id, custom_name, dosage_id, dosage_name, std_goods_name, province_id, province_name, saler_id, saler_name, this_year_sa_qty, last_year_sa_qty, this_year_sa_money, last_year_sa_money, this_year_profit, last_year_profit, this_year_cost, last_year_cost, this_year_profit_rate, last_year_profit_rate, this_year_profit_share, last_year_profit_share, this_year_sa_money_share, last_year_sa_money_share, this_year_sa_money_growth, this_year_profit_growth, this_year_profit_change from new_gr_bi_sa_agg_year_count
</sql> </sql>
<select id="getTotalDetail" parameterType="com.lideeyunji.core.framework.params.SaAggParam" resultMap="NewGrBiSaAggYearCountResult">
SELECT
use_year,
SUM( this_year_sa_money ) AS this_year_sa_money_s,
SUM( this_year_profit ) AS this_year_profit_s
FROM new_gr_bi_sa_agg_year_count
<where>
<if test="saAggParam.useYear != null and saAggParam.useYear != ''"> and use_year = #{saAggParam.useYear}</if>
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
<foreach collection="saAggParam.customName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
<foreach collection="saAggParam.zoneName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
<foreach collection="saAggParam.saleTypeName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.salerName != null and saAggParam.salerName != '' "> and saler_name in
<foreach collection="saAggParam.salerName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
<foreach collection="saAggParam.dosageName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
<if test="saAggParam.stdGoodsName != null and saAggParam.stdGoodsName != '' "> and std_goods_name in
<foreach collection="saAggParam.stdGoodsName" item="field" separator="," open="(" close=")">#{field}</foreach>
</if>
</where>
<!-- <if test="saAggParam.groupFieldList != null and saAggParam.groupFieldList.size() > 0">-->
<!-- &lt;!&ndash; 这里根据前端传入的参数拼接动态的 GROUP BY 子句 &ndash;&gt;-->
<!-- GROUP BY-->
<!-- <foreach item="field" collection="saAggParam.groupFieldList" separator=",">-->
<!-- #{field}-->
<!-- </foreach>-->
<!-- </if>-->
</select>
<select id="selectNewGrBiSaAggYearCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" resultMap="NewGrBiSaAggYearCountResult"> <select id="selectNewGrBiSaAggYearCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" resultMap="NewGrBiSaAggYearCountResult">
<include refid="selectNewGrBiSaAggYearCountVo"/> <include refid="selectNewGrBiSaAggYearCountVo"/>
<where> <where>