You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
6.8 KiB
170 lines
6.8 KiB
<?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.qs.serve.modules.erp.mapper.ErpDispatchDataMapper">
|
|
|
|
<resultMap id="erpDispatchDataMap" type="com.qs.serve.modules.erp.entity.ErpDispatchData" >
|
|
<result property="id" column="id"/>
|
|
<result property="place" column="place"/>
|
|
<result property="dlCode" column="dl_code"/>
|
|
<result property="date" column="date"/>
|
|
<result property="cusCode" column="cus_code"/>
|
|
<result property="cusName" column="cus_name"/>
|
|
<result property="invCode" column="inv_code"/>
|
|
<result property="invName" column="inv_name"/>
|
|
<result property="invBatch" column="inv_batch"/>
|
|
<result property="salesDepCode" column="sales_dep_code"/>
|
|
<result property="depName" column="dep_name"/>
|
|
<result property="qty" column="qty"/>
|
|
<result property="sumMoney" column="sum_money"/>
|
|
<result property="volume" column="volume"/>
|
|
<result property="netWeight" column="net_weight"/>
|
|
<result property="dispatchCost" column="dispatch_cost"/>
|
|
<result property="invDispatchCost" column="inv_dispatch_cost"/>
|
|
<result property="invTransFee" column="inv_trans_fee"/>
|
|
<result property="invProduceCost" column="inv_produce_cost"/>
|
|
<result property="createTime" column="create_time"/>
|
|
</resultMap>
|
|
|
|
<sql id="erpDispatchDataSql">
|
|
erp_dispatch_data.`id`,
|
|
erp_dispatch_data.`place`,
|
|
erp_dispatch_data.`dl_code`,
|
|
erp_dispatch_data.`date`,
|
|
erp_dispatch_data.`cus_code`,
|
|
erp_dispatch_data.`cus_name`,
|
|
erp_dispatch_data.`inv_code`,
|
|
erp_dispatch_data.`inv_name`,
|
|
erp_dispatch_data.`inv_batch`,
|
|
erp_dispatch_data.`sales_dep_code`,
|
|
erp_dispatch_data.`dep_name`,
|
|
erp_dispatch_data.`qty`,
|
|
erp_dispatch_data.`sum_money`,
|
|
erp_dispatch_data.`volume`,
|
|
erp_dispatch_data.`net_weight`,
|
|
erp_dispatch_data.`dispatch_cost`,
|
|
erp_dispatch_data.`inv_dispatch_cost`,
|
|
erp_dispatch_data.`inv_trans_fee`,
|
|
erp_dispatch_data.`inv_produce_cost`,
|
|
erp_dispatch_data.`create_time` </sql>
|
|
|
|
|
|
<select id="querySumCost" resultType="com.qs.serve.modules.erp.entity.dto.ErpDispatchSumVo">
|
|
SELECT
|
|
DATE_FORMAT(date,'%Y%m') AS `yearMonth`,
|
|
SUM(sum_money) as dispatchSumCost
|
|
FROM
|
|
`erp_dispatch_data`
|
|
where
|
|
DATE_FORMAT(date,'%Y%m') >= #{startNumber}
|
|
and DATE_FORMAT(date,'%Y%m') <= #{endNumber}
|
|
<if test="cusCodes!=null and cusCodes.size > 0">
|
|
and cus_code in
|
|
<foreach collection="cusCodes" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
and source_table like 'autoId-%'
|
|
GROUP BY DATE_FORMAT(date,'%Y%m')
|
|
</select>
|
|
|
|
|
|
|
|
<select id="querySumCostAmt" resultType="java.math.BigDecimal">
|
|
SELECT
|
|
SUM(sum_money) as dispatchSumCost
|
|
FROM
|
|
`erp_dispatch_data`
|
|
where
|
|
DATE_FORMAT(date,'%Y%m') >= #{startNumber}
|
|
and DATE_FORMAT(date,'%Y%m') <= #{endNumber}
|
|
<if test="cusCodes!=null and cusCodes.size > 0">
|
|
and cus_code in
|
|
<foreach collection="cusCodes" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getSumCostGroup" resultType="java.math.BigDecimal">
|
|
SELECT
|
|
SUM(sum_money) as dispatchSumCost
|
|
FROM
|
|
`erp_dispatch_data`
|
|
where
|
|
DATE_FORMAT(date,'%Y%m') >= #{startNumber}
|
|
and DATE_FORMAT(date,'%Y%m') <= #{endNumber}
|
|
GROUP BY DATE_FORMAT(date,'%Y%m')
|
|
</select>
|
|
|
|
|
|
<select id="getSumCost" resultType="java.math.BigDecimal">
|
|
SELECT
|
|
SUM(sum_money) as dispatchSumCost
|
|
FROM
|
|
`erp_dispatch_data`
|
|
where
|
|
DATE_FORMAT(date,'%Y%m') >= #{startNumber}
|
|
and DATE_FORMAT(date,'%Y%m') <= #{endNumber}
|
|
</select>
|
|
|
|
<select id="querySumCost4BudgetTarger" resultType="com.qs.serve.modules.erp.entity.dto.ErpDispatchSumVo">
|
|
SELECT
|
|
DATE_FORMAT(date,'%Y%m') as yearMonth,cus_code as customerCode,SUM(sum_money) as dispatchSumCost
|
|
FROM
|
|
`erp_dispatch_data`
|
|
where
|
|
place = 001
|
|
<if test="skuCodes!=null and skuCodes.size > 0">
|
|
and inv_code in
|
|
<foreach collection="skuCodes" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
GROUP BY DATE_FORMAT(date,'%Y%m'),cus_code
|
|
</select>
|
|
|
|
<select id="queryCusAmtByPms" resultType="com.qs.serve.modules.erp.entity.vo.ErpDispatchSumPmsVo">
|
|
SELECT
|
|
SUM(d.sum_money) as totalAmount
|
|
FROM
|
|
`erp_dispatch_data` d
|
|
left JOIN goods_sku ON d.invCode = goods_sku.sku_code
|
|
left join goods_spu ON goods_sku.spu_id = goods_spu.id
|
|
where
|
|
d.place = '001'
|
|
and d.date >= #{query.startDate}
|
|
and d.date <= #{query.endDate}
|
|
and d.cus_code = #{query.customerCode}
|
|
<if test="query.brandIds!=null and query.brandIds.size > 0">
|
|
and goods_spu.category_first in
|
|
<foreach collection="query.brandIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
<if test="query.seriesIds!=null and query.seriesIds.size > 0">
|
|
and goods_spu.category_second in
|
|
<foreach collection="query.seriesIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
<if test="query.categoryIds!=null and query.categoryIds.size > 0">
|
|
and goods_spu.category_third in
|
|
<foreach collection="query.categoryIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
<if test="query.spuIds!=null and query.spuIds.size > 0">
|
|
and goods_spu.id in
|
|
<foreach collection="query.spuIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
<if test="query.skuIds!=null and query.skuIds.size > 0">
|
|
and goods_sku.id in
|
|
<foreach collection="query.skuIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
|
#{selectId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|
|
|