|
@@ -3081,5 +3081,110 @@
|
|
WHERE id = #{id}
|
|
WHERE id = #{id}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
+ <select id="getByInvoiceList" resultType="WorkInvoice">
|
|
|
|
+ SELECT
|
|
|
|
+ DISTINCT(a.id) AS "id",
|
|
|
|
+ a.number AS "number",
|
|
|
|
+ a.process_instance_id AS "processInstanceId",
|
|
|
|
+ a.client_id AS "client.id",
|
|
|
|
+ a.project_id AS "project.id",
|
|
|
|
+ a.project_name AS "projectName",
|
|
|
|
+ a.money AS "money",
|
|
|
|
+ a.money AS "moneyStr",
|
|
|
|
+ a.invoice_type AS "invoiceType",
|
|
|
|
+ (case when a.invoice_type = '1' then '专票' when a.invoice_type = '2' then '普票' else '' end) as invoiceTypeStr,
|
|
|
|
+ a.charge_type AS "chargeType",
|
|
|
|
+ a.content AS "content",
|
|
|
|
+ a.drawer_id AS "drawer.id",
|
|
|
|
+ a.office_id AS "office.id",
|
|
|
|
+ a.invoice_number AS "invoiceNumber",
|
|
|
|
+ a.invoice_date AS "invoiceDate",
|
|
|
|
+ a.drawer_name AS "drawerName",
|
|
|
|
+ a.take_date AS "takeDate",
|
|
|
|
+ a.invoice_remarks AS "invoiceRemarks",
|
|
|
|
+ a.is_invoice AS "isInvoice",
|
|
|
|
+ a.is_charge AS "isCharge",
|
|
|
|
+ a.is_invalid AS "isInvalid",
|
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
|
+ a.create_date AS "createDate",
|
|
|
|
+ a.update_by AS "updateBy.id",
|
|
|
|
+ a.update_date AS "updateDate",
|
|
|
|
+ a.remarks AS "remarks",
|
|
|
|
+ a.del_flag AS "delFlag",
|
|
|
|
+ a.orUnicode AS "orUnicode",
|
|
|
|
+ a.address AS "address",
|
|
|
|
+ a.telephone AS "telephone",
|
|
|
|
+ a.bank AS "bank",
|
|
|
|
+ a.bank_number AS "bankNumber",
|
|
|
|
+ a.cancle_reason AS "cancaleReason",
|
|
|
|
+ su.name AS "createBy.name",
|
|
|
|
+ so.show_name AS "office.name",
|
|
|
|
+ w.name AS "client.name",
|
|
|
|
+ a.invoice_state AS "invoiceState",
|
|
|
|
+ w.usc_code AS "client.uscCode",
|
|
|
|
+ w.fax AS "client.fax",
|
|
|
|
+ w.or_unicode AS "client.orUnicode",
|
|
|
|
+ w.telephone AS "client.telephone",
|
|
|
|
+ a.company_id AS "companyId",
|
|
|
|
+ a.cancle_reason AS "cancleReason",
|
|
|
|
+ w.address AS "client.address",
|
|
|
|
+ a.officee_id AS "officeId",
|
|
|
|
+ a.province AS "province",
|
|
|
|
+ a.ext AS "ext",
|
|
|
|
+ a.billing_content as "billingContent",
|
|
|
|
+ a.receipt_money_date as "receiptMoneyDate",
|
|
|
|
+ (case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' when a.receipt_money = '2' then '部分收款' else '否' end) as receiptMoney,
|
|
|
|
+ a.cancellation_remark as "cancellationRemark",
|
|
|
|
+ a.account_checking_user_id as "accountCheckingUserId",
|
|
|
|
+ a.area_id as "area.id",
|
|
|
|
+ a.new_drawer_id as "newDrawerId",
|
|
|
|
+ a.new_drawer as "newDrawer",
|
|
|
|
+ a.actual_drawer_email_address as "actualDrawerEmailAddress",
|
|
|
|
+ a.actual_drawer_id as "actualDrawerId",
|
|
|
|
+ a.electronic_invoice_flag as "electronicInvoiceFlag",
|
|
|
|
+ a.cancellation_process_instance_id as "cancellationProcessInstanceId",
|
|
|
|
+ a.cancellation_state as "cancellationState",
|
|
|
|
+ a.red_invoice_flag as "redInvoiceFlag",
|
|
|
|
+ a.red_invoice_relevancy_id as "redInvoiceRelevancyId",
|
|
|
|
+ a.red_invoice_relevancy_number as "redInvoiceRelevancyNumber"
|
|
|
|
+ FROM work_invoice a
|
|
|
|
+ LEFT JOIN sys_user su ON su.id = a.create_by
|
|
|
|
+ LEFT JOIN work_client_info w ON w.id = a.client_id
|
|
|
|
+ LEFT join sys_office so on so.id = a.office_id
|
|
|
|
+ left join work_invoice_project_relation wipr on a.id = wipr.invoice_id
|
|
|
|
+ left join rural_project_records rpr on rpr.id = wipr.project_id
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = 0
|
|
|
|
+ <if test="client != null and client.name != null and client.name != ''">
|
|
|
|
+ AND w.name = #{client.name}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="money != null and money != ''">
|
|
|
|
+ AND a.money = #{money}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
|
|
|
|
+ AND a.create_by = #{submitterId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="invoiceType != null and invoiceType != ''">
|
|
|
|
+ AND a.invoice_type = #{invoiceType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="chargeType != null and chargeType != ''">
|
|
|
|
+ AND a.charge_type = #{chargeType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="billingContent != null and billingContent != ''">
|
|
|
|
+ AND a.billing_content = #{billingContent}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="projectName != null and projectName != ''">
|
|
|
|
+ and (wipr.details = #{projectName}
|
|
|
|
+ or rpr.project_name = #{projectName}
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ AND a.receipt_money = 0
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="getInvoiceNumberStr" resultType="java.lang.String">
|
|
|
|
+ select group_concat(number) from work_invoice_detail where invoice_id = #{invoiceId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|