IncomeStatisticBackMonthSMapper.xml
5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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.zteits.order.mapper.smapper.IncomeStatisticBackMonthSMapper">
<resultMap id="BaseResultMap" type="com.zteits.order.domain.IncomeStatisticBackMonth">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="static_date" jdbcType="DATE" property="staticDate" />
<result column="org_id" jdbcType="INTEGER" property="orgId" />
<result column="area_id" jdbcType="VARCHAR" property="areaId" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="pl_name" jdbcType="VARCHAR" property="plName" />
<result column="order_num" jdbcType="INTEGER" property="orderNum" />
<result column="total_fee" jdbcType="BIGINT" property="totalFee" />
<result column="act_fee" jdbcType="BIGINT" property="actFee" />
<result column="dicount_fee" jdbcType="BIGINT" property="dicountFee" />
<result column="app_num" jdbcType="INTEGER" property="appNum" />
<result column="wx_num" jdbcType="INTEGER" property="wxNum" />
<result column="platform_num" jdbcType="INTEGER" property="platformNum" />
<result column="site_num" jdbcType="INTEGER" property="siteNum" />
<result column="ali_fee" jdbcType="BIGINT" property="aliFee" />
<result column="ali_charge_num" jdbcType="INTEGER" property="aliChargeNum" />
<result column="wx_fee" jdbcType="BIGINT" property="wxFee" />
<result column="wx_charge_num" jdbcType="INTEGER" property="wxChargeNum" />
<result column="cash_fee" jdbcType="BIGINT" property="cashFee" />
<result column="cash_charge_num" jdbcType="INTEGER" property="cashChargeNum" />
<result column="balance_fee" jdbcType="BIGINT" property="balanceFee" />
<result column="balance_charge_num" jdbcType="INTEGER" property="balanceChargeNum" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, static_date, org_id, area_id, area_name, pl_no, pl_name, order_num, total_fee,
act_fee, dicount_fee, app_num, wx_num, platform_num, site_num, ali_fee, ali_charge_num,
wx_fee, wx_charge_num, cash_fee, cash_charge_num, balance_fee, balance_charge_num,
data_state, create_emp_id, create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name,
modfiy_date, remark
</sql>
<select id="queryIncomeStatisticForBackMonth" parameterType="com.zteits.clouds.api.dto.order.income.param.IncomeStatisticRequest"
resultType="com.zteits.order.domain.IncomeStatisticBackMonth">
SELECT
<if test="groupType != null and groupType ==1">
DATE_FORMAT( a.static_date,'%Y-%m-01') as staticDate,
</if>
<if test="groupType != null and groupType ==2">
a.pl_no AS plNo,
a.pl_name as plName,
</if>
<if test="groupType != null and groupType ==3">
DATE_FORMAT( a.static_date,'%Y-%m-01') as staticDate,
a.pl_no AS plNo,
a.pl_name as plName,
</if>
SUM(a.order_num) as orderNum,
SUM(a.total_fee) as totalFee,
sum(a.act_fee) as actFee,
sum(a.dicount_fee) as dicountFee,
sum(a.app_num) as appNum,
sum(a.wx_num) as wxNum,
sum(a.platform_num) as platformNum,
sum(a.site_num) as siteNum,
sum(a.ali_fee) as aliFee,
sum(a.ali_charge_num) as aliChargeNum,
sum(a.wx_fee) as wxFee,
sum(a.wx_charge_num) as wxChargeNum,
sum(a.cash_fee) as cashFee,
sum(a.cash_charge_num) as cashChargeNum,
sum(a.balance_fee) as balanceFee,
sum(a.balance_charge_num) as balanceChargeNum
FROM
income_statistic_back_month a
where a.data_state=1
AND a.static_date BETWEEN #{beginTime} AND #{endTime}
<if test="plAreaBlockIds != null and plNos.size >0">
AND a.area_id IN
<foreach collection="plAreaBlockIds" open="(" close=")" item="plAreaBlockId" separator=",">
#{plAreaBlockId}
</foreach>
</if>
<if test="plNos != null and plNos.size >0">
AND a.pl_no IN
<foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
#{plNo}
</foreach>
</if>
<if test="groupType != null and groupType ==1">
GROUP BY DATE_FORMAT( a.static_date,'%Y-%m-01')
</if>
<if test="groupType != null and groupType ==2">
GROUP BY a.pl_no,a.pl_name
</if>
<if test="groupType != null and groupType ==3">
GROUP BY a.pl_no,a.pl_name,DATE_FORMAT( a.static_date,'%Y-%m-01')
</if>
<choose>
<when test="baseRequest != null and baseRequest.sortName != null and baseRequest.sortOrder != null
and baseRequest.sortName != '' and baseRequest.sortOrder != ''">
ORDER BY ${baseRequest.sortName} ${baseRequest.sortOrder}
</when>
<otherwise>
ORDER BY DATE_FORMAT( a.static_date,'%Y-%m-01') DESC
</otherwise>
</choose>
</select>
</mapper>