综合销售跨度查询 调整, 下钻查询调整
This commit is contained in:
@@ -29,6 +29,17 @@ public class NewGrBiSaAggMonthCount implements Serializable
|
|||||||
@TableField(value = "ny")
|
@TableField(value = "ny")
|
||||||
private String ny;
|
private String ny;
|
||||||
|
|
||||||
|
@TableField(value = "useYearStart")
|
||||||
|
private String useYearStart;
|
||||||
|
|
||||||
|
@TableField(value = "useYearEnd")
|
||||||
|
private String useYearEnd;
|
||||||
|
|
||||||
|
@TableField(value = "useMonthStart")
|
||||||
|
private String useMonthStart;
|
||||||
|
|
||||||
|
@TableField(value = "useMonthEnd")
|
||||||
|
private String useMonthEnd;
|
||||||
|
|
||||||
@TableField(value = "use_month")
|
@TableField(value = "use_month")
|
||||||
private String useMonth;
|
private String useMonth;
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
tbl_lgbsa.saler_id,
|
tbl_lgbsa.saler_id,
|
||||||
tbl_lgbsa.saler_name,
|
tbl_lgbsa.saler_name,
|
||||||
tbl_lgbsa.this_month_sa_qty AS this_month_sa_qty,
|
tbl_lgbsa.this_month_sa_qty AS this_month_sa_qty,
|
||||||
ROUND(tbl_lgbsa.this_month_sa_money / 10000, 2) AS this_month_sa_money, -- 本月销售金额(元)
|
ROUND(tbl_lgbsa.this_month_sa_money / 10000, 2) AS this_month_sa_money,
|
||||||
ROUND(tbl_lgbsa.this_month_cost / 10000, 2) AS this_month_cost,
|
ROUND(tbl_lgbsa.this_month_cost / 10000, 2) AS this_month_cost,
|
||||||
ROUND(tbl_lgbsa.this_month_profit / 10000, 2) AS this_month_profit,
|
ROUND(tbl_lgbsa.this_month_profit / 10000, 2) AS this_month_profit,
|
||||||
tbl_lgbsa.last_month_sa_qty as last_month_sa_qty,
|
tbl_lgbsa.last_month_sa_qty as last_month_sa_qty,
|
||||||
@@ -636,13 +636,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ROUND(tbl_lgbsa.yoy_month_sa_money / 10000, 2) as yoy_month_sa_money,
|
ROUND(tbl_lgbsa.yoy_month_sa_money / 10000, 2) as yoy_month_sa_money,
|
||||||
ROUND(tbl_lgbsa.yoy_month_profit / 10000, 2) as yoy_month_profit,
|
ROUND(tbl_lgbsa.yoy_month_profit / 10000, 2) as yoy_month_profit,
|
||||||
ROUND(tbl_lgbsa.yoy_month_cost / 10000, 2) as yoy_month_cost,
|
ROUND(tbl_lgbsa.yoy_month_cost / 10000, 2) as yoy_month_cost,
|
||||||
# CONCAT(ROUND((SELECT SUM(MONTHSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS monthsaqty_s,
|
|
||||||
# CONCAT(ROUND((SELECT SUM(THISSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS thissaqty_s,
|
|
||||||
# CONCAT(ROUND((SELECT SUM(LASTSAQTY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS lastsaqty_s,
|
|
||||||
# -- 原本带CAST的字段,简化写法(CONCAT会自动转为字符串)
|
|
||||||
# CONCAT(ROUND((SELECT SUM(MONTHSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000 ,2), '亿') AS monthsamoney_s,
|
|
||||||
# CONCAT(ROUND((SELECT SUM(THISSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000,2), '亿') AS thissamoney_s,
|
|
||||||
# CONCAT(ROUND((SELECT SUM(LASTSAMONEY) FROM yunji_gr_bi_sa_agg)/100000000,2), '亿') AS lastsamoney_s,
|
|
||||||
CASE
|
CASE
|
||||||
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_qty = 0 THEN IF(tbl_lgbsa.this_month_sa_qty > 0, 100, 0)
|
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_qty = 0 THEN IF(tbl_lgbsa.this_month_sa_qty > 0, 100, 0)
|
||||||
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END) > 0 THEN
|
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END) > 0 THEN
|
||||||
@@ -654,8 +647,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END), 2))
|
ELSE (tbl_lgbsa.this_month_sa_qty - tbl_lgbsa.yoy_month_sa_qty) / tbl_lgbsa.yoy_month_sa_qty * 100 END), 2))
|
||||||
ELSE '0.00'
|
ELSE '0.00'
|
||||||
END AS monthsaqty_yoy,
|
END AS monthsaqty_yoy,
|
||||||
|
|
||||||
-- 数量同比(原有)
|
|
||||||
CASE
|
CASE
|
||||||
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
WHEN (CASE WHEN tbl_lgbsa.yoy_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
||||||
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.yoy_month_sa_money) / tbl_lgbsa.yoy_month_sa_money * 100 END) > 0 THEN
|
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.yoy_month_sa_money) / tbl_lgbsa.yoy_month_sa_money * 100 END) > 0 THEN
|
||||||
@@ -687,56 +678,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
CONCAT('🔴 ', ROUND((CASE WHEN tbl_lgbsa.last_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
CONCAT('🔴 ', ROUND((CASE WHEN tbl_lgbsa.last_month_sa_money = 0 THEN IF(tbl_lgbsa.this_month_sa_money > 0, 100, 0)
|
||||||
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.last_month_sa_money) / tbl_lgbsa.last_month_sa_money * 100 END), 2))
|
ELSE (tbl_lgbsa.this_month_sa_money - tbl_lgbsa.last_month_sa_money) / tbl_lgbsa.last_month_sa_money * 100 END), 2))
|
||||||
ELSE '0.00'
|
ELSE '0.00'
|
||||||
END AS lastMonthSaMoney_yoy, -- 本月销售金额增长率
|
END AS lastMonthSaMoney_yoy,
|
||||||
ROUND(tbl_lgbsa.this_month_profit_rate * 100, 2) AS this_month_sa_money_share,
|
ROUND(tbl_lgbsa.this_month_profit_rate * 100, 2) AS this_month_sa_money_share,
|
||||||
ROUND(tbl_lgbsa.this_month_sa_money_share * 100, 2) AS this_month_profit_share
|
ROUND(tbl_lgbsa.this_month_sa_money_share * 100, 2) AS this_month_profit_share
|
||||||
FROM
|
FROM
|
||||||
new_gr_bi_sa_agg tbl_lgbsa
|
new_gr_bi_sa_agg tbl_lgbsa
|
||||||
<where>
|
<where>
|
||||||
<!-- 使用 (use_year * 100 + use_month) 组合成年月数值进行比较 -->
|
|
||||||
<if test="saAggParam.useYearStart != null and saAggParam.useYearStart != '' and saAggParam.useMonthStart != null and saAggParam.useMonthStart != ''">
|
<if test="saAggParam.useYearStart != null and saAggParam.useYearStart != '' and saAggParam.useMonthStart != null and saAggParam.useMonthStart != ''">
|
||||||
AND (use_year * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
AND (use_year * 100 + use_month) >= (#{saAggParam.useYearStart} * 100 + #{saAggParam.useMonthStart})
|
||||||
</if>
|
</if>
|
||||||
<if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != '' and saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''">
|
<if test="saAggParam.useYearEnd != null and saAggParam.useYearEnd != '' and saAggParam.useMonthEnd != null and saAggParam.useMonthEnd != ''">
|
||||||
AND (use_year * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
AND (use_year * 100 + use_month) <= (#{saAggParam.useYearEnd} * 100 + #{saAggParam.useMonthEnd})
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="zoneId != null "> and zone_id = #{zoneId}</if>-->
|
<if test="saAggParam.useYear != null and saAggParam.useYear != '' and saAggParam.useMonth != null and saAggParam.useMonth != ''">
|
||||||
|
AND (use_year * 100 + use_month) = (#{saAggParam.useYear} * 100 + #{saAggParam.useMonth})
|
||||||
|
</if>
|
||||||
|
<if test="saAggParam.useYear != null and saAggParam.useYear != '' and (saAggParam.useMonth == null or saAggParam.useMonth == '' )">
|
||||||
|
AND use_year = #{saAggParam.useYear}
|
||||||
|
</if>
|
||||||
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
<if test="saAggParam.zoneName != null and saAggParam.zoneName != ''"> and zone_name in
|
||||||
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.zoneName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="saleTypeId != null "> and sale_type_id = #{saleTypeId}</if>-->
|
|
||||||
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
|
<if test="saAggParam.saleTypeName != null and saAggParam.saleTypeName != ''"> and sale_type_name in
|
||||||
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.saleTypeName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="customId != null "> and custom_id = #{customId}</if>-->
|
|
||||||
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
<if test="saAggParam.customName != null and saAggParam.customName != ''"> and custom_name in
|
||||||
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.customName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="dosageId != null "> and dosage_id = #{dosageId}</if>-->
|
|
||||||
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
|
<if test="saAggParam.dosageName != null and saAggParam.dosageName != ''"> and dosage_name in
|
||||||
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.dosageName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="goodsId != null "> and goods_id = #{goodsId}</if>-->
|
|
||||||
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
<if test="saAggParam.goodsName != null and saAggParam.goodsName != ''"> and goods_name in
|
||||||
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.goodsName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="provinceId != null "> and province_id = #{provinceId}</if>-->
|
|
||||||
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and province_name in
|
<if test="saAggParam.provinceName != null and saAggParam.provinceName != ''"> and province_name in
|
||||||
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.provinceName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!--<if test="salerId != null "> and saler_id = #{salerId}</if>-->
|
|
||||||
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and saler_name in
|
<if test="saAggParam.salerName != null and saAggParam.salerName != ''"> and saler_name in
|
||||||
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
<foreach collection="saAggParam.salerName" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" id="NewGrBiSaAggMonthCountResult">
|
<resultMap type="com.lideeyunji.core.framework.entity.NewGrBiSaAggMonthCount" id="NewGrBiSaAggMonthCountResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="ny" column="ny" />
|
<result property="ny" column="ny" />
|
||||||
|
<result property="useYearStart" column="useYearStart" />
|
||||||
|
<result property="useYearEnd" column="useYearEnd" />
|
||||||
|
<result property="useMonthStart" column="useMonthStart" />
|
||||||
|
<result property="useMonthEnd" column="useMonthEnd" />
|
||||||
<result property="useYear" column="use_year" />
|
<result property="useYear" column="use_year" />
|
||||||
<result property="useMonth" column="use_month" />
|
<result property="useMonth" column="use_month" />
|
||||||
<result property="zoneId" column="zone_id" />
|
<result property="zoneId" column="zone_id" />
|
||||||
@@ -261,6 +265,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="selectNewGrBiSaAggGroupNoMonthNoYearList" resultMap="NewGrBiSaAggMonthCountResult">
|
<select id="selectNewGrBiSaAggGroupNoMonthNoYearList" resultMap="NewGrBiSaAggMonthCountResult">
|
||||||
select
|
select
|
||||||
CONCAT (#{params.useYearMonthStart} , '~' , #{params.useYearMonthEnd}) as ny,
|
CONCAT (#{params.useYearMonthStart} , '~' , #{params.useYearMonthEnd}) as ny,
|
||||||
|
#{saAggParam.useYearStart} as useYearStart,
|
||||||
|
#{saAggParam.useYearEnd} as useYearEnd,
|
||||||
|
#{saAggParam.useMonthStart} as useMonthStart,
|
||||||
|
#{saAggParam.useMonthEnd} as useMonthEnd,
|
||||||
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
<if test="groupFieldList.contains('customName') || params.containsKey('customName')">
|
||||||
current_month.custom_id,
|
current_month.custom_id,
|
||||||
current_month.custom_name,
|
current_month.custom_name,
|
||||||
@@ -288,7 +296,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ROUND(current_month.this_month_sa_money / 10000, 2) AS this_month_sa_money,
|
ROUND(current_month.this_month_sa_money / 10000, 2) AS this_month_sa_money,
|
||||||
ROUND(current_month.this_month_profit / 10000, 2) AS this_month_profit,
|
ROUND(current_month.this_month_profit / 10000, 2) AS this_month_profit,
|
||||||
ROUND(current_month.this_month_cost / 10000, 2) AS this_month_cost,
|
ROUND(current_month.this_month_cost / 10000, 2) AS this_month_cost,
|
||||||
|
|
||||||
COALESCE (ROUND( current_month.this_month_sa_money/total_month_data.this_month_sa_money_sum * 100, 2), 0 ) as this_month_sa_money_share,
|
COALESCE (ROUND( current_month.this_month_sa_money/total_month_data.this_month_sa_money_sum * 100, 2), 0 ) as this_month_sa_money_share,
|
||||||
COALESCE (ROUND( current_month.this_month_profit/total_month_data.this_month_profit_sum * 100, 2), 0 ) as this_month_profit_share
|
COALESCE (ROUND( current_month.this_month_profit/total_month_data.this_month_profit_sum * 100, 2), 0 ) as this_month_profit_share
|
||||||
FROM ( SELECT
|
FROM ( SELECT
|
||||||
|
|||||||
Reference in New Issue
Block a user