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
package pwc.taxtech.atms.invoice;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.dpo.OutputInvoiceDto;
import pwc.taxtech.atms.vat.dpo.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.vat.dpo.QueryOutputDto;
import pwc.taxtech.atms.vat.entity.OutputInvoice;
import pwc.taxtech.atms.vat.entity.OutputInvoiceExample;
import pwc.taxtech.atms.vat.entity.OutputInvoiceKey;
import java.util.List;
@Mapper
public interface OutputInvoiceMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
long countByExample(OutputInvoiceExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int deleteByExample(OutputInvoiceExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int deleteByPrimaryKey(OutputInvoiceKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int insert(OutputInvoice record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int insertSelective(OutputInvoice record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
List<OutputInvoice> selectByExampleWithRowbounds(OutputInvoiceExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
List<OutputInvoice> selectByExample(OutputInvoiceExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
OutputInvoice selectByPrimaryKey(OutputInvoiceKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") OutputInvoice record, @Param("example") OutputInvoiceExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int updateByExample(@Param("record") OutputInvoice record, @Param("example") OutputInvoiceExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(OutputInvoice record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table PWC_INVOICE.OUTPUT_INVOICE
*
* @mbg.generated
*/
int updateByPrimaryKey(OutputInvoice record);
@Select("SELECT " +
" o.PERIOD_ID as periodId, " +
" o.INVOICE_TYPE as invoiceType, " +
" o.CLASS_CODE as classCode, " +
" o.INVOICE_NUMBER as invoiceNumber, " +
" o.BUYER_NAME as buyerName, " +
" o.BUYER_TAX_NUMBER as buyerTaxNumber, " +
" o.BANK_ACCOUNT as bankAccount, " +
" o.PHONE_NUM as phoneNum, " +
" o.INVOICE_DATE as invoiceDate, " +
" oi.CODE_VERSION as codeVersion, " +
" oi.PRODUCT_NAME as productName, " +
" oi.DOCUMENT_NUM as documentNum, " +
" oi.PRODUCT_STANDARD as productStandard, " +
" oi.UNIT as unit, " +
" oi.QUANTITY as quantity, " +
" oi.UNIT_PRICE as unitPrice, " +
" oi.AMOUNT as amount, " +
" oi.TAX_RATE as taxRate, " +
" oi.TAX_AMOUNT as taxAmount, " +
" oi.TAX_CLASS_CODE as taxClassCode " +
"FROM " +
" OUTPUT_VAT_INVOICE o, " +
" OUTPUT_VAT_INVOICE_ITEM oi, " +
" (SELECT " +
" INVOICE_ID, MIN(SeqNo) MIN_SEQ_NO " +
" FROM " +
" OUTPUT_VAT_INVOICE_ITEM " +
" GROUP BY InvoiceID) m " +
"WHERE " +
" o.INVOICE_ID = oi.INVOICE_ID " +
" AND o.INVOICE_ID = m.INVOICE_ID " +
" AND oi.SEQ_NO = m.MIN_SEQ_NO " +
" AND o.PERIOD_ID = #{period}" +
" UNION SELECT " +
" o2.periodID, " +
" NULL AS invoiceType, " +
" '' AS classCode, " +
" '' AS invoiceNumber, " +
" '' AS buyerName, " +
" '' AS buyerTaxNumber, " +
" '' AS bankAccount, " +
" '' AS phoneNum, " +
" NULL AS invoiceDate, " +
" oi2.codeVersion, " +
" oi2.productName, " +
" oi2.documentNum, " +
" oi2.productStandard, " +
" oi2.unit, " +
" oi2.quantity, " +
" oi2.unitPrice, " +
" oi2.amount, " +
" oi2.taxRate, " +
" oi2.taxAmount, " +
" oi2.taxClassCode " +
"FROM " +
" OUTPUT_VAT_INVOICE o2, " +
" OUTPUT_VAT_INVOICE_ITEM oi2, " +
" (SELECT " +
" INVOICE_ID, MIN(SEQ_NO) MIN_SEQ_NO " +
" FROM " +
" OUTPUT_VAT_INVOICE_ITEM " +
" GROUP BY INVOICE_ID) m2 " +
"WHERE " +
" o2.INVOICE_ID = oi2.INVOICE_ID " +
" AND o2.INVOICE_ID = m2.INVOICE_ID " +
" AND oi2.SEQ_NO != m2.MIN_SEQ_NO " +
" AND o2.PERIOD_ID = #{period}" +
" ")
List<OutputVATInvoiceInfoDto> queryOutputDetailWithItem(Integer period);
List<OutputInvoiceDto> getOutputInvoiceWithDetail();
List<OutputVATInvoiceInfoDto> selectOutputInvoiceInfoLeftJoinItem(QueryOutputDto queryDto);
}