综合销售情况表 新增标准品名,新增标准品名分组

This commit is contained in:
king
2026-03-20 16:38:27 +08:00
parent 1b86125114
commit bac64da6d8
8 changed files with 66 additions and 89 deletions

View File

@@ -53,9 +53,8 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" current_year_data.dosage_id, \n");
executePluginSql.append(" current_year_data.dosage_name as dosagename, \n");
}
if (params.containsKey("goodsname")) { //品名
executePluginSql.append(" current_year_data.goods_id, \n");
executePluginSql.append(" current_year_data.goods_name as goodsname, \n");
if (params.containsKey("stdGoodsName")) { //标准品名
executePluginSql.append(" current_year_data.std_goods_name as stdGoodsName, \n");
}
executePluginSql.append(" GROUP_CONCAT(DISTINCT current_year_data.province_id ORDER BY current_year_data.province_id SEPARATOR ',') as province_id, \n"); //行政区域ID
executePluginSql.append(" GROUP_CONCAT(DISTINCT current_year_data.province_name ORDER BY current_year_data.province_name SEPARATOR ',') as province_name, \n"); //行政区域名称
@@ -126,12 +125,12 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" FROM \n");
executePluginSql.append(" new_gr_bi_sa_agg_year_count as current_year_data \n");
executePluginSql.append(" LEFT JOIN (SELECT use_year, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id, \n");
executePluginSql.append(" SUM(this_year_sa_qty) AS last_year_sa_qty, \n");
executePluginSql.append(" SUM(this_year_sa_money) AS last_year_sa_money, \n");
@@ -139,14 +138,14 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" SUM(this_year_profit) AS last_year_profit \n");
executePluginSql.append(" FROM new_gr_bi_sa_agg_year_count \n");
executePluginSql.append(" GROUP BY use_year, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id) AS last_year_data \n");
executePluginSql.append(" ON current_year_data.goods_id = last_year_data.goods_id \n");
executePluginSql.append(" ON current_year_data.std_goods_name = last_year_data.std_goods_name \n");
executePluginSql.append(" AND current_year_data.zone_id = last_year_data.zone_id \n");
executePluginSql.append(" AND current_year_data.province_id = last_year_data.province_id \n");
executePluginSql.append(" AND current_year_data.sale_type_id = last_year_data.sale_type_id \n");
@@ -189,9 +188,8 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" current_year_data.dosage_id,");
executePluginSql.append(" current_year_data.dosage_name,");
}
if (params.containsKey("goodsname")) { //品名
executePluginSql.append(" current_year_data.goods_id,");
executePluginSql.append(" current_year_data.goods_name,");
if (params.containsKey("stdGoodsName")) { //标准品名
executePluginSql.append(" current_year_data.std_goods_name as stdGoodsName,");
}
executePluginSql.deleteCharAt(executePluginSql.length() - 1);
@@ -235,9 +233,8 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" current_month.dosage_id, \n");
executePluginSql.append(" current_month.dosage_name as dosagename, \n");
}
if (params.containsKey("goodsname")) { //品名
executePluginSql.append(" current_month.goods_id, \n");
executePluginSql.append(" current_month.goods_name as goodsname, \n");
if (params.containsKey("stdGoodsName")) { //标准品名
executePluginSql.append(" current_month.std_goods_name as stdGoodsName, \n");
}
executePluginSql.append(" SUM(current_month.this_month_sa_qty) as thisMonthSaQty, "); //本月销售数量(件)
executePluginSql.append(" ROUND(SUM(current_month.this_month_sa_money) / 10000, 2) as thisMonthSaMoney, "); //本月销售金额(元)
@@ -316,12 +313,12 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" LEFT JOIN (SELECT \n");
executePluginSql.append(" use_year, \n");
executePluginSql.append(" use_month, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id, \n");
executePluginSql.append(" SUM(this_month_sa_qty) AS last_month_sa_qty, \n");
executePluginSql.append(" SUM(this_month_sa_money) AS last_month_sa_money, \n");
@@ -330,14 +327,14 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" FROM new_gr_bi_sa_agg_month_count \n");
executePluginSql.append(" GROUP BY use_year, \n");
executePluginSql.append(" use_month, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id) AS last_month_data \n");
executePluginSql.append(" ON current_month.goods_id = last_month_data.goods_id \n");
executePluginSql.append(" ON current_month.std_goods_name = last_month_data.std_goods_name \n");
executePluginSql.append(" AND current_month.zone_id = last_month_data.zone_id \n");
executePluginSql.append(" AND current_month.province_id = last_month_data.province_id \n");
executePluginSql.append(" AND current_month.sale_type_id = last_month_data.sale_type_id \n");
@@ -348,12 +345,12 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" AND last_month_data.use_month = IF(current_month.use_month = 1, 12, current_month.use_month - 1)\n");
executePluginSql.append(" LEFT JOIN (SELECT use_year, \n");
executePluginSql.append(" use_month, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id, \n");
executePluginSql.append(" SUM(this_month_sa_qty) AS yoy_month_sa_qty, \n"); // 同比月销量
executePluginSql.append(" SUM(this_month_sa_money) AS yoy_month_sa_money, \n"); // 同比月销售金额
@@ -365,15 +362,15 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
// }
executePluginSql.append(" GROUP BY use_year, \n");
executePluginSql.append(" use_month, \n");
executePluginSql.append(" goods_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" zone_id, \n");
executePluginSql.append(" std_goods_name, \n");
executePluginSql.append(" province_id, \n");
executePluginSql.append(" sale_type_id, \n");
executePluginSql.append(" dosage_id, \n");
executePluginSql.append(" custom_id, \n");
executePluginSql.append(" saler_id) yoy_month ON yoy_month.use_year = current_month.use_year - 1 \n");
executePluginSql.append(" AND yoy_month.use_month = current_month.use_month \n");
executePluginSql.append(" AND yoy_month.goods_id = current_month.goods_id \n");
executePluginSql.append(" AND yoy_month.std_goods_name = current_month.std_goods_name \n");
executePluginSql.append(" AND yoy_month.zone_id = current_month.zone_id \n");
executePluginSql.append(" AND yoy_month.province_id = current_month.province_id \n");
executePluginSql.append(" AND yoy_month.sale_type_id = current_month.sale_type_id \n");
@@ -427,9 +424,8 @@ public class zhxsqkLineReportEnhance implements ReportBeforeAdvicePlugin {
executePluginSql.append(" current_month.dosage_id,");
executePluginSql.append(" current_month.dosage_name,");
}
if (params.containsKey("goodsname")) { //品名
executePluginSql.append(" current_month.goods_id,");
executePluginSql.append(" current_month.goods_name,");
if (params.containsKey("stdGoodsName")) { //标准品名
executePluginSql.append(" current_month.std_goods_name as stdGoodsName,");
}
executePluginSql.deleteCharAt(executePluginSql.length() - 1);

View File

@@ -69,6 +69,9 @@ public class NewGrBiSaAgg implements Serializable
@TableField(value = "goods_name")
private String goodsName;
@TableField(value = "std_goods_name")
private String stdGoodsName;
@TableField(value = "province_id")
private Long provinceId;

View File

@@ -61,13 +61,8 @@ public class NewGrBiSaAggMonthCount implements Serializable
@TableField(value = "dosage_name")
private String dosageName;
@TableField(value = "goods_id")
private Long goodsId;
@TableField(value = "goods_name")
private String goodsName;
@TableField(value = "std_goods_name")
private String stdGoodsName;
@TableField(value = "province_id")

View File

@@ -58,12 +58,8 @@ public class NewGrBiSaAggYearCount implements Serializable
private String dosageName;
@TableField(value = "goods_id")
private Long goodsId;
@TableField(value = "goods_name")
private String goodsName;
@TableField(value = "std_goods_name")
private String stdGoodsName;
@TableField(value = "province_id")

View File

@@ -39,6 +39,7 @@ public interface NewGrBiSaAggMapper extends BaseMapper<NewGrBiSaAgg>
// void updateThisYearData();
//
// void updateLastYearData();
//批量明细的 月度数据
void updateLastMonthSamoney();
void updateYoyMonthData();

View File

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.USEMONTH as use_month,
goods.goodsid as goods_id,
goods.GOODSNAME as goods_name,
goods.STDGOODSNAME as std_goods_name,
sales.SALEZONEID as zone_id,
sales.SALEZONENAME as zone_name,
province.PROVINCEID as province_id,
@@ -124,8 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,
@@ -145,8 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,
@@ -169,8 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,
@@ -189,8 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,
@@ -209,8 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,
@@ -232,8 +228,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
custom_name,
dosage_id,
dosage_name,
goods_id,
goods_name,
std_goods_name,
province_id,
province_name,
saler_id,

View File

@@ -16,8 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="customName" column="custom_name" />
<result property="dosageId" column="dosage_id" />
<result property="dosageName" column="dosage_name" />
<result property="goodsId" column="goods_id" />
<result property="goodsName" column="goods_name" />
<result property="stdGoodsName" column="std_goods_name" />
<result property="provinceId" column="province_id" />
<result property="provinceName" column="province_name" />
<result property="salerId" column="saler_id" />
@@ -42,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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, 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>
<select id="selectNewGrBiSaAggMonthCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" resultMap="NewGrBiSaAggMonthCountResult">
@@ -58,8 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null and customName != ''"> and custom_name like concat('%', #{customName}, '%')</if>
<if test="dosageId != null "> and dosage_id = #{dosageId}</if>
<if test="dosageName != null and dosageName != ''"> and dosage_name like concat('%', #{dosageName}, '%')</if>
<if test="goodsId != null "> and goods_id = #{goodsId}</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="stdGoodsName != null and stdGoodsName != ''"> and std_goods_name like concat('%', #{stdGoodsName}, '%')</if>
<if test="provinceId != null "> and province_id = #{provinceId}</if>
<if test="provinceName != null and provinceName != ''"> and province_name like concat('%', #{provinceName}, '%')</if>
<if test="salerId != null "> and saler_id = #{salerId}</if>
@@ -102,8 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null">custom_name,</if>
<if test="dosageId != null">dosage_id,</if>
<if test="dosageName != null">dosage_name,</if>
<if test="goodsId != null">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="stdGoodsName != null">std_goods_name,</if>
<if test="provinceId != null">province_id,</if>
<if test="provinceName != null">province_name,</if>
<if test="salerId != null">saler_id,</if>
@@ -137,8 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null">#{customName},</if>
<if test="dosageId != null">#{dosageId},</if>
<if test="dosageName != null">#{dosageName},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="stdGoodsName != null">#{stdGoodsName},</if>
<if test="provinceId != null">#{provinceId},</if>
<if test="provinceName != null">#{provinceName},</if>
<if test="salerId != null">#{salerId},</if>
@@ -176,8 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null">custom_name = #{customName},</if>
<if test="dosageId != null">dosage_id = #{dosageId},</if>
<if test="dosageName != null">dosage_name = #{dosageName},</if>
<if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="stdGoodsName != null">std_goods_name = #{stdGoodsName},</if>
<if test="provinceId != null">province_id = #{provinceId},</if>
<if test="provinceName != null">province_name = #{provinceName},</if>
<if test="salerId != null">saler_id = #{salerId},</if>

View File

@@ -15,8 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="customName" column="custom_name" />
<result property="dosageId" column="dosage_id" />
<result property="dosageName" column="dosage_name" />
<result property="goodsId" column="goods_id" />
<result property="goodsName" column="goods_name" />
<result property="stdGoodsName" column="std_goods_name" />
<result property="provinceId" column="province_id" />
<result property="provinceName" column="province_name" />
<result property="salerId" column="saler_id" />
@@ -41,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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, goods_id, 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>
<select id="selectNewGrBiSaAggYearCountList" parameterType="com.lideeyunji.core.framework.entity.NewGrBiSaAggYearCount" resultMap="NewGrBiSaAggYearCountResult">
@@ -56,8 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null and customName != ''"> and custom_name like concat('%', #{customName}, '%')</if>
<if test="dosageId != null "> and dosage_id = #{dosageId}</if>
<if test="dosageName != null and dosageName != ''"> and dosage_name like concat('%', #{dosageName}, '%')</if>
<if test="goodsId != null "> and goods_id = #{goodsId}</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
<if test="stdGoodsName != null and stdGoodsName != ''"> and std_goods_name like concat('%', #{stdGoodsName}, '%')</if>
<if test="provinceId != null "> and province_id = #{provinceId}</if>
<if test="provinceName != null and provinceName != ''"> and province_name like concat('%', #{provinceName}, '%')</if>
<if test="salerId != null "> and saler_id = #{salerId}</if>
@@ -99,8 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null">custom_name,</if>
<if test="dosageId != null">dosage_id,</if>
<if test="dosageName != null">dosage_name,</if>
<if test="goodsId != null">goods_id,</if>
<if test="goodsName != null">goods_name,</if>
<if test="stdGoodsName != null">std_goods_name,</if>
<if test="provinceId != null">province_id,</if>
<if test="provinceName != null">province_name,</if>
<if test="salerId != null">saler_id,</if>
@@ -134,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dosageId != null">#{dosageId},</if>
<if test="dosageName != null">#{dosageName},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="stdGoodsName != null">#{stdGoodsName},</if>
<if test="provinceId != null">#{provinceId},</if>
<if test="provinceName != null">#{provinceName},</if>
<if test="salerId != null">#{salerId},</if>
@@ -171,8 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customName != null">custom_name = #{customName},</if>
<if test="dosageId != null">dosage_id = #{dosageId},</if>
<if test="dosageName != null">dosage_name = #{dosageName},</if>
<if test="goodsId != null">goods_id = #{goodsId},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="stdGoodsName != null">std_goods_name = #{stdGoodsName},</if>
<if test="provinceId != null">province_id = #{provinceId},</if>
<if test="provinceName != null">province_name = #{provinceName},</if>
<if test="salerId != null">saler_id = #{salerId},</if>