|
@@ -62,6 +62,7 @@
|
|
|
(case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' else '否' end) as receiptMoney,
|
|
|
a.cancellation_remark as "cancellationRemark",
|
|
|
a.account_checking_user_id as "accountCheckingUserId",
|
|
|
+ a.area_id as "area.id",
|
|
|
acu.name as "accountCheckingUserName"
|
|
|
</sql>
|
|
|
|
|
@@ -90,8 +91,12 @@
|
|
|
<select id="findList" resultType="WorkInvoice" >
|
|
|
SELECT
|
|
|
<include refid="workInvoiceColumns"/>
|
|
|
+ ,wid.number as "widNumber"
|
|
|
+ ,wid.total_money as "widTotalMoney"
|
|
|
FROM work_invoice a
|
|
|
<include refid="workInvoiceJoins"/>
|
|
|
+ left join work_invoice_detail wid on a.id = wid.invoice_id
|
|
|
+ LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
|
|
|
<where>
|
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
<if test="number != null and number != ''">
|
|
@@ -139,8 +144,11 @@
|
|
|
<if test="money != null and money != ''">
|
|
|
AND a.money = #{money}
|
|
|
</if>
|
|
|
- <if test="submitterId != null and submitterId != ''">
|
|
|
+ <!--<if test="submitterId != null and submitterId != ''">
|
|
|
AND a.create_by = #{submitterId}
|
|
|
+ </if>-->
|
|
|
+ <if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
|
|
|
+ AND (a.create_by = #{submitterId} or su.name like concat('%',#{submitterName},'%'))
|
|
|
</if>
|
|
|
<if test="receiptMoney != null and receiptMoney != ''">
|
|
|
AND a.receipt_money = #{receiptMoney}
|
|
@@ -181,6 +189,21 @@
|
|
|
<if test="isInvalid != null and isInvalid != ''">
|
|
|
AND a.is_invalid = #{isInvalid}
|
|
|
</if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_parent_id LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{area.id}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{area.id}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{area.id},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="(accountCheckingUserId != null and accountCheckingUserId != '') or (accountCheckingUserName != null and accountCheckingUserName != '')">
|
|
|
+ AND (a.account_checking_user_id = #{accountCheckingUserId} or sua.name like concat('%',#{accountCheckingUserName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="widNumber != null and widNumber != ''">
|
|
|
+ AND wid.number LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{widNumber}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{widNumber}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{widNumber},'%')</if>
|
|
|
+ </if>
|
|
|
${sqlMap.dsf}
|
|
|
</where>
|
|
|
<choose>
|
|
@@ -192,11 +215,131 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</select>
|
|
|
+<select id="getSumMoney" resultType="java.lang.String" >
|
|
|
+ select format(sum(x.money),2) as sumMoney
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ distinct (a.id) AS "id",a.money
|
|
|
+ FROM work_invoice a
|
|
|
+ <include refid="workInvoiceJoins"/>
|
|
|
+ left join work_invoice_detail wid on a.id = wid.invoice_id
|
|
|
+ LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
|
|
|
+ <where>
|
|
|
+ a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
+ and a.invoice_state = 5
|
|
|
+ <if test="number != null and number != ''">
|
|
|
+ AND a.number = #{number}
|
|
|
+ </if>
|
|
|
+ <if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
|
|
|
+ AND a.create_date BETWEEN #{beginContractDate} AND #{endContractDate}
|
|
|
+ </if>
|
|
|
+ <if test="client != null and client.id != null and client.id != ''">
|
|
|
+ AND a.client_id = #{client.id}
|
|
|
+ </if>
|
|
|
+ <if test="project != null and project.id != null and project.id != ''">
|
|
|
+ AND a.project_id = #{project.id}
|
|
|
+ </if>
|
|
|
+ <if test="project != null and project.projectId != null and project.projectId != ''">
|
|
|
+ AND p.project_id LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{project.projectId}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{project.projectId}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{project.projectId},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="project != null and project.projectName != null and project.projectName != ''">
|
|
|
+ AND p.project_name LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{project.projectName}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{project.projectName},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="project != null and project.reportData != null and project.reportData.number != null and project.reportData.number != ''">
|
|
|
+ AND prd.number LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{project.reportData.number}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{project.reportData.number}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{project.reportData.number},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="client != null and client.name != null and client.name != ''">
|
|
|
+ AND w.name LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{client.name}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{client.name}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{client.name},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="officeId != null and officeId != ''">
|
|
|
+ AND so.id = #{officeId}
|
|
|
+ </if>
|
|
|
+ <if test="money != null and money != ''">
|
|
|
+ AND a.money = #{money}
|
|
|
+ </if>
|
|
|
+ <!--<if test="submitterId != null and submitterId != ''">
|
|
|
+ AND a.create_by = #{submitterId}
|
|
|
+ </if>-->
|
|
|
+ <if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
|
|
|
+ AND (a.create_by = #{submitterId} or su.name like concat('%',#{submitterName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="receiptMoney != null and receiptMoney != ''">
|
|
|
+ AND a.receipt_money = #{receiptMoney}
|
|
|
+ </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="content != null and content != ''">
|
|
|
+ AND a.content = #{content}
|
|
|
+ </if>
|
|
|
+ <if test="drawer != null and drawer.id != null and drawer.id != ''">
|
|
|
+ AND a.drawer_id = #{drawer.id}
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null and companyId != ''">
|
|
|
+ AND a.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="office != null and office.id != null and office.id != ''">
|
|
|
+ AND a.office_id = #{office.id}
|
|
|
+ </if>
|
|
|
+ <if test="invoiceNumber != null and invoiceNumber != ''">
|
|
|
+ AND a.invoice_number LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{invoiceNumber}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{invoiceNumber}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{invoiceNumber},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="invoiceDate != null and invoiceDate != ''">
|
|
|
+ AND a.invoice_date = #{invoiceDate}
|
|
|
+ </if>
|
|
|
+ <if test="isInvoice != null and isInvoice != ''">
|
|
|
+ AND a.is_invoice = #{isInvoice}
|
|
|
+ </if>
|
|
|
+ <if test="isCharge != null and isCharge != ''">
|
|
|
+ AND a.is_charge = #{isCharge}
|
|
|
+ </if>
|
|
|
+ <if test="isInvalid != null and isInvalid != ''">
|
|
|
+ AND a.is_invalid = #{isInvalid}
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_parent_id LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{area.id}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{area.id}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{area.id},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="(accountCheckingUserId != null and accountCheckingUserId != '') or (accountCheckingUserName != null and accountCheckingUserName != '')">
|
|
|
+ AND (a.account_checking_user_id = #{accountCheckingUserId} or sua.name like concat('%',#{accountCheckingUserName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="widNumber != null and widNumber != ''">
|
|
|
+ AND wid.number LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{widNumber}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{widNumber}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{widNumber},'%')</if>
|
|
|
+ </if>
|
|
|
+ ${sqlMap.dsf}
|
|
|
+ </where>
|
|
|
+ ) x
|
|
|
+ </select>
|
|
|
|
|
|
<select id="queryCount" resultType="int" >
|
|
|
SELECT count(1)
|
|
|
FROM work_invoice a
|
|
|
<include refid="workInvoiceJoins"/>
|
|
|
+ left join work_invoice_detail wid on a.id = wid.invoice_id
|
|
|
+ LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
|
|
|
<!-- <if test="client != null and client.name != null and client.name != ''">-->
|
|
|
<!-- LEFT JOIN work_client_info w ON w.id = a.client_id-->
|
|
|
<!-- </if>-->
|
|
@@ -247,8 +390,11 @@
|
|
|
<if test="officeId != null and officeId != ''">
|
|
|
AND so.id = #{officeId}
|
|
|
</if>
|
|
|
- <if test="submitterId != null and submitterId != ''">
|
|
|
+ <!--<if test="submitterId != null and submitterId != ''">
|
|
|
AND a.create_by = #{submitterId}
|
|
|
+ </if>-->
|
|
|
+ <if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
|
|
|
+ AND (a.create_by = #{submitterId} or su.name like concat('%',#{submitterName},'%'))
|
|
|
</if>
|
|
|
<if test="receiptMoney != null and receiptMoney != ''">
|
|
|
AND a.receipt_money = #{receiptMoney}
|
|
@@ -292,6 +438,21 @@
|
|
|
<if test="isInvalid != null and isInvalid != ''">
|
|
|
AND a.is_invalid = #{isInvalid}
|
|
|
</if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_parent_id LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{area.id}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{area.id}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{area.id},'%')</if>
|
|
|
+ </if>
|
|
|
+ <if test="(accountCheckingUserId != null and accountCheckingUserId != '') or (accountCheckingUserName != null and accountCheckingUserName != '')">
|
|
|
+ AND (a.account_checking_user_id = #{accountCheckingUserId} or sua.name like concat('%',#{accountCheckingUserName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="widNumber != null and widNumber != ''">
|
|
|
+ AND wid.number LIKE
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{widNumber}||'%'</if>
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{widNumber}+'%'</if>
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{widNumber},'%')</if>
|
|
|
+ </if>
|
|
|
${sqlMap.dsf}
|
|
|
</where>
|
|
|
<choose>
|
|
@@ -372,7 +533,9 @@
|
|
|
ext,
|
|
|
billing_content,
|
|
|
cancellation_remark,
|
|
|
- account_checking_user_id
|
|
|
+ account_checking_user_id,
|
|
|
+ area_id,
|
|
|
+ area_parent_id
|
|
|
) VALUES (
|
|
|
#{id},
|
|
|
#{number},
|
|
@@ -412,7 +575,9 @@
|
|
|
#{ext},
|
|
|
#{billingContent},
|
|
|
#{cancellationRemark},
|
|
|
- #{accountCheckingUserId}
|
|
|
+ #{accountCheckingUserId},
|
|
|
+ #{area.id},
|
|
|
+ (select parent_ids from sys_area where id = #{area.id})
|
|
|
)
|
|
|
</insert>
|
|
|
|
|
@@ -447,12 +612,13 @@
|
|
|
company_id = #{companyId},
|
|
|
bank_number=#{bankNumber},
|
|
|
cancle_reason=#{cancleReason},
|
|
|
- officee_id=#{officeId},
|
|
|
province = #{province},
|
|
|
ext = #{ext},
|
|
|
billing_content = #{billingContent},
|
|
|
cancellation_remark = #{cancellationRemark},
|
|
|
- account_checking_user_id = #{accountCheckingUserId}
|
|
|
+ account_checking_user_id = #{accountCheckingUserId},
|
|
|
+ area_id = #{area.id},
|
|
|
+ area_parent_id = (select parent_ids from sys_area where id = #{area.id})
|
|
|
WHERE id = #{id}
|
|
|
</update>
|
|
|
|
|
@@ -639,5 +805,6 @@
|
|
|
left join work_client_info wct on wci.client_id = wct.id
|
|
|
left join project_report_data prd on prd.project_id = a.project_id
|
|
|
where invoice_id = #{invoiceId}
|
|
|
+ order by rpr.create_by asc
|
|
|
</select>
|
|
|
</mapper>
|