查询语句修改

2024年7月16日 15:04:16
This commit is contained in:
xiang2lin 2024-07-16 15:04:22 +08:00
parent 1a08603535
commit 07f80f0552
1 changed files with 35 additions and 73 deletions

View File

@ -315,74 +315,37 @@
<!-- 查询交易成功,且电子回单为空的,上传电子回单用 -->
<select id="PaymentEntity_list_base_elec_isnull" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
<!-- select
<include refid="PaymentEntity_Base_Column_List"/>
from
v_hzya_oa_cbs_all-->
-- 差旅费报销单
SELECT
formson_0210.id as oaId, -- 主表id
'formson_0210' as tableName, -- 表名
COL_SUMMARY.SUBJECT as title, -- 单据标题
unit.name as payCompany, -- 付款公司
'差旅费报销单' as billName,
'field0072' as payResultField, -- 支付结果字段
'field0073' as payDateField, -- 打款日期字段
'' as receiptFiled,-- 电子回单字段
COL_SUMMARY.id as summaryId,
formmain_0209.field0017||'-'||formson_0210.sort as referenceNum, -- 单据编号
formmain_0209.START_DATE as startDate, -- 单据日期
formmain_0209.FINISHEDFLAG as finishedflag, -- 流程状态
formson_0210.field0073 as payDate, -- 打款日期
formson_0210.field0072 as payResult, -- 支付结果
REGEXP_REPLACE(formmain_0209.field0042, '[[:space:]]', '') as payAccount, -- 付款账户
REGEXP_REPLACE(formmain_0209.field0041, '[[:space:]]', '') as payBankName, -- 付款开户行
formson_0210.field0031 as amount, -- 金额
formmain_0209.field0038 as purpose, -- 用途
formmain_0209.field0038 as cbsAbstract, -- 摘要
REGEXP_REPLACE(formson_0210.field0069, '[[:space:]]', '') as revAccount, -- 收款账户
formson_0210.field0068 as revBankName, -- 收款开户行
'' as revAccountName, -- 收款人
REGEXP_REPLACE(formson_0210.field0071, '[[:space:]]', '') as cnapsCode, -- 收款联行号
item.showvalue as personalFlag,-- 公私标记
'' as revBankType,-- 收款银行类型
'10' as currency,-- 币种
'' as busType,-- 业务类型
'' as receipt -- 电子回单
from
formson_0210
LEFT JOIN formmain_0209 ON formson_0210.FORMMAIN_ID = formmain_0209.id
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0209.id
LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id
left join CTP_ENUM_ITEM item on item.id =formson_0210.field0070
left join ORG_UNIT unit on unit.id =formmain_0209.field0002
-- left join V_USER_VIEW_ALL us on us.staffid=formmain_0209.field0024
WHERE 1=1
-- and formson_0210.field0031>0
and CTP_AFFAIR.node_name = '发起者' and CTP_AFFAIR.COMPLETE_TIME is null and CTP_AFFAIR.STATE = 3
select v.* from (
<include refid="base_sql"/>
) v
<trim prefix="where" prefixOverrides="and">
<if test="referenceNum != null and referenceNum !='' "> referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and busType = #{busType} </if>
<if test="amount != null and amount !='' ">and amount = #{amount} </if>
<if test="currency != null and currency !='' "> and currency = #{currency} </if>
<if test="payAccount != null and payAccount !='' ">and payAccount = #{payAccount} </if>
<if test="revAccount != null and revAccount !='' "> and revAccount = #{revAccount} </if>
<if test="revAccountName != null and revAccountName !='' "> and revAccountName = #{revAccountName} </if>
<if test="revBankType != null and revBankType !='' "> and revBankType = #{revBankType} </if>
<if test="revBankName != null and revBankName !='' ">and revBankName = #{revBankName} </if>
<if test="cnapsCode != null and cnapsCode !='' ">and cnapsCode = #{cnapsCode} </if>
<if test="purpose != null and purpose !='' "> and purpose = #{purpose} </if>
<if test="personalFlag != null and personalFlag !='' ">and personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and oaId = #{oaId} </if>
<if test="payCompany != null and payCompany !='' "> and payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and title = #{title} </if>
<if test="billName != null and billName !='' "> and billName = #{billName} </if>
<if test="payBankName != null and payBankName !='' ">and payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and payType = #{payType} </if>
and receipt is null and personalFlag='0' and payResult = '支付成功'
<if test="referenceNum != null and referenceNum !='' "> v.referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and v.busType = #{busType} </if>
<if test="amount != null and amount !='' ">and v.amount = #{amount} </if>
<if test="currency != null and currency !='' "> and v.currency = #{currency} </if>
<if test="payAccount != null and payAccount !='' ">and v.payAccount = #{payAccount} </if>
<if test="revAccount != null and revAccount !='' "> and v.revAccount = #{revAccount} </if>
<if test="revAccountName != null and revAccountName !='' "> and v.revAccountName = #{revAccountName} </if>
<if test="revBankType != null and revBankType !='' "> and v.revBankType = #{revBankType} </if>
<if test="revBankName != null and revBankName !='' ">and v.revBankName = #{revBankName} </if>
<if test="cnapsCode != null and cnapsCode !='' ">and v.cnapsCode = #{cnapsCode} </if>
<if test="purpose != null and purpose !='' "> and v.purpose = #{purpose} </if>
<if test="personalFlag != null and personalFlag !='' ">and v.personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and v.tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and v.oaId = #{oaId} </if>
<if test="payCompany != null and payCompany !='' "> and v.payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and v.payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and v.title = #{title} </if>
<if test="billName != null and billName !='' "> and v.billName = #{billName} </if>
<if test="payResult != null and payResult !='' ">and v.payResult = #{payResult} </if>
<if test="applyCode != null and applyCode !='' ">and v.applyCode = #{applyCode} </if>
<if test="payBankName != null and payBankName !='' ">and v.payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and v.payType = #{payType} </if>
<if test="finishedflag != null and finishedflag !='' "> and v.finishedflag = #{finishedflag} </if>
and (v.receipt is NULL OR v.receipt = '')
-- and payResult = '支付成功'
</trim>
order by v.oaId,v.sort
</select>
<!-- 查询待支付的 -->
<select id="PaymentEntity_list_base_unpaid" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
@ -426,10 +389,9 @@
<!-- 查询未完成的 采用==查询 -->
<select id="PaymentEntity_list_base_in_payment" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
select
<include refid="PaymentEntity_Base_Column_List"/>
from
v_hzya_oa_cbs
select v.* from (
<include refid="base_sql"/>
) v
<trim prefix="where" prefixOverrides="and">
<if test="referenceNum != null and referenceNum !='' "> referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and busType = #{busType} </if>
@ -452,9 +414,9 @@
<if test="payResult != null and payResult !='' ">and payResult = #{payResult} </if>
<if test="payBankName != null and payBankName !='' ">and payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and payType = #{payType} </if>
and (payResult='支付中'
or payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败'))
and personalFlag='0'
and (v.payResult='支付中'
or v.payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败'))
and v.personalFlag='0'
</trim>
</select>