ReceiptLedgerInfoMapper.xml
7.72 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?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.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper">
<resultMap id="ReceiptLedgerInfo" type="com.lframework.xingyun.sc.entity.ReceiptLedgerInfo">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="customer_short_id" property="customerShortId"/>
<result column="customer_short_name" property="customerShortName"/>
<result column="customer_type" property="customerType"/>
<result column="quota" property="quota"/>
<result column="settle_term" property="settleTerm"/>
<result column="dept_id" property="deptId"/>
<result column="dept_name" property="deptName"/>
<result column="region" property="region"/>
<result column="region_name" property="regionName"/>
<result column="stock_up_company_id" property="stockUpCompanyId"/>
<result column="stock_up_company_name" property="stockUpCompanyName"/>
<result column="customer_id" property="customerId"/>
<result column="customer_name" property="customerName"/>
<result column="factory_type" property="factoryType"/>
<result column="shipment_date" property="shipmentDate"/>
<result column="start_account_receivable" property="startAccountReceivable"/>
<result column="arrival_date" property="arrivalDate"/>
<result column="processed_date" property="processedDate"/>
<result column="actual_returned_date" property="actualReturnedDate"/>
<result column="returned_amount" property="returnedAmount"/>
<result column="actual_returned_amount" property="actualReturnedAmount"/>
<result column="end_account_receivable" property="endAccountReceivable"/>
<result column="apply_status" property="applyStatus"/>
<result column="coordinate_date" property="coordinateDate"/>
<result column="remark" property="remark"/>
<result column="second_coordinate_date" property="secondCoordinateDate"/>
<result column="third_coordinate_date" property="thirdCoordinateDate"/>
<result column="fourth_coordinate_date" property="fourthCoordinateDate"/>
<result column="fifth_coordinate_date" property="fifthCoordinateDate"/>
<result column="description" property="description"/>
<result column="del_flag" property="delFlag"/>
<result column="create_by_id" property="createById"/>
<result column="update_by_id" property="updateById"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="ReceiptLedgerInfo_sql">
SELECT
tb.id,
tb.parent_id,
tb.customer_short_id,
cs.short_name as customer_short_name,
cs.type as customer_type,
tb.quota,
tb.settle_term,
tb.dept_id,
d.name as dept_name,
tb.region,
r.name as region_name,
tb.stock_up_company_id,
sc.name as stock_up_company_name,
tb.customer_id,
oc.name as customer_name,
tb.factory_type,
tb.shipment_date,
tb.start_account_receivable,
tb.arrival_date,
tb.processed_date,
tb.actual_returned_date,
tb.returned_amount,
tb.actual_returned_amount,
tb.end_account_receivable,
tb.apply_status,
tb.coordinate_date,
tb.remark,
tb.second_coordinate_date,
tb.third_coordinate_date,
tb.fourth_coordinate_date,
tb.fifth_coordinate_date,
tb.description,
tb.del_flag,
tb.create_by_id,
tb.update_by_id,
tb.create_time,
tb.update_time
FROM receipt_ledger_info AS tb
LEFT JOIN base_data_customer_short cs ON tb.customer_short_id = cs.id
LEFT JOIN base_data_customer sc ON tb.stock_up_company_id = sc.id
LEFT JOIN base_data_customer oc ON tb.customer_id = oc.id
LEFT JOIN sys_dept d ON tb.dept_id = d.id
LEFT JOIN sys_dept r ON tb.region = r.id
</sql>
<select id="query" resultMap="ReceiptLedgerInfo">
<include refid="ReceiptLedgerInfo_sql"/>
<where>
AND tb.del_flag = false
<if test="vo.id != null and vo.id != ''">
AND tb.id = #{vo.id}
</if>
<if test="vo.customerShortId != null and vo.customerShortId != ''">
AND tb.customer_short_id = #{vo.customerShortId}
</if>
<if test="vo.deptId != null and vo.deptId != ''">
AND tb.dept_id = #{vo.deptId}
</if>
<if test="vo.customerId != null and vo.customerId != ''">
AND tb.customer_id = #{vo.customerId}
</if>
<if test="vo.createTimeStart != null and vo.createTimeStart != ''">
AND tb.create_time >= #{vo.createTimeStart}
</if>
<if test="vo.createTimeEnd != null and vo.createTimeEnd != ''">
AND tb.create_time <= #{vo.createTimeEnd}
</if>
<if test="vo.customerName != null and vo.customerName != ''">
AND oc.name LIKE CONCAT('%', #{vo.customerName}, '%')
</if>
<if test="vo.customerShortName != null and vo.customerShortName != ''">
AND cs.short_name LIKE CONCAT('%', #{vo.customerShortName}, '%')
</if>
<if test="vo.deptName != null and vo.deptName != ''">
AND d.name LIKE CONCAT('%', #{vo.deptName}, '%')
</if>
</where>
</select>
<insert id="batchAdd">
INSERT INTO receipt_ledger_info (
id,
parent_id,
customer_short_id,
quota,
settle_term,
dept_id,
region,
stock_up_company_id,
customer_id,
factory_type,
shipment_date,
start_account_receivable,
arrival_date,
processed_date,
actual_returned_date,
returned_amount,
actual_returned_amount,
end_account_receivable,
apply_status,
coordinate_date,
remark,
second_coordinate_date,
third_coordinate_date,
fourth_coordinate_date,
fifth_coordinate_date,
description,
create_by_id,
update_by_id,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.id},
#{item.parentId},
#{item.customerShortId},
#{item.quota},
#{item.settleTerm},
#{item.deptId},
#{item.region},
#{item.stockUpCompanyId},
#{item.customerId},
#{item.factoryType},
#{item.shipmentDate},
#{item.startAccountReceivable},
#{item.arrivalDate},
#{item.processedDate},
#{item.actualReturnedDate},
#{item.returnedAmount},
#{item.actualReturnedAmount},
#{item.endAccountReceivable},
#{item.applyStatus},
#{item.coordinateDate},
#{item.remark},
#{item.secondCoordinateDate},
#{item.thirdCoordinateDate},
#{item.fourthCoordinateDate},
#{item.fifthCoordinateDate},
#{item.description},
#{item.createById},
#{item.updateById},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
</mapper>