This commit is contained in:
linfso 2024-07-08 14:06:05 +08:00
parent f0f7d74254
commit 957f3417cc

View File

@ -46,43 +46,165 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectEmisSettleSubBillList" parameterType="EmisSettleSubBill" resultMap="EmisSettleSubBillResult">
<include refid="selectEmisSettleSubBillVo"/>
select b.id, b.bill_no, b.parent_bill_no, b.settle_bill_no,
b.bill_code, b.bill_date, b.bill_fee, b.currency, b.settle_type,
b.bl_split, b.bill_month, b.cust_no, b.customer_code, b.customer_name,
b.bl_confirm, b.confirm_date, b.confirm_site, b.confirm_man_code,
b.bl_site_confirm, b.confirm_note, b.site_confirm_date, b.site_confirm_man_code,
b.site_confirm_note, b.del_flag, b.create_by, b.create_time, b.update_by,
b.update_time, b.create_site, b.update_site
from emis_settle_sub_bill b ,emis_waybill a
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="billNo != null and billNo != ''"> and bill_no like concat('%', #{billNo}, '%')</if>
<if test="parentBillNo != null and parentBillNo != ''"> and parent_bill_no like concat('%', #{parentBillNo}, '%')</if>
<if test="settleBillNo != null and settleBillNo != ''"> and settle_bill_no like concat('%', #{settleBillNo}, '%')</if>
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</if>
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
<if test="id != null "> and b.id = #{id}</if>
<if test="billNo != null and billNo != ''"> and FIND_IN_SET(b.`bill_no`,#{billNo}) </if>
<if test="parentBillNo != null and parentBillNo != ''"> and b.parent_bill_no=#{parentBillNo}</if>
<if test="settleBillNo != null and settleBillNo != ''"> and b.settle_bill_no=#{settleBillNo}</if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(b.`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="billDate != null "> and bill_date = #{billDate}</if>
<if test="billFee != null "> and bill_fee = #{billFee}</if>
<if test="currency != null and currency != ''"> and currency like concat('%', #{currency}, '%')</if>
<if test="settleType != null and settleType != ''"> and settle_type like concat('%', #{settleType}, '%')</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settleType != null and settleType != ''"> and settle_type=#{settleType}</if>
<if test="blSplit != null and blSplit != ''"> and bl_split=#{blSplit}</if>
<if test="billMonth != null and billMonth != ''"> and bill_month=#{billMonth}</if>
<if test="custNo != null and custNo != ''"> and cust_no=#{custNo}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code like concat('%', #{customerCode}, '%')</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="blConfirm != null and blConfirm != ''"> and bl_confirm=#{blConfirm}</if>
<if test="confirmDate != null and confirmDate != ''"> and confirm_date like concat('%', #{confirmDate}, '%')</if>
<if test="confirmSite != null and confirmSite != ''"> and confirm_site like concat('%', #{confirmSite}, '%')</if>
<if test="confirmManCode != null and confirmManCode != ''"> and confirm_man_code like concat('%', #{confirmManCode}, '%')</if>
<if test="confirmSite != null and confirmSite != ''"> and confirm_site=#{confirmSite}</if>
<if test="confirmManCode != null and confirmManCode != ''"> and confirm_man_code= #{confirmManCode}</if>
<if test="blSiteConfirm != null and blSiteConfirm != ''"> and bl_site_confirm=#{blSiteConfirm}</if>
<if test="confirmNote != null and confirmNote != ''"> and confirm_note like concat('%', #{confirmNote}, '%')</if>
<if test="siteConfirmDate != null and siteConfirmDate != ''"> and site_confirm_date like concat('%', #{siteConfirmDate}, '%')</if>
<if test="siteConfirmManCode != null and siteConfirmManCode != ''"> and site_confirm_man_code like concat('%', #{siteConfirmManCode}, '%')</if>
<if test="siteConfirmManCode != null and siteConfirmManCode != ''"> and site_confirm_man_code=#{siteConfirmManCode}</if>
<if test="siteConfirmNote != null and siteConfirmNote != ''"> and site_confirm_note like concat('%', #{siteConfirmNote}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.dispatch_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.sign_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
)
</if>
</where>
order by create_time desc
order by b.create_time desc
</select>
<select id="getQueryStatInfoMap" parameterType="EmisSettleSubBill" resultType="map">
select
count(distinct billCode) as totalNum,
round(sum(billFee),2) as totalBillFee
from emis_settle_sub_bill b ,emis_waybill a
<where>
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
<if test="id != null "> and b.id = #{id}</if>
<if test="billNo != null and billNo != ''"> and FIND_IN_SET(b.`bill_no`,#{billNo}) </if>
<if test="parentBillNo != null and parentBillNo != ''"> and b.parent_bill_no=#{parentBillNo}</if>
<if test="settleBillNo != null and settleBillNo != ''"> and b.settle_bill_no=#{settleBillNo}</if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(b.`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="billDate != null "> and bill_date = #{billDate}</if>
<if test="billFee != null "> and bill_fee = #{billFee}</if>
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
<if test="settleType != null and settleType != ''"> and settle_type=#{settleType}</if>
<if test="blSplit != null and blSplit != ''"> and bl_split=#{blSplit}</if>
<if test="billMonth != null and billMonth != ''"> and bill_month=#{billMonth}</if>
<if test="custNo != null and custNo != ''"> and cust_no=#{custNo}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="blConfirm != null and blConfirm != ''"> and bl_confirm=#{blConfirm}</if>
<if test="confirmDate != null and confirmDate != ''"> and confirm_date like concat('%', #{confirmDate}, '%')</if>
<if test="confirmSite != null and confirmSite != ''"> and confirm_site=#{confirmSite}</if>
<if test="confirmManCode != null and confirmManCode != ''"> and confirm_man_code= #{confirmManCode}</if>
<if test="blSiteConfirm != null and blSiteConfirm != ''"> and bl_site_confirm=#{blSiteConfirm}</if>
<if test="confirmNote != null and confirmNote != ''"> and confirm_note like concat('%', #{confirmNote}, '%')</if>
<if test="siteConfirmDate != null and siteConfirmDate != ''"> and site_confirm_date like concat('%', #{siteConfirmDate}, '%')</if>
<if test="siteConfirmManCode != null and siteConfirmManCode != ''"> and site_confirm_man_code=#{siteConfirmManCode}</if>
<if test="siteConfirmNote != null and siteConfirmNote != ''"> and site_confirm_note like concat('%', #{siteConfirmNote}, '%')</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.dispatch_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.sign_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or a.salesmen=#{params.privEmpName}
or a.payee=#{params.privEmpName}
)
</if>
</where>
</select>
<select id="checkUnique" parameterType="EmisSettleSubBill" resultType="int">
select count(1) from emis_settle_sub_bill
where del_flag='0'