TFeeMapper.xml 116 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.finance.mapper.TFeeMapper">
  6. <resultMap type="TFee" id="TFeeResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  10. <result property="fActId" column="f_act_id"/>
  11. <result property="fCorpid" column="f_corpid"/>
  12. <result property="tMblno" column="t_mblno"/>
  13. <result property="fTransActId" column="f_trans_act_id"/>
  14. <result property="fAmtdr" column="f_amtdr"/>
  15. <result property="fAmtcr" column="f_amtcr"/>
  16. <result property="fBilltype" column="f_billtype"/>
  17. <result property="fBillstatus" column="f_billstatus"/>
  18. <result property="fRemarks" column="f_remarks"/>
  19. <result property="fFromDate" column="f_from_date"/>
  20. <result property="fToDate" column="f_to_date"/>
  21. <result property="fAccbilldate" column="f_accbilldate"/>
  22. <result property="fRefNo" column="f_ref_no"/>
  23. <result property="delFlag" column="del_flag"/>
  24. <result property="createBy" column="create_by"/>
  25. <result property="fDeptid" column="f_deptid"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="chargingMethod" column="charging_method"/>
  30. <result property="invoiceNo" column="invoice_no"/>
  31. <result property="bank" column="bank"/>
  32. <result property="waterBillNo" column="water_bill_no"/>
  33. <result property="fSystemType" column="f_system_type"/>
  34. <result property="fTrackingNumber" column="f_tracking_number"/>
  35. <result property="fInvoiceRise" column="f_invoice_rise"/>
  36. <result property="fSign" column="f_sign"/>
  37. <result property="fSendTime" column="f_send_Time"/>
  38. <result property="fApplyMoney" column="f_apply_money"/>
  39. <result property="fAccountId" column="f_account_id"/>
  40. <result property="fMake" column="f_make"/>
  41. <result property="fVslid" column="f_vslid"/>
  42. <result property="fVoyid" column="f_voyid"/>
  43. <result property="fLoadportid" column="f_loadportid"/>
  44. <result property="fDestportid" column="f_destportid"/>
  45. <result property="fDc" column="f_dc"/>
  46. <result property="fBankNumber" column="f_bank_number"/>
  47. <result property="fReconciliation" column="f_reconciliation"/>
  48. <result property="invoiceRemarks" column="invoice_remarks"/>
  49. </resultMap>
  50. <sql id="selectTFeeVo">
  51. select f_id,
  52. f_billno,
  53. f_ctrlcorpid,
  54. f_act_id,
  55. f_corpid,
  56. t_mblno,
  57. f_trans_act_id,
  58. f_amtdr,
  59. f_amtcr,
  60. f_billtype,
  61. f_billstatus,
  62. f_remarks,
  63. f_from_date,
  64. f_to_date,
  65. f_accbilldate,
  66. f_ref_no,
  67. del_flag,
  68. create_by,
  69. f_deptid,
  70. create_time,
  71. update_by,
  72. update_time,
  73. charging_method,
  74. invoice_no,
  75. bank,
  76. water_bill_no,
  77. f_system_type,
  78. f_tracking_number,
  79. f_invoice_rise,
  80. f_sign,
  81. f_send_Time,
  82. f_apply_money,
  83. f_account_id,
  84. f_make,
  85. f_vslid,
  86. f_voyid,
  87. f_loadportid,
  88. f_destportid,
  89. f_dc,
  90. f_bank_number,
  91. f_reconciliation,
  92. invoice_remarks
  93. from t_fee
  94. </sql>
  95. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  96. select
  97. ware.f_id,
  98. ware.f_billno,
  99. ware.f_ctrlcorpid,
  100. ware.f_act_id,
  101. ware.f_corpid,
  102. ware.t_mblno,
  103. ware.f_trans_act_id,
  104. ware.f_amtdr,
  105. ware.f_amtcr,
  106. ware.f_billtype,
  107. CASE
  108. WHEN ware.f_billstatus = '1' THEN '新建'
  109. WHEN ware.f_billstatus = '2' THEN '暂存'
  110. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  111. WHEN ware.f_billstatus = '4' THEN '提交审核'
  112. WHEN ware.f_billstatus = '5' THEN '审核中'
  113. WHEN ware.f_billstatus = '6' THEN '审核完成'
  114. END
  115. AS f_billstatus,
  116. ware.f_remarks,
  117. ware.f_from_date,
  118. ware.f_to_date,
  119. ware.f_accbilldate,
  120. ware.f_ref_no,
  121. ware.del_flag,
  122. ware.create_by,
  123. ware.f_deptid,
  124. ware.create_time,
  125. ware.update_by,
  126. ware.update_time,
  127. pro.dict_label AS charging_method,
  128. ware.invoice_no,
  129. ware.bank,
  130. ware.water_bill_no,
  131. ware.f_system_type
  132. from
  133. t_fee ware
  134. left join sys_user u on ware.create_by = u.user_name
  135. left join sys_dept d on ware.f_deptid = d.dept_id
  136. LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
  137. <where>
  138. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  139. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  140. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  141. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  142. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  143. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  144. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  145. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  146. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  147. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  148. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  149. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  150. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  151. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  152. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  153. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  154. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  155. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  156. </if>
  157. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  158. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  159. </if>
  160. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  161. and ware.f_amtdr &gt;= #{amount[0]}
  162. </if>
  163. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  164. and ware.f_amtdr &lt;= #{amount[1]}
  165. </if>
  166. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  167. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  168. <if test="bank != null ">and ware.bank = #{bank}</if>
  169. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  170. <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
  171. </where>
  172. ORDER BY ware.f_id desc
  173. ${params.dataScope}
  174. </select>
  175. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  176. SELECT
  177. f.f_id AS fId,
  178. f.f_billno AS fBillno,
  179. f.f_ctrlcorpid AS fCtrlcorpid,
  180. pro.dict_label AS chargingMethod,
  181. f.invoice_no AS invoiceNo,
  182. f.bank,
  183. f.water_bill_no AS waterBillNo,
  184. f.f_corpid AS fCorpid,
  185. c.f_name AS fCorpidName,
  186. f.f_accbilldate AS fAccbilldate,
  187. f.t_mblno AS tMblno,
  188. f.f_amtdr AS fAmtdr,
  189. f.f_amtcr AS fAmtcr,
  190. f.f_billtype AS fBilltype,
  191. f.f_system_type AS fSystemType,
  192. CASE
  193. WHEN f.f_billstatus = '1' THEN '新建'
  194. WHEN f.f_billstatus = '2' THEN '暂存'
  195. WHEN f.f_billstatus = '3' THEN '审批驳回'
  196. WHEN f.f_billstatus = '4' THEN '提交审核'
  197. WHEN f.f_billstatus = '5' THEN '审核中'
  198. WHEN f.f_billstatus = '6' THEN '审核完成'
  199. END
  200. AS fBillstatus,
  201. f.f_remarks AS fRemarks,
  202. f.create_by AS createBy,
  203. tp.f_name AS createName,
  204. f.create_time createTime,
  205. f.update_by updateBy,
  206. f.update_time
  207. FROM
  208. t_fee AS f
  209. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  210. left join sys_user u on f.create_by = u.user_name
  211. left join sys_dept d on f.f_deptid = d.dept_id
  212. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  213. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  214. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  215. <where>
  216. <if test="fId != null ">and f.f_id = #{fId}</if>
  217. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  218. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  219. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  220. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  221. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  222. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  223. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  224. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  225. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  226. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  227. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  228. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  229. and f.f_accbilldate &gt;= #{timeInterval[0]}
  230. </if>
  231. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  232. and f.f_accbilldate &lt;= #{timeInterval[1]}
  233. </if>
  234. <if test='money != null and money[0] != null and money[0]!= ""'>
  235. and f.f_amtdr &gt;= #{money[0]}
  236. </if>
  237. <if test='money != null and money[1] != null and money[1]!= ""'>
  238. and f.f_amtdr &lt;= #{money[1]}
  239. </if>
  240. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  241. and f.f_amtdr &gt;= #{amount[0]}
  242. </if>
  243. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  244. and f.f_amtdr &lt;= #{amount[1]}
  245. </if>
  246. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  247. and f.create_time &gt;= #{applyTime[0]}
  248. </if>
  249. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  250. and f.create_time &lt;= #{applyTime[1]}
  251. </if>
  252. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  253. <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
  254. <if test="bank != null ">and f.bank = #{bank}</if>
  255. <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
  256. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  257. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  258. </where>
  259. ORDER BY f.f_id desc
  260. ${params.dataScope}
  261. </select>
  262. <!--凯和查询财务信息-->
  263. <select id="selectFinancialTFeeList" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  264. SELECT
  265. DISTINCT
  266. f.f_id AS fId,
  267. f.f_billno AS fBillno,
  268. f.f_ctrlcorpid AS fCtrlcorpid,
  269. pro.dict_label AS chargingMethod,
  270. f.invoice_no AS invoiceNo,
  271. f.bank AS fBank,
  272. f.water_bill_no AS waterBillNo,
  273. f.f_corpid AS fCorpid,
  274. c.f_name AS fCorpidName,
  275. f.f_accbilldate AS fAccbilldate,
  276. f.t_mblno AS tMblno,
  277. f.f_amtdr AS fAmtdr,
  278. f.f_amtcr AS fAmtcr,
  279. f.f_billtype AS fBilltype,
  280. f.f_system_type AS fSystemType,
  281. f.f_billstatus AS fBillstatus,
  282. CASE
  283. WHEN f.f_billstatus = '1' THEN '新建'
  284. WHEN f.f_billstatus = '2' THEN '暂存'
  285. WHEN f.f_billstatus = '3' THEN '审批驳回'
  286. WHEN f.f_billstatus = '4' THEN '提交审核'
  287. WHEN f.f_billstatus = '5' THEN '审核中'
  288. WHEN f.f_billstatus = '6' THEN '审核完成'
  289. END
  290. AS fBillstatusName,
  291. f.f_remarks AS fRemarks,
  292. f.create_by AS createBy,
  293. f.create_time AS createTime,
  294. f.update_by AS updateBy,
  295. f.update_time AS updateTime,
  296. tv.f_name AS vessel,
  297. ty.f_no AS voyage,
  298. tre.f_name AS loadportName,
  299. ts.f_name AS destportName,
  300. f.f_bank_number AS fBankNumber,
  301. f.bank AS bank,
  302. f.invoice_remarks AS invoiceRemarks,
  303. CASE
  304. WHEN f.f_dc = 'D' THEN
  305. '收'
  306. WHEN f.f_dc = 'C' THEN
  307. '付'
  308. END AS fSrcdcName
  309. FROM
  310. t_fee AS f
  311. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  312. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  313. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  314. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  315. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  316. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  317. LEFT JOIN t_fee_do tf ON tf.f_pid = f.f_id
  318. LEFT JOIN t_warehousebillsfees tb ON tb.f_id = tf.f_srcid
  319. <where>
  320. <if test="fId != null ">and f.f_id = #{fId}</if>
  321. <if test="fBillno != null and fBillno != ''">and f.f_billno like concat('%', #{fBillno}, '%')</if>
  322. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  323. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  324. <if test="tMblno != null and tMblno != ''">and tb.f_mblno like concat('%', #{tMblno}, '%')</if>
  325. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  326. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  327. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  328. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  329. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  330. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  331. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  332. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  333. and f.f_accbilldate &gt;= #{timeInterval[0]}
  334. </if>
  335. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  336. and f.f_accbilldate &lt;= #{timeInterval[1]}
  337. </if>
  338. <if test='money != null and money[0] != null and money[0]!= ""'>
  339. and f.f_amtdr &gt;= #{money[0]}
  340. </if>
  341. <if test='money != null and money[1] != null and money[1]!= ""'>
  342. and f.f_amtdr &lt;= #{money[1]}
  343. </if>
  344. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  345. and f.f_amtdr &gt;= #{amount[0]}
  346. </if>
  347. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  348. and f.f_amtdr &lt;= #{amount[1]}
  349. </if>
  350. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  351. and f.create_time &gt;= #{applyTime[0]}
  352. </if>
  353. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  354. and f.create_time &lt;= #{applyTime[1]}
  355. </if>
  356. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  357. <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  358. <if test="bank != null ">and f.bank like concat('%', #{bank}, '%')</if>
  359. <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%')</if>
  360. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  361. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  362. <if test="fVslid != null ">and f.f_vslid = #{fVslid}</if>
  363. <if test="fVoyid != null ">and f.f_voyid = #{fVoyid}</if>
  364. <if test="fLoadportid != null ">and f.f_loadportid = #{fLoadportid}</if>
  365. <if test="fDestportid != null ">and f.f_destportid = #{fDestportid}</if>
  366. <if test="fDc != null and fDc != ''">and f.f_dc = #{fDc}</if>
  367. <if test="fBankNumber != null and fBankNumber != ''">and f.f_bank_number like concat('%', #{fBankNumber},
  368. '%')
  369. </if>
  370. <if test="fReconciliation != null ">and f.f_reconciliation = #{fReconciliation}</if>
  371. </where>
  372. ORDER BY f.f_id desc
  373. </select>
  374. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  375. <include refid="selectTFeeVo"/>
  376. where f_id = #{fId}
  377. </select>
  378. <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
  379. SELECT f.f_id,
  380. f.f_billno,
  381. f.f_ctrlcorpid,
  382. f.f_corpid,
  383. c.f_name AS fCorpidName,
  384. f.f_accbilldate,
  385. f.t_mblno,
  386. f.f_amtdr,
  387. f.f_amtcr,
  388. f.f_billtype,
  389. f.f_system_type,
  390. f.f_billstatus,
  391. f.f_remarks,
  392. f.create_by,
  393. tp.f_name AS createName,
  394. f.create_time,
  395. f.update_by,
  396. f.update_time,
  397. tn.f_taxrate AS fTaxrate,
  398. f.charging_method,
  399. f.invoice_no,
  400. f.bank,
  401. f.water_bill_no
  402. FROM t_fee AS f
  403. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  404. left join sys_user u on f.create_by = u.user_name
  405. left join sys_dept d on f.f_deptid = d.dept_id
  406. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  407. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  408. LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  409. where f.f_id = #{fId}
  410. </select>
  411. <!--凯和确认账单查询-->
  412. <select id="webVersionTFee" parameterType="TFee" resultType="map">
  413. SELECT
  414. f.f_id AS fId,
  415. f.f_billno AS fBillno,
  416. f.f_ctrlcorpid AS fCtrlcorpid,
  417. c.f_name AS fCorpidName,
  418. f.f_accbilldate AS fAccbilldate,
  419. f.t_mblno AS tMblno,
  420. f.f_amtdr AS fAmtdr,
  421. f.f_amtcr AS fAmtcr,
  422. f.f_billtype AS filltype,
  423. f.f_remarks AS fRemarks,
  424. f.create_by AS createBy,
  425. tp.f_name AS createName,
  426. f.create_time AS createTime,
  427. f.update_by AS updateBy,
  428. f.update_time AS updateTime,
  429. tn.f_taxrate AS fTaxrate,
  430. f.charging_method AS chargingMethod,
  431. f.invoice_no AS invoiceNo,
  432. f.bank AS bank,
  433. f.water_bill_no AS waterBillNo,
  434. CASE
  435. WHEN f.f_billstatus = '1' THEN '新建'
  436. WHEN f.f_billstatus = '2' THEN '暂存'
  437. WHEN f.f_billstatus = '3' THEN '审批驳回'
  438. WHEN f.f_billstatus = '4' THEN '提交审核'
  439. WHEN f.f_billstatus = '5' THEN '审核中'
  440. WHEN f.f_billstatus = '6' THEN '审核完成'
  441. END
  442. AS fBillstatus
  443. FROM
  444. t_fee AS f
  445. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  446. left join sys_user u on f.create_by = u.user_name
  447. left join sys_dept d on f.f_deptid = d.dept_id
  448. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  449. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  450. LEFT JOIN(SELECT ti.f_pid,ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  451. <where>
  452. f.f_make = 0
  453. <if test="fId != null ">and f.f_id = #{fId}</if>
  454. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  455. <if test="createId != null ">and tp.f_id = #{createId}</if>
  456. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  457. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid like concat('%',
  458. #{fCtrlcorpid},'%')
  459. </if>
  460. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  461. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  462. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  463. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  464. and f.f_accbilldate &gt;= #{timeInterval[0]}
  465. </if>
  466. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  467. and f.f_accbilldate &lt;= #{timeInterval[1]}
  468. </if>
  469. </where>
  470. ORDER BY f.f_id desc
  471. </select>
  472. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  473. insert into t_fee
  474. <trim prefix="(" suffix=")" suffixOverrides=",">
  475. <if test="fId != null">f_id,</if>
  476. <if test="fBillno != null">f_billno,</if>
  477. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  478. <if test="fActId != null">f_act_id,</if>
  479. <if test="fCorpid != null">f_corpid,</if>
  480. <if test="tMblno != null">t_mblno,</if>
  481. <if test="fTransActId != null">f_trans_act_id,</if>
  482. <if test="fAmtdr != null">f_amtdr,</if>
  483. <if test="fAmtcr != null">f_amtcr,</if>
  484. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  485. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  486. <if test="fRemarks != null">f_remarks,</if>
  487. <if test="fFromDate != null">f_from_date,</if>
  488. <if test="fToDate != null">f_to_date,</if>
  489. <if test="fAccbilldate != null">f_accbilldate,</if>
  490. <if test="fRefNo != null">f_ref_no,</if>
  491. <if test="delFlag != null">del_flag,</if>
  492. <if test="createBy != null">create_by,</if>
  493. <if test="fDeptid != null">f_deptid,</if>
  494. <if test="createTime != null">create_time,</if>
  495. <if test="updateBy != null">update_by,</if>
  496. <if test="updateTime != null">update_time,</if>
  497. <if test="chargingMethod != null">charging_method,</if>
  498. <if test="invoiceNo != null">invoice_no,</if>
  499. <if test="bank != null">bank,</if>
  500. <if test="waterBillNo != null">water_bill_no,</if>
  501. <if test="fSystemType != null">f_system_type,</if>
  502. <if test="fTrackingNumber != null">f_tracking_number,</if>
  503. <if test="fInvoiceRise != null">f_invoice_rise,</if>
  504. <if test="fSign != null">f_sign,</if>
  505. <if test="fSendTime != null">f_send_Time,</if>
  506. <if test="fApplyMoney != null">f_apply_money,</if>
  507. <if test="fAccountId != null">f_account_id,</if>
  508. <if test="fMake != null">f_make,</if>
  509. <if test="fVslid != null">f_vslid,</if>
  510. <if test="fVoyid != null">f_voyid,</if>
  511. <if test="fLoadportid != null">f_loadportid,</if>
  512. <if test="fDestportid != null">f_destportid,</if>
  513. <if test="fDc != null">f_dc,</if>
  514. <if test="fBankNumber != null">f_bank_number,</if>
  515. <if test="fReconciliation != null">f_reconciliation,</if>
  516. <if test="invoiceRemarks != null">invoice_remarks,</if>
  517. </trim>
  518. <trim prefix="values (" suffix=")" suffixOverrides=",">
  519. <if test="fId != null">#{fId},</if>
  520. <if test="fBillno != null">#{fBillno},</if>
  521. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  522. <if test="fActId != null">#{fActId},</if>
  523. <if test="fCorpid != null">#{fCorpid},</if>
  524. <if test="tMblno != null">#{tMblno},</if>
  525. <if test="fTransActId != null">#{fTransActId},</if>
  526. <if test="fAmtdr != null">#{fAmtdr},</if>
  527. <if test="fAmtcr != null">#{fAmtcr},</if>
  528. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  529. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  530. <if test="fRemarks != null">#{fRemarks},</if>
  531. <if test="fFromDate != null">#{fFromDate},</if>
  532. <if test="fToDate != null">#{fToDate},</if>
  533. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  534. <if test="fRefNo != null">#{fRefNo},</if>
  535. <if test="delFlag != null">#{delFlag},</if>
  536. <if test="createBy != null">#{createBy},</if>
  537. <if test="fDeptid != null">#{fDeptid},</if>
  538. <if test="createTime != null">#{createTime},</if>
  539. <if test="updateBy != null">#{updateBy},</if>
  540. <if test="updateTime != null">#{updateTime},</if>
  541. <if test="chargingMethod != null">#{chargingMethod},</if>
  542. <if test="invoiceNo != null">#{invoiceNo},</if>
  543. <if test="bank != null">#{bank},</if>
  544. <if test="waterBillNo != null">#{waterBillNo},</if>
  545. <if test="fSystemType != null">#{fSystemType},</if>
  546. <if test="fTrackingNumber != null">#{fTrackingNumber},</if>
  547. <if test="fInvoiceRise != null">#{fInvoiceRise},</if>
  548. <if test="fSign != null">#{fSign},</if>
  549. <if test="fSendTime != null">#{fSendTime},</if>
  550. <if test="fApplyMoney != null">#{fApplyMoney},</if>
  551. <if test="fAccountId != null">#{fAccountId},</if>
  552. <if test="fMake != null">#{fMake},</if>
  553. <if test="fVslid != null">#{fVslid},</if>
  554. <if test="fVoyid != null">#{fVoyid},</if>
  555. <if test="fLoadportid != null">#{fLoadportid},</if>
  556. <if test="fDestportid != null">#{fDestportid},</if>
  557. <if test="fDc != null">#{fDc},</if>
  558. <if test="fBankNumber != null">#{fBankNumber},</if>
  559. <if test="fReconciliation != null">#{fReconciliation},</if>
  560. <if test="invoiceRemarks != null">#{invoiceRemarks},</if>
  561. </trim>
  562. </insert>
  563. <update id="updateTFee" parameterType="TFee">
  564. update t_fee
  565. <trim prefix="SET" suffixOverrides=",">
  566. <if test="fBillno != null">f_billno = #{fBillno},</if>
  567. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  568. <if test="fActId != null">f_act_id = #{fActId},</if>
  569. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  570. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  571. <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
  572. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  573. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  574. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  575. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  576. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  577. <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
  578. <if test="fToDate != null">f_to_date = #{fToDate},</if>
  579. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  580. <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
  581. <if test="delFlag != null">del_flag = #{delFlag},</if>
  582. <if test="createBy != null">create_by = #{createBy},</if>
  583. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  584. <if test="createTime != null">create_time = #{createTime},</if>
  585. <if test="updateBy != null">update_by = #{updateBy},</if>
  586. <if test="updateTime != null">update_time = #{updateTime},</if>
  587. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  588. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  589. <if test="bank != null">bank = #{bank},</if>
  590. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  591. <if test="fSystemType != null">f_system_type = #{fSystemType},</if>
  592. <if test="fTrackingNumber != null">f_tracking_number = #{fTrackingNumber},</if>
  593. <if test="fInvoiceRise != null">f_invoice_rise = #{fInvoiceRise},</if>
  594. <if test="fSign != null">f_sign = #{fSign},</if>
  595. <if test="fSendTime != null">f_send_Time = #{fSendTime},</if>
  596. <if test="fApplyMoney != null">f_apply_money = #{fApplyMoney},</if>
  597. <if test="fAccountId != null">f_account_id = #{fAccountId},</if>
  598. <if test="fMake != null">f_make = #{fMake},</if>
  599. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  600. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  601. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  602. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  603. <if test="fDc != null">f_dc = #{fDc},</if>
  604. <if test="fBankNumber != null">f_bank_number = #{fBankNumber},</if>
  605. <if test="fReconciliation != null">f_reconciliation = #{fReconciliation},</if>
  606. <if test="invoiceRemarks != null">invoice_remarks = #{invoiceRemarks},</if>
  607. </trim>
  608. where f_id = #{fId}
  609. </update>
  610. <delete id="deleteTFeeById" parameterType="Long">
  611. delete
  612. from t_fee
  613. where f_id = #{fId}
  614. </delete>
  615. <delete id="deleteTFeeByIds" parameterType="String">
  616. delete
  617. f.*,
  618. fd.* ,
  619. fi.*
  620. from
  621. t_fee f
  622. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  623. LEFT JOIN t_fee_invoice fi ON fi.f_pid = f.f_id
  624. where f.f_id in
  625. <foreach item="fId" collection="array" open="(" separator="," close=")">
  626. #{fId}
  627. </foreach>
  628. </delete>
  629. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  630. SELECT
  631. w.f_id AS fSrcid,
  632. t.f_id AS fSrcpid,
  633. t.f_corpid AS fCorpid,
  634. c.f_name AS fName,
  635. c.f_id AS fId,
  636. c.f_name AS fFeesName,
  637. t.f_bscorpno AS fBscorpno,
  638. w.f_mblno AS fMblno,
  639. w.f_product_name AS fProductName,
  640. w.f_bsdate AS fBsdate,
  641. t.f_billtype AS fBilltype,
  642. t.f_review_date AS fReviewDate,
  643. w.f_feeid AS fFeeid,
  644. w.src_bill_no AS srcBillNo,
  645. w.f_marks AS fMarks,
  646. w.f_chargedate AS fChargedate,
  647. w.f_billing_days AS fBillingDays,
  648. w.f_billing_deadline AS fBillingDeadline,
  649. w.f_inventory_days AS fInventoryDays,
  650. w.f_originalbilldate AS fOriginalbilldate,
  651. f.f_name AS fFeeName,
  652. w.f_dc AS fSrcdc,
  653. CASE
  654. WHEN w.f_dc = 'D' THEN
  655. '收'
  656. WHEN w.f_dc = 'C' THEN
  657. '付'
  658. END AS fSrcdcName,
  659. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  660. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  661. w.f_business_type AS fBusinessType
  662. FROM
  663. t_warehousebillsfees w
  664. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  665. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  666. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  667. <where>
  668. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  669. #{map.tWareHouseFees.fCorpid}
  670. </if>
  671. <if test="map.tWareHouseFees.stlTypeid != null and map.tWareHouseFees.stlTypeid != ''">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
  672. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  673. #{map.tWareHouseFees.fToCorpid}
  674. </if>
  675. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  676. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  677. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  678. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  679. </if>
  680. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  681. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  682. </if>
  683. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  684. and w.f_accamount_date IS NOT NULL
  685. </if>
  686. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  687. and w.f_accamount_date IS NULL
  688. </if>
  689. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  690. and w.f_dc = #{map.tWareHouseFees.fDc}
  691. </if>
  692. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  693. and w.f_dc = #{map.tWareHouseFees.fDc}
  694. </if>
  695. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  696. and w.f_feeid in
  697. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  698. separator=",">
  699. #{id}
  700. </foreach>
  701. </if>
  702. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  703. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  704. </if>
  705. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  706. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  707. </if>
  708. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  709. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  710. </if>
  711. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  712. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  713. </if>
  714. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  715. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  716. </if>
  717. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  718. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  719. </if>
  720. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  721. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  722. </if>
  723. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  724. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  725. </if>
  726. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  727. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  728. </if>
  729. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  730. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  731. </if>
  732. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  733. and w.f_business_type in
  734. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  735. #{id}
  736. </foreach>
  737. </if>
  738. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  739. and w.f_id in
  740. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  741. separator=",">
  742. #{id}
  743. </foreach>
  744. </if>
  745. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  746. and t.f_id in
  747. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  748. separator=",">
  749. #{id}
  750. </foreach>
  751. </if>
  752. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  753. </if>
  754. and w.f_review_date IS NOT NULL
  755. and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_stlamount, 0)) &gt; 0
  756. GROUP BY w.f_id
  757. </where>
  758. </select>
  759. <select id="warehouseApplyFPFeesList" resultType="java.util.Map">
  760. SELECT
  761. w.f_id AS fSrcid,
  762. t.f_id AS fSrcpid,
  763. t.f_corpid AS fCorpid,
  764. c.f_name AS fName,
  765. w.fId AS fId,
  766. w.fName AS fFeesName,
  767. t.f_bscorpno AS fBscorpno,
  768. w.f_mblno AS fMblno,
  769. w.f_product_name AS fProductName,
  770. w.f_bsdate AS fBsdate,
  771. t.f_billtype AS fBilltype,
  772. t.f_review_date AS fReviewDate,
  773. w.f_feeid AS fFeeid,
  774. w.src_bill_no AS srcBillNo,
  775. w.f_marks AS fMarks,
  776. w.f_chargedate AS fChargedate,
  777. w.f_billing_days AS fBillingDays,
  778. w.f_billing_deadline AS fBillingDeadline,
  779. w.f_inventory_days AS fInventoryDays,
  780. w.f_originalbilldate AS fOriginalbilldate,
  781. f.f_name AS fFeeName,
  782. w.f_dc AS fSrcdc,
  783. CASE
  784. WHEN w.f_dc = 'D' THEN '收'
  785. WHEN w.f_dc = 'C' THEN '付'
  786. END AS fSrcdcName,
  787. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmtdr,
  788. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmt,
  789. dict.dict_label AS fFeeunitid,
  790. w.f_qty AS fQty,
  791. w.f_unitprice AS fUnitprice,
  792. w.f_currency AS fCurreny,
  793. w.f_taxrate AS fTaxrate,
  794. w.remark AS remark,
  795. tv.f_name AS boatName,
  796. ty.f_no AS voyageName,
  797. w.create_time createTime,
  798. w.businessName,
  799. t.f_loadportid AS fLoadportid,
  800. t.f_destportid AS fDestportid
  801. FROM
  802. t_warehousebills t
  803. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  804. LEFT JOIN (
  805. SELECT
  806. f.f_id AS f_id,
  807. f.f_pid AS f_pid,
  808. f.f_lineno AS f_lineno,
  809. f.f_corpid,
  810. f.f_feeid,
  811. f.f_feeUnitid,
  812. f.f_qty,
  813. f.f_unitprice,
  814. f.f_amount,
  815. f.f_currency,
  816. f.f_exrate,
  817. f.f_taxrate,
  818. f.f_dc,
  819. f.f_billstatus,
  820. f.f_statement_no,
  821. f.f_accamount,
  822. f.f_accamount_date,
  823. f.f_stlamount_no,
  824. f.f_stlamount,
  825. f.f_stlamount_date,
  826. f.f_invnos,
  827. f.f_invamount,
  828. f.f_askamount,
  829. f.f_chargedate,
  830. f.f_status,
  831. f.remark,
  832. f.f_mblno,
  833. f.f_product_name,
  834. f.src_bill_no,
  835. f.f_billing_days,
  836. f.f_inventory_days,
  837. f.f_marks,
  838. f.f_billing_deadline,
  839. f.f_originalbilldate,
  840. f.f_billtype,
  841. f.f_business_type,
  842. pro.dict_label businessName,
  843. f.f_bsdate,
  844. c.f_id AS fId,
  845. c.f_name AS fName,f.create_time
  846. FROM
  847. t_warehousebillsfees AS f
  848. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  849. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  850. ) w ON w.f_pid = t.f_id
  851. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  852. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  853. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  854. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  855. <where>
  856. dict.status = '0'
  857. AND dict.dict_type = 'data_unitfees'
  858. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  859. #{map.tWareHouseFees.fCorpid}
  860. </if>
  861. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  862. #{map.tWareHouseFees.fToCorpid}
  863. </if>
  864. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  865. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  866. </if>
  867. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  868. </if>
  869. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  870. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  871. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  872. </if>
  873. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  874. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  875. </if>
  876. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  877. and w.f_accamount_date IS NOT NULL
  878. </if>
  879. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  880. and w.f_accamount_date IS NULL
  881. </if>
  882. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  883. and w.f_dc = #{map.tWareHouseFees.fDc}
  884. </if>
  885. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  886. and w.f_dc = #{map.tWareHouseFees.fDc}
  887. </if>
  888. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  889. and w.f_feeid in
  890. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  891. separator=",">
  892. #{id}
  893. </foreach>
  894. </if>
  895. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  896. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  897. </if>
  898. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  899. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  900. </if>
  901. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  902. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  903. </if>
  904. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  905. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  906. </if>
  907. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  908. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  909. </if>
  910. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  911. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  912. </if>
  913. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  914. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  915. </if>
  916. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  917. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  918. </if>
  919. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  920. and w.f_business_type in
  921. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  922. #{id}
  923. </foreach>
  924. </if>
  925. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  926. and w.f_id in
  927. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  928. separator=",">
  929. #{id}
  930. </foreach>
  931. </if>
  932. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  933. and t.f_id in
  934. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  935. separator=",">
  936. #{id}
  937. </foreach>
  938. </if>
  939. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  940. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  941. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  942. #{map.tWareHouseFees.boatName}
  943. </if>
  944. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no like
  945. concat('%', #{map.tWareHouseFees.voyageName}, '%')
  946. </if>
  947. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name like
  948. concat('%', #{map.tWareHouseFees.fName}, '%')
  949. </if>
  950. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  951. </if>
  952. and t.f_review_date IS NOT NULL
  953. and ifnull(w.f_amount, 0) - ifnull(w.f_askamount, 0) > 0
  954. GROUP BY w.f_id
  955. </where>
  956. </select>
  957. <select id="warehouseInvoiceFPFeesList" resultType="java.util.Map">
  958. SELECT
  959. w.f_id AS fSrcid,
  960. t.f_id AS fSrcpid,
  961. t.f_corpid AS fCorpid,
  962. c.f_name AS fName,
  963. w.fId AS fId,
  964. w.fName AS fFeesName,
  965. t.f_bscorpno AS fBscorpno,
  966. w.f_mblno AS fMblno,
  967. w.f_product_name AS fProductName,
  968. w.f_bsdate AS fBsdate,
  969. t.f_billtype AS fBilltype,
  970. t.f_review_date AS fReviewDate,
  971. w.f_feeid AS fFeeid,
  972. w.src_bill_no AS srcBillNo,
  973. w.f_marks AS fMarks,
  974. w.f_chargedate AS fChargedate,
  975. w.f_billing_days AS fBillingDays,
  976. w.f_billing_deadline AS fBillingDeadline,
  977. w.f_inventory_days AS fInventoryDays,
  978. w.f_originalbilldate AS fOriginalbilldate,
  979. f.f_name AS fFeeName,
  980. w.f_dc AS fSrcdc,
  981. CASE
  982. WHEN w.f_dc = 'D' THEN '收'
  983. WHEN w.f_dc = 'C' THEN '付'
  984. END AS fSrcdcName,
  985. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
  986. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
  987. dict.dict_label AS fFeeunitid,
  988. w.f_qty AS fQty,
  989. w.f_unitprice AS fUnitprice,
  990. w.f_currency AS fCurreny,
  991. w.f_taxrate AS fTaxrate,
  992. w.remark AS remark,
  993. tv.f_name AS boatName,
  994. ty.f_no AS voyageName,
  995. w.create_time createTime,
  996. w.businessName
  997. FROM
  998. t_warehousebills t
  999. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1000. LEFT JOIN (
  1001. SELECT
  1002. f.f_id AS f_id,
  1003. f.f_pid AS f_pid,
  1004. f.f_lineno AS f_lineno,
  1005. f.f_corpid,
  1006. f.f_feeid,
  1007. f.f_feeUnitid,
  1008. f.f_qty,
  1009. f.f_unitprice,
  1010. f.f_amount,
  1011. f.f_currency,
  1012. f.f_exrate,
  1013. f.f_taxrate,
  1014. f.f_dc,
  1015. f.f_billstatus,
  1016. f.f_statement_no,
  1017. f.f_accamount,
  1018. f.f_accamount_date,
  1019. f.f_stlamount_no,
  1020. f.f_stlamount,
  1021. f.f_stlamount_date,
  1022. f.f_invnos,
  1023. f.f_invamount,
  1024. f.f_askamount,
  1025. f.f_chargedate,
  1026. f.f_status,
  1027. f.remark,
  1028. f.f_mblno,
  1029. f.f_product_name,
  1030. f.src_bill_no,
  1031. f.f_billing_days,
  1032. f.f_inventory_days,
  1033. f.f_marks,
  1034. f.f_billing_deadline,
  1035. f.f_originalbilldate,
  1036. f.f_billtype,
  1037. f.f_business_type,
  1038. pro.dict_label businessName,
  1039. f.f_bsdate,
  1040. c.f_id AS fId,
  1041. c.f_name AS fName,f.create_time
  1042. FROM
  1043. t_warehousebillsfees AS f
  1044. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1045. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  1046. ) w ON w.f_pid = t.f_id
  1047. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1048. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1049. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1050. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1051. <where>
  1052. dict.status = '0'
  1053. AND dict.dict_type = 'data_unitfees'
  1054. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1055. #{map.tWareHouseFees.fCorpid}
  1056. </if>
  1057. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1058. #{map.tWareHouseFees.fToCorpid}
  1059. </if>
  1060. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1061. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1062. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1063. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1064. </if>
  1065. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1066. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1067. </if>
  1068. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1069. and w.f_accamount_date IS NOT NULL
  1070. </if>
  1071. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1072. and w.f_accamount_date IS NULL
  1073. </if>
  1074. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1075. and w.f_dc = #{map.tWareHouseFees.fDc}
  1076. </if>
  1077. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1078. and w.f_dc = #{map.tWareHouseFees.fDc}
  1079. </if>
  1080. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1081. and w.f_feeid in
  1082. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1083. separator=",">
  1084. #{id}
  1085. </foreach>
  1086. </if>
  1087. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1088. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1089. </if>
  1090. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1091. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1092. </if>
  1093. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1094. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1095. </if>
  1096. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1097. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1098. </if>
  1099. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1100. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1101. </if>
  1102. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1103. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1104. </if>
  1105. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1106. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1107. </if>
  1108. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1109. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1110. </if>
  1111. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1112. and w.f_business_type in
  1113. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1114. #{id}
  1115. </foreach>
  1116. </if>
  1117. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1118. and w.f_id in
  1119. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1120. separator=",">
  1121. #{id}
  1122. </foreach>
  1123. </if>
  1124. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1125. and t.f_id in
  1126. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1127. separator=",">
  1128. #{id}
  1129. </foreach>
  1130. </if>
  1131. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1132. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1133. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1134. #{map.tWareHouseFees.boatName}
  1135. </if>
  1136. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1137. #{map.tWareHouseFees.voyageName}
  1138. </if>
  1139. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
  1140. concat('%', #{map.tWareHouseFees.fName}, '%')
  1141. </if>
  1142. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1143. </if>
  1144. and t.f_review_date IS NOT NULL
  1145. and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
  1146. GROUP BY w.f_id
  1147. </where>
  1148. </select>
  1149. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1150. SELECT
  1151. w.f_id AS fSrcid,
  1152. t.f_id AS fSrcpid,
  1153. t.f_corpid AS fCorpid,
  1154. c.f_name AS fName,
  1155. c.f_name AS fFeesName,
  1156. t.f_bscorpno AS fBscorpno,
  1157. w.f_mblno AS fMblno,
  1158. w.f_product_name AS fProductName,
  1159. w.f_bsdate AS fBsdate,
  1160. t.f_billtype AS fBilltype,
  1161. t.f_review_date AS fReviewDate,
  1162. w.f_marks AS fMarks,
  1163. w.f_feeid AS fFeeid,
  1164. w.f_billtype AS fBilltype,
  1165. w.f_chargedate AS fChargedate,
  1166. w.f_originalbilldate AS fOriginalbilldate,
  1167. w.f_billing_deadline AS fBillingDeadline,
  1168. w.f_billing_days AS fBillingDays,
  1169. w.f_inventory_days AS fInventoryDays,
  1170. f.f_name AS fFeeName,
  1171. w.f_dc AS fSrcdc,
  1172. CASE
  1173. WHEN w.f_dc = 'D' THEN
  1174. '收'
  1175. WHEN w.f_dc = 'C' THEN
  1176. '付'
  1177. END AS fSrcdcName,
  1178. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1179. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1180. dict.dict_label AS fFeeunitid,
  1181. w.f_qty AS fQty,
  1182. w.f_unitprice AS fUnitprice,
  1183. w.f_business_type AS fBusinessType
  1184. FROM
  1185. t_warehousebillsfees w
  1186. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1187. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1188. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1189. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1190. <where>
  1191. dict.status = '0'
  1192. AND dict.dict_type = 'data_unitfees'
  1193. <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
  1194. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  1195. #{map.tWareHouseFees.fCorpid}
  1196. </if>
  1197. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1198. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1199. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1200. #{map.tWareHouseFees.fToCorpid}
  1201. </if>
  1202. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1203. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1204. </if>
  1205. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1206. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1207. </if>
  1208. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1209. and w.f_accamount_date IS NOT NULL
  1210. </if>
  1211. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1212. and w.f_accamount_date IS NULL
  1213. </if>
  1214. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1215. and w.f_dc = #{map.tWareHouseFees.fDc}
  1216. </if>
  1217. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1218. and w.f_dc = #{map.tWareHouseFees.fDc}
  1219. </if>
  1220. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1221. and w.f_feeid in
  1222. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1223. separator=",">
  1224. #{id}
  1225. </foreach>
  1226. </if>
  1227. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1228. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1229. </if>
  1230. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1231. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1232. </if>
  1233. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1234. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1235. </if>
  1236. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1237. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1238. </if>
  1239. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1240. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1241. </if>
  1242. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1243. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1244. </if>
  1245. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1246. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1247. </if>
  1248. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1249. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1250. </if>
  1251. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1252. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1253. </if>
  1254. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1255. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1256. </if>
  1257. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1258. and w.f_business_type in
  1259. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1260. #{id}
  1261. </foreach>
  1262. </if>
  1263. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1264. and w.f_id in
  1265. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1266. separator=",">
  1267. #{id}
  1268. </foreach>
  1269. </if>
  1270. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1271. and t.f_id in
  1272. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1273. separator=",">
  1274. #{id}
  1275. </foreach>
  1276. </if>
  1277. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1278. </if>
  1279. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1280. and w.create_by = #{map.tWareHouseFees.createBy}
  1281. </if>
  1282. and w.f_review_date IS NOT NULL
  1283. and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_accamount, 0)) &gt; 0
  1284. GROUP BY w.f_id
  1285. </where>
  1286. </select>
  1287. <!--
  1288. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1289. SELECT
  1290. w.f_id AS fSrcid,
  1291. t.f_id AS fSrcpid,
  1292. t.f_corpid AS fCorpid,
  1293. c.f_name AS fName,
  1294. w.fName AS fFeesName,
  1295. t.f_bscorpno AS fBscorpno,
  1296. w.f_mblno AS fMblno,
  1297. w.f_product_name AS fProductName,
  1298. w.f_bsdate AS fBsdate,
  1299. t.f_billtype AS fBilltype,
  1300. t.f_review_date AS fReviewDate,
  1301. w.f_marks AS fMarks,
  1302. w.f_feeid AS fFeeid,
  1303. w.f_billtype AS fBilltype,
  1304. w.f_chargedate AS fChargedate,
  1305. w.f_originalbilldate AS fOriginalbilldate,
  1306. w.f_billing_deadline AS fBillingDeadline,
  1307. w.f_billing_days AS fBillingDays,
  1308. w.f_inventory_days AS fInventoryDays,
  1309. f.f_name AS fFeeName,
  1310. w.f_dc AS fSrcdc,
  1311. CASE
  1312. WHEN w.f_dc = 'D' THEN '收'
  1313. WHEN w.f_dc = 'C' THEN '付'
  1314. END AS fSrcdcName,
  1315. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1316. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1317. dict.dict_label AS fFeeunitid,
  1318. w.f_qty AS fQty ,
  1319. w.f_unitprice AS fUnitprice ,
  1320. dictIn.dict_label AS fBusinessType
  1321. FROM
  1322. t_warehousebills t
  1323. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1324. LEFT JOIN (
  1325. SELECT
  1326. f.f_id AS f_id,
  1327. f.f_pid AS f_pid,
  1328. f.f_lineno AS f_lineno,
  1329. f.f_corpid,
  1330. f.f_feeid,
  1331. f.f_feeUnitid,
  1332. f.f_qty,
  1333. f.f_unitprice,
  1334. f.f_amount,
  1335. f.f_currency,
  1336. f.f_exrate,
  1337. f.f_taxrate,
  1338. f.f_dc,
  1339. f.f_billstatus,
  1340. f.f_statement_no,
  1341. f.f_accamount,
  1342. f.f_accamount_date,
  1343. f.f_stlamount_no,
  1344. f.f_stlamount,
  1345. f.f_stlamount_date,
  1346. f.f_invnos,
  1347. f.f_invamount,
  1348. f.f_askamount,
  1349. f.f_status,
  1350. f.remark,
  1351. f.f_inventory_days,
  1352. f.f_billing_days,
  1353. f.f_billing_deadline,
  1354. f.f_originalbilldate,
  1355. f.f_mblno,
  1356. f.f_product_name,
  1357. f.f_chargedate,
  1358. f.src_bill_no,
  1359. f.f_billtype,
  1360. f.f_marks,
  1361. f.f_business_type,
  1362. f.f_bsdate,
  1363. c.f_id AS fId,
  1364. c.f_name AS fName
  1365. FROM
  1366. t_warehousebillsfees AS f
  1367. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1368. ) w ON w.f_pid = t.f_id
  1369. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1370. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1371. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  1372. <where>
  1373. dict.status = '0'
  1374. AND dict.dict_type = 'data_unitfees'
  1375. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1376. #{map.tWareHouseFees.fCorpid}
  1377. </if>
  1378. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1379. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1380. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1381. #{map.tWareHouseFees.fToCorpid}
  1382. </if>
  1383. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1384. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1385. </if>
  1386. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1387. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1388. </if>
  1389. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1390. and w.f_accamount_date IS NOT NULL
  1391. </if>
  1392. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1393. and w.f_accamount_date IS NULL
  1394. </if>
  1395. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1396. and w.f_dc = #{map.tWareHouseFees.fDc}
  1397. </if>
  1398. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1399. and w.f_dc = #{map.tWareHouseFees.fDc}
  1400. </if>
  1401. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1402. and w.f_feeid in
  1403. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1404. separator=",">
  1405. #{id}
  1406. </foreach>
  1407. </if>
  1408. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1409. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1410. </if>
  1411. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1412. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1413. </if>
  1414. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1415. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1416. </if>
  1417. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1418. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1419. </if>
  1420. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1421. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1422. </if>
  1423. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1424. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1425. </if>
  1426. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1427. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1428. AND dictIn.dict_type = 'st_in_type'
  1429. AND dictIn.status = '0'
  1430. </if>
  1431. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1432. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1433. AND dictIn.dict_type = 'st_out_type'
  1434. AND dictIn.status = '0'
  1435. </if>
  1436. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1437. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1438. AND dictIn.dict_type = 'st_trans_type'
  1439. AND dictIn.status = '0'
  1440. </if>
  1441. <if test="map.tWareHouseFees.fBilltype == null ">
  1442. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  1443. AND dictIn.status = '0'
  1444. </if>
  1445. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1446. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1447. </if>
  1448. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1449. and w.f_business_type in
  1450. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1451. #{id}
  1452. </foreach>
  1453. </if>
  1454. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1455. and w.f_id in
  1456. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1457. separator=",">
  1458. #{id}
  1459. </foreach>
  1460. </if>
  1461. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1462. and t.f_id in
  1463. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1464. separator=",">
  1465. #{id}
  1466. </foreach>
  1467. </if>
  1468. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1469. </if>
  1470. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1471. and t.create_by = #{map.tWareHouseFees.createBy}
  1472. </if>
  1473. and t.f_review_date IS NOT NULL
  1474. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1475. GROUP BY w.f_id
  1476. </where>
  1477. </select>
  1478. -->
  1479. <select id="warehouseBillsKHFeesListAccamount" resultType="java.util.Map">
  1480. SELECT
  1481. w.f_id AS fSrcid,
  1482. t.f_id AS fSrcpid,
  1483. t.f_corpid AS fCorpid,
  1484. t.f_billno fBillno,
  1485. c.f_name AS fName,
  1486. w.fName AS fFeesName,
  1487. t.f_bscorpno AS fBscorpno,
  1488. w.f_mblno AS fMblno,
  1489. w.f_product_name AS fProductName,
  1490. w.f_bsdate AS fBsdate,
  1491. t.f_billtype AS tfBilltype,
  1492. t.f_review_date AS fReviewDate,
  1493. w.f_marks AS fMarks,
  1494. w.f_feeid AS fFeeid,
  1495. w.f_billtype AS wfBilltype,
  1496. w.f_chargedate AS fChargedate,
  1497. w.f_originalbilldate AS fOriginalbilldate,
  1498. w.f_billing_deadline AS fBillingDeadline,
  1499. w.f_billing_days AS fBillingDays,
  1500. w.f_inventory_days AS fInventoryDays,
  1501. f.f_name AS fFeeName,
  1502. w.f_dc AS fSrcdc,
  1503. CASE
  1504. WHEN w.f_dc = 'D' THEN '收'
  1505. WHEN w.f_dc = 'C' THEN '付'
  1506. END AS fSrcdcName,
  1507. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1508. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1509. dict.dict_label AS fFeeunitid,
  1510. w.f_qty AS fQty,
  1511. w.f_unitprice AS fUnitprice,
  1512. w.f_currency AS fCurreny,
  1513. w.f_taxrate AS fTaxrate,
  1514. w.remark AS remark,
  1515. tv.f_name AS boatName,
  1516. ty.f_no AS voyageName,
  1517. w.create_time createTime,
  1518. w.businessName
  1519. FROM
  1520. t_warehousebills t
  1521. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1522. LEFT JOIN (
  1523. SELECT
  1524. f.f_id AS f_id,
  1525. f.f_pid AS f_pid,
  1526. f.f_lineno AS f_lineno,
  1527. f.f_corpid,
  1528. f.f_feeid,
  1529. f.f_feeUnitid,
  1530. f.f_qty,
  1531. f.f_unitprice,
  1532. f.f_amount,
  1533. f.f_currency,
  1534. f.f_exrate,
  1535. f.f_taxrate,
  1536. f.f_dc,
  1537. f.f_billstatus,
  1538. f.f_statement_no,
  1539. f.f_accamount,
  1540. f.f_accamount_date,
  1541. f.f_stlamount_no,
  1542. f.f_stlamount,
  1543. f.f_stlamount_date,
  1544. f.f_invnos,
  1545. f.f_invamount,
  1546. f.f_askamount,
  1547. f.f_status,
  1548. f.remark,
  1549. f.f_inventory_days,
  1550. f.f_billing_days,
  1551. f.f_billing_deadline,
  1552. f.f_originalbilldate,
  1553. f.f_mblno,
  1554. f.f_product_name,
  1555. f.f_chargedate,
  1556. f.src_bill_no,
  1557. f.f_billtype,
  1558. f.f_marks,
  1559. f.f_business_type,
  1560. pro.dict_label businessName,
  1561. f.f_bsdate,
  1562. c.f_id AS fId,
  1563. c.f_name AS fName,
  1564. f.create_time
  1565. FROM
  1566. t_warehousebillsfees AS f
  1567. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1568. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type and pro.dict_type = 'data_billType'
  1569. ) w ON w.f_pid = t.f_id
  1570. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1571. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1572. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1573. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1574. <where>
  1575. dict.status = '0'
  1576. AND dict.dict_type = 'data_unitfees'
  1577. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1578. #{map.tWareHouseFees.fToCorpid}
  1579. </if>
  1580. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1581. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1582. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1583. #{map.tWareHouseFees.fCorpid}
  1584. </if>
  1585. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1586. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1587. </if>
  1588. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1589. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1590. </if>
  1591. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1592. and w.f_accamount_date IS NOT NULL
  1593. </if>
  1594. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1595. and w.f_accamount_date IS NULL
  1596. </if>
  1597. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1598. and w.f_dc = #{map.tWareHouseFees.fDc}
  1599. </if>
  1600. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1601. and w.f_dc = #{map.tWareHouseFees.fDc}
  1602. </if>
  1603. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1604. and w.f_feeid in
  1605. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1606. separator=",">
  1607. #{id}
  1608. </foreach>
  1609. </if>
  1610. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1611. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1612. </if>
  1613. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1614. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1615. </if>
  1616. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1617. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1618. </if>
  1619. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1620. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1621. </if>
  1622. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1623. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1624. </if>
  1625. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1626. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1627. </if>
  1628. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1629. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1630. </if>
  1631. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1632. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1633. </if>
  1634. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1635. and w.f_business_type in
  1636. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1637. #{id}
  1638. </foreach>
  1639. </if>
  1640. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1641. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1642. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1643. #{map.tWareHouseFees.boatName}
  1644. </if>
  1645. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1646. #{map.tWareHouseFees.voyageName}
  1647. </if>
  1648. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1649. </if>
  1650. and t.f_review_date IS NOT NULL
  1651. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1652. GROUP BY w.f_id
  1653. </where>
  1654. </select>
  1655. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  1656. SELECT
  1657. w.f_id AS fSrcid,
  1658. t.f_id AS fSrcpid,
  1659. t.f_corpid AS fCorpid,
  1660. c.f_name AS fName,
  1661. w.f_corpid AS fCorpids,
  1662. c1.f_name AS fFeesName,
  1663. w.f_mblno AS fMblno,
  1664. w.f_product_name AS fProductName,
  1665. w.f_marks AS fMarks,
  1666. t.f_billtype AS fBilltype,
  1667. t.f_review_date AS fReviewDate,
  1668. w.f_dc AS fSrcdc,
  1669. SUM(w.f_amount) AS fAmount,
  1670. SUM(w.f_stlamount) AS fStlamount,
  1671. ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
  1672. FROM
  1673. t_warehousebills t
  1674. left join sys_user u on t.create_by = u.user_name
  1675. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1676. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1677. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1678. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1679. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1680. <where>
  1681. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1682. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1683. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1684. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1685. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1686. #{fProductName}, '%')
  1687. </if>
  1688. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1689. and w.f_billstatus != 6
  1690. </if>
  1691. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1692. and w.f_billstatus = 6
  1693. </if>
  1694. <if test='fDc != null and fDc != "" and fDc == "D" '>
  1695. and w.f_dc = #{fDc}
  1696. </if>
  1697. <if test='fDc != null and fDc != "" and fDc == "C" '>
  1698. and w.f_dc = #{fDc}
  1699. </if>
  1700. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1701. and t.f_review_date &gt;= #{timeExamine[0]}
  1702. </if>
  1703. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1704. and t.f_review_date &lt;= #{timeExamine[1]}
  1705. </if>
  1706. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1707. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1708. </if>
  1709. and w.f_review_date IS NOT NULL
  1710. ${params.dataScope}
  1711. GROUP BY
  1712. w.f_pid,
  1713. w.f_dc,
  1714. w.f_corpid
  1715. </where>
  1716. </select>
  1717. <select id="selectTWarehousebillsItemsList"
  1718. resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
  1719. SELECT (@ii := @ii + 1) AS fId,
  1720. wi.f_mblno AS fMblno,
  1721. wi.f_bsdate AS fBsdate,
  1722. f.f_name AS fFeeid,
  1723. CASE
  1724. WHEN w.f_srcdc = 'D' THEN
  1725. '收'
  1726. WHEN w.f_srcdc = 'C' THEN
  1727. '付'
  1728. END AS fSrcdc,
  1729. w.f_amtdr AS fAmtdr,
  1730. dict.dict_label AS fFeeunitid,
  1731. wi.f_qty AS fBillingQty,
  1732. wi.f_unitprice AS fUnitprice,
  1733. w.f_amt AS fAmt,
  1734. wi.f_business_type AS fBusinessType,
  1735. CASE
  1736. wi.f_billtype
  1737. WHEN 'SJRK' THEN
  1738. '入库'
  1739. WHEN 'SJCK' THEN
  1740. '出库'
  1741. WHEN 'HQZY' THEN
  1742. '货转'
  1743. WHEN 'CKDB' THEN
  1744. '调拨'
  1745. WHEN 'HWTG' THEN
  1746. '货物通关'
  1747. WHEN 'KCZZ' THEN
  1748. '库存总账'
  1749. END AS fBilltype,
  1750. wi.f_product_name AS fGoodsid,
  1751. wi.f_marks AS fMarks,
  1752. wi.f_chargedate AS fChargedate,
  1753. wi.f_billing_deadline AS fBillingDeadline,
  1754. wi.f_inventory_days AS fInventoryDays,
  1755. wi.f_billing_days AS fBillingDays,
  1756. w.f_remarks AS fRemarks
  1757. FROM t_fee_do w
  1758. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1759. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1760. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1761. , (
  1762. SELECT @ii := 0
  1763. ) AS ii
  1764. WHERE dict.status = '0'
  1765. AND dict.dict_type = 'data_unitfees'
  1766. AND w.f_pid = #{fId}
  1767. </select>
  1768. <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
  1769. SELECT
  1770. t.f_id AS fSrcpid,
  1771. c.f_name AS fName,
  1772. c1.f_name AS fFeesName,
  1773. w.f_mblno AS fMblno,
  1774. w.f_product_name AS fProductName,
  1775. u1.user_name AS fSalesmanName,
  1776. w.f_marks AS fMarks,
  1777. t.f_billtype AS fBilltype,
  1778. w.f_review_date AS fReviewDate,
  1779. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  1780. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  1781. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )
  1782. nnfinished
  1783. FROM
  1784. t_warehousebillsfees w
  1785. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1786. left join sys_user u on t.create_by = u.user_name
  1787. left join sys_user u1 on t.f_salesman_id = u1.user_id
  1788. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1789. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1790. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  1791. <where>
  1792. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1793. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1794. <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
  1795. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1796. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1797. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1798. #{fProductName}, '%')
  1799. </if>
  1800. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1801. and w.f_billstatus != 6
  1802. </if>
  1803. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1804. and w.f_billstatus = 6
  1805. </if>
  1806. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1807. and w.f_review_date &gt;= #{timeExamine[0]}
  1808. </if>
  1809. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1810. and w.f_review_date &lt;= #{timeExamine[1]}
  1811. </if>
  1812. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1813. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1814. </if>
  1815. <if test="fBusinessType != null and fBusinessType != '' ">
  1816. and w.f_business_type in
  1817. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  1818. #{id}
  1819. </foreach>
  1820. </if>
  1821. <if test="fFeeid != null and fFeeid != '' ">
  1822. and w.f_feeid in
  1823. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  1824. #{id}
  1825. </foreach>
  1826. </if>
  1827. and w.f_review_date IS NOT NULL
  1828. ${params.dataScope}
  1829. GROUP BY
  1830. w.f_mblno
  1831. </where>
  1832. </select>
  1833. <select id="selectFeeList" resultType="java.util.Map">
  1834. select
  1835. ware.create_by AS createBy,
  1836. ware.f_billno AS fBillno,
  1837. ware.f_ctrlcorpid AS fCtrlcorpid,
  1838. ware.create_time AS createTime,
  1839. ware.f_accbilldate AS fAccbilldate,
  1840. ware.t_mblno AS tMblno,
  1841. dict.dict_label AS chargingMethod,
  1842. ware.invoice_no AS invoiceNo,
  1843. ware.bank AS bank,
  1844. ware.water_bill_no AS waterBillNo,
  1845. ware.f_amtdr AS fAmtdr,
  1846. ware.f_amtcr AS fAmtcr,
  1847. ware.f_remarks AS fRemarks,
  1848. CASE
  1849. WHEN ware.f_billstatus = '1' THEN '新建'
  1850. WHEN ware.f_billstatus = '2' THEN '暂存'
  1851. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  1852. WHEN ware.f_billstatus = '4' THEN '提交审核'
  1853. WHEN ware.f_billstatus = '5' THEN '审核中'
  1854. WHEN ware.f_billstatus = '6' THEN '审核完成'
  1855. END
  1856. AS fBillstatus
  1857. from
  1858. t_fee ware
  1859. left join sys_user u on ware.create_by = u.user_name
  1860. left join sys_dept d on ware.f_deptid = d.dept_id
  1861. LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
  1862. <where>
  1863. dict.status = '0'
  1864. AND dict.dict_type = 'data_settlement_type'
  1865. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  1866. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  1867. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  1868. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  1869. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  1870. <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
  1871. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  1872. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  1873. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  1874. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  1875. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  1876. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  1877. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  1878. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  1879. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  1880. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  1881. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1882. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  1883. </if>
  1884. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1885. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  1886. </if>
  1887. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  1888. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  1889. <if test="bank != null ">and ware.bank = #{bank}</if>
  1890. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  1891. </where>
  1892. ${params.dataScope}
  1893. </select>
  1894. <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
  1895. SELECT (@ii := @ii + 1) AS fId,
  1896. wi.f_mblno AS fMblno,
  1897. wi.f_bsdate AS fBsdate,
  1898. t.f_bscorpno AS fBscorpno,
  1899. f.f_name AS fFeeid,
  1900. CASE
  1901. WHEN w.f_srcdc = 'D' THEN
  1902. '收'
  1903. WHEN w.f_srcdc = 'C' THEN
  1904. '付'
  1905. END AS fSrcdc,
  1906. w.f_amtdr AS fAmtdr,
  1907. dict.dict_label AS fFeeunitid,
  1908. wi.f_qty AS fBillingQty,
  1909. wi.f_unitprice AS fUnitprice,
  1910. w.f_amt AS fAmt,
  1911. wi.f_business_type AS fBusinessType,
  1912. CASE
  1913. wi.f_billtype
  1914. WHEN 'SJRK' THEN
  1915. '入库'
  1916. WHEN 'SJCK' THEN
  1917. '出库'
  1918. WHEN 'HQZY' THEN
  1919. '货转'
  1920. WHEN 'CKDB' THEN
  1921. '调拨'
  1922. WHEN 'HWTG' THEN
  1923. '货物通关'
  1924. WHEN 'KCZZ' THEN
  1925. '库存总账'
  1926. END AS fBilltype,
  1927. wi.f_product_name AS fGoodsid,
  1928. wi.f_marks AS fMarks,
  1929. w.f_remarks AS fRemarks
  1930. FROM t_fee_do w
  1931. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1932. LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
  1933. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1934. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1935. , (
  1936. SELECT @ii := 0
  1937. ) AS ii
  1938. WHERE dict.status = '0'
  1939. AND dict.dict_type = 'data_unitfees'
  1940. AND w.f_pid = #{fId}
  1941. </select>
  1942. <select id="selectDetailedList1" resultType="java.util.Map">
  1943. SELECT t.f_id AS fSrcpid,
  1944. t.f_corpid AS fCorpid,
  1945. c.f_name AS fName,
  1946. c1.f_name AS fFeesName,
  1947. w.f_mblno AS fMblno,
  1948. w.f_product_name AS fProductName,
  1949. w.f_marks AS fMarks,
  1950. w.f_dc AS fSrcdc,
  1951. w.f_amount AS fAmount,
  1952. w.f_stlamount AS fStlamount,
  1953. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS nnfinished
  1954. FROM t_warehousebills t
  1955. LEFT JOIN sys_user u ON t.create_by = u.user_name
  1956. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  1957. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1958. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1959. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1960. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1961. WHERE w.f_dc = #{fSrcdc}
  1962. AND t.f_review_date IS NOT NULL
  1963. AND w.f_corpid = #{fCorpIds}
  1964. AND t.f_corpid = #{fCorpId}
  1965. AND w.f_mblno = #{fMblno}
  1966. </select>
  1967. <!--网页版发票申请查询-->
  1968. <select id="webVersionInvoice" parameterType="TFee" resultType="java.util.Map">
  1969. SELECT
  1970. tf.f_id AS fId,/**费用主表id*/
  1971. tf.f_billno AS fBillno,/**费用申请编号*/
  1972. tf.f_ctrlcorpid AS fCtrlcorpid,/**货权方*/
  1973. tf.f_corpid AS fCorpid,/**结算单位*/
  1974. tc.f_name AS fCorpidName,/**结算单位中文名称*/
  1975. tf.t_mblno AS tMblno,/**提单号*/
  1976. tf.f_amtdr AS fAmtdr,/**应收合计*/
  1977. tf.f_amtcr AS fAmtcr,/**应付合计*/
  1978. tf.f_billtype AS fBilltype,/**业务类型*/
  1979. tf.f_billstatus AS fBillstatus,/**状态*/
  1980. CASE
  1981. WHEN tf.f_billstatus = '1' THEN
  1982. '新建'
  1983. WHEN tf.f_billstatus = '2' THEN
  1984. '暂存'
  1985. WHEN tf.f_billstatus = '3' THEN
  1986. '驳回'
  1987. WHEN tf.f_billstatus = '4' THEN
  1988. '提交'
  1989. WHEN tf.f_billstatus = '5' THEN
  1990. '审批中'
  1991. WHEN tf.f_billstatus = '6' THEN
  1992. '审批通过'
  1993. END AS fBillstatusName,
  1994. tf.f_remarks AS fRemarks,/**备注*/
  1995. tf.f_accbilldate AS fAccbilldate,/**结算日期*/
  1996. tf.create_by AS createBy,/**创建人*/
  1997. tf.create_time AS createTime,/**创建时间*/
  1998. tf.update_by AS updateBy,/**更新人*/
  1999. tf.update_time AS updateTime,/**更新时间*/
  2000. tf.invoice_no AS invoiceNo,/**发票号*/
  2001. tf.bank AS bank,/**银行*/
  2002. tf.water_bill_no AS waterBillNo,/**水单号*/
  2003. tf.f_system_type AS fSystemType,/**系统类型*/
  2004. tf.f_tracking_number AS fTrackingNumber,/**快递单号*/
  2005. tf.f_invoice_rise AS fInvoiceRise,/**发票抬头*/
  2006. tf.f_sign AS fSign,/**是否签收*/
  2007. tf.f_send_Time AS fSendTime,/**寄送时间*/
  2008. tf.charging_method AS chargingMethod,/**收费方式*/
  2009. pro.dict_label AS chargingMethodName /**收费方式中文名称*/
  2010. FROM
  2011. t_fee tf
  2012. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  2013. LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.charging_method
  2014. AND pro.dict_type = 'data_settlement_type'
  2015. WHERE tf.f_billtype = 'ApplyFP'
  2016. <if test="createBy != null and createBy != ''">and tf.create_by = #{createBy}</if>
  2017. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2018. and tf.create_time &gt;= #{timeInterval[0]}
  2019. </if>
  2020. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2021. and tf.create_time &lt;= #{timeInterval[1]}
  2022. </if>
  2023. <if test="invoiceNo != null and invoiceNo != ''">and tf.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  2024. <if test="fInvoiceRise != null and fInvoiceRise != ''">and tf.f_invoice_rise like concat('%', #{fInvoiceRise},
  2025. '%')
  2026. </if>
  2027. <if test="fBillno != null and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
  2028. <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus =
  2029. #{fBillstatus}
  2030. </if>
  2031. ORDER BY tf.f_id desc
  2032. </select>
  2033. <!--凯和检索费用信息-->
  2034. <select id="FinancialFeesList" resultType="java.util.Map">
  2035. SELECT
  2036. w.f_id AS fSrcid,
  2037. t.f_id AS fSrcpid,
  2038. w.f_corpid AS fCorpid,
  2039. w.fName AS fName,
  2040. t.f_mblno AS fMblno,
  2041. w.f_bsdate AS fBsdate,
  2042. t.f_billtype AS fBilltype,
  2043. t.f_review_date AS fReviewDate,
  2044. w.f_feeid AS fFeeid,
  2045. w.src_bill_no AS srcBillNo,
  2046. w.f_marks AS fMarks,
  2047. f.f_name AS fFeeName,
  2048. w.f_dc AS fSrcdc,
  2049. w.f_qty AS fQty,
  2050. w.f_unitprice AS fUnitPrice,
  2051. w.f_amount AS fAmount,
  2052. w.f_feeUnitid AS fFeeUnitId,
  2053. pr.dict_label AS fFeeUnitName,
  2054. t.f_vslid AS fVslid,
  2055. t.f_voyid AS fVoyid,
  2056. tv.f_name AS fvslName,
  2057. ty.f_no AS fvoyName,
  2058. tre.f_name AS fLoadPortName,
  2059. ts.f_name As fDestPortName,
  2060. w.f_billstatus AS fBillStatus,
  2061. t.f_loadportid AS fLoadportid,
  2062. t.f_destportid AS fDestportid,
  2063. tn.f_name AS cntrName,
  2064. ti.f_cntrcount AS fCntrCount,
  2065. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2066. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  2067. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  2068. </if>
  2069. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2070. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2071. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2072. </if>
  2073. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2074. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2075. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2076. </if>
  2077. CASE
  2078. WHEN w.f_dc = 'D' THEN '收'
  2079. WHEN w.f_dc = 'C' THEN '付'
  2080. END AS fSrcdcName,
  2081. CASE
  2082. WHEN w.f_billstatus = '1' THEN '新建'
  2083. WHEN w.f_billstatus = '2' THEN '暂存'
  2084. WHEN w.f_billstatus = '3' THEN '驳回'
  2085. WHEN w.f_billstatus = '4' THEN '提交'
  2086. WHEN w.f_billstatus = '5' THEN '审批中'
  2087. WHEN w.f_billstatus = '6' THEN '通过'
  2088. END AS fBillStatusName,
  2089. tg.f_name AS goodName
  2090. FROM
  2091. t_warehousebills t
  2092. LEFT JOIN (
  2093. SELECT
  2094. f.f_id AS f_id,
  2095. f.f_pid AS f_pid,
  2096. f.f_lineno AS f_lineno,
  2097. f.f_corpid,
  2098. f.f_feeid,
  2099. f.f_feeUnitid,
  2100. f.f_qty,
  2101. f.f_unitprice,
  2102. f.f_amount,
  2103. f.f_currency,
  2104. f.f_exrate,
  2105. f.f_taxrate,
  2106. f.f_dc,
  2107. f.f_billstatus,
  2108. f.f_statement_no,
  2109. f.f_accamount,
  2110. f.f_accamount_date,
  2111. f.f_stlamount_no,
  2112. f.f_stlamount,
  2113. f.f_stlamount_date,
  2114. f.f_invnos,
  2115. f.f_invamount,
  2116. f.f_askamount,
  2117. f.f_chargedate,
  2118. f.f_status,
  2119. f.remark,
  2120. f.f_mblno,
  2121. f.f_product_name,
  2122. f.src_bill_no,
  2123. f.f_billing_days,
  2124. f.f_inventory_days,
  2125. f.f_marks,
  2126. f.f_billing_deadline,
  2127. f.f_originalbilldate,
  2128. f.f_billtype,
  2129. f.f_business_type,
  2130. f.f_bsdate,
  2131. c.f_id AS fId,
  2132. c.f_name AS fName
  2133. FROM
  2134. t_warehousebillsfees AS f
  2135. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2136. ) w ON w.f_pid = t.f_id
  2137. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2138. LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
  2139. AND pr.dict_type = 'data_unitfees'
  2140. LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
  2141. LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
  2142. LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
  2143. LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
  2144. LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
  2145. LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
  2146. LEFT JOIN t_goods tg ON ti.f_goodsid = tg.f_id
  2147. <where>
  2148. t.f_typeid = 1
  2149. and w.f_billstatus = 6
  2150. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  2151. #{map.tWareHouseFees.fCorpid}
  2152. </if>
  2153. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  2154. and w.f_accamount_date IS NOT NULL
  2155. </if>
  2156. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  2157. and w.f_accamount_date IS NULL
  2158. </if>
  2159. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  2160. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  2161. </if>
  2162. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != ""'>
  2163. and w.f_dc = #{map.tWareHouseFees.fDc}
  2164. </if>
  2165. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  2166. w.f_statement_no = #{map.tWareHouseFees.fStatementNo}
  2167. </if>
  2168. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  2169. </if>
  2170. <if test="map.tWareHouseFees.fVslid != null">and t.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  2171. <if test="map.tWareHouseFees.fVoyid != null">and t.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  2172. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  2173. </if>
  2174. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  2175. </if>
  2176. <if test="map.tWareHouseFees.fFromDate != null ">and t.f_bsdate &gt;= #{map.tWareHouseFees.fFromDate}</if>
  2177. <if test="map.tWareHouseFees.fToDate != null ">and t.f_bsdate &lt;= #{map.tWareHouseFees.fToDate}</if>
  2178. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2179. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  2180. </if>
  2181. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2182. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  2183. </if>
  2184. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2185. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  2186. </if>
  2187. GROUP BY w.f_id
  2188. </where>
  2189. </select>
  2190. <!--凯和查询财务主表数据-->
  2191. <select id="selectFinancialTFeeId" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  2192. SELECT
  2193. f.f_id AS fId,
  2194. f.f_billno AS fBillno,
  2195. f.f_ctrlcorpid AS fCtrlcorpid,
  2196. pro.dict_label AS chargingMethod,
  2197. f.invoice_no AS invoiceNo,
  2198. f.bank AS fBank,
  2199. f.water_bill_no AS waterBillNo,
  2200. f.f_corpid AS fCorpid,
  2201. c.f_name AS fCorpidName,
  2202. f.f_accbilldate AS fAccbilldate,
  2203. f.t_mblno AS tMblno,
  2204. f.f_amtdr AS fAmtdr,
  2205. f.f_amtcr AS fAmtcr,
  2206. f.f_billtype AS fBilltype,
  2207. f.f_system_type AS fSystemType,
  2208. f.f_billstatus AS fBillstatus,
  2209. CASE
  2210. WHEN f.f_billstatus = '1' THEN '新建'
  2211. WHEN f.f_billstatus = '2' THEN '暂存'
  2212. WHEN f.f_billstatus = '3' THEN '审批驳回'
  2213. WHEN f.f_billstatus = '4' THEN '提交审核'
  2214. WHEN f.f_billstatus = '5' THEN '审核中'
  2215. WHEN f.f_billstatus = '6' THEN '审核完成'
  2216. END
  2217. AS fBillstatusName,
  2218. f.f_remarks AS fRemarks,
  2219. f.create_by AS createBy,
  2220. f.create_time AS createTime,
  2221. f.update_by AS updateBy,
  2222. f.update_time AS updateTime,
  2223. tv.f_name AS vessel,
  2224. ty.f_no AS voyage,
  2225. tre.f_name AS loadportName,
  2226. ts.f_name AS destportName,
  2227. f.f_bank_number AS fBankNumber,
  2228. f.bank AS bank,
  2229. f.invoice_remarks AS invoiceRemarks,
  2230. f.f_loadportid AS fLoadportid,
  2231. f.f_destportid AS fDestportid,
  2232. f.f_billno AS srcBillNo,
  2233. CASE
  2234. WHEN f.f_dc = 'D' THEN
  2235. '收'
  2236. WHEN f.f_dc = 'C' THEN
  2237. '付'
  2238. END AS fSrcdcName,
  2239. f.f_vslid AS fVslid,
  2240. f.f_voyid AS fVoyid,
  2241. f.f_from_date AS fFromDate,
  2242. f.f_to_date AS fToDate,
  2243. f.f_reconciliation AS fReconciliation,
  2244. f.f_dc AS fDc
  2245. FROM
  2246. t_fee AS f
  2247. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2248. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  2249. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  2250. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  2251. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  2252. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  2253. where
  2254. f.f_id = #{fId}
  2255. </select>
  2256. <select id="exportFinancial" parameterType="TFee" resultType="com.ruoyi.shipping.excel.ExportFinancial">
  2257. SELECT
  2258. @rank:=@rank + 1 AS rankNo,
  2259. tp.fMblNo AS fMblNo,
  2260. tp.portOfDeparture AS portOfDeparture,
  2261. tp.destinationPort AS destinationPort,
  2262. tp.goodName AS goodName,
  2263. IFNULL(tp.fCnTrCount,0) AS fCnTrCount,
  2264. tp.specification AS specification,
  2265. ROUND(IFNULL(tp.fUnitPrice,0),2) AS fUnitPrice,
  2266. ROUND(IFNULL(tp.fAmount,0),2) AS fAmount,
  2267. tp.fServiceitems AS fServiceitems
  2268. FROM
  2269. (
  2270. SELECT
  2271. tw.f_mblno AS fMblNo,
  2272. ts.f_name AS portOfDeparture,
  2273. ty.f_name AS destinationPort,
  2274. tg.f_name AS goodName,
  2275. IFNULL(temp.fCnTrCount,0) AS fCnTrCount,
  2276. tr.f_name AS specification,
  2277. CASE
  2278. WHEN temp.fCnTrCount != 0 THEN temp.fAmount/temp.fCnTrCount
  2279. ELSE 0
  2280. END AS fUnitPrice,
  2281. IFNULL(temp.fAmount,0) AS fAmount,
  2282. sd.dict_label fServiceitems
  2283. FROM
  2284. (
  2285. SELECT
  2286. td.f_srcpid AS pId,
  2287. IFNULL(tr.f_cntrcount,0) AS fCnTrCount,
  2288. IFNULL(SUM(td.f_amt),0) AS fAmount
  2289. FROM
  2290. t_fee_do td
  2291. LEFT JOIN
  2292. t_warehousebills tw ON tw.f_id = td.f_srcpid
  2293. LEFT JOIN t_warehousebills_cntr tr ON tr.f_pid = tw.f_id
  2294. WHERE td.f_pid = #{id}
  2295. GROUP BY td.f_srcpid
  2296. )temp
  2297. LEFT JOIN t_warehousebills tw ON tw.f_id = temp.pId
  2298. LEFT JOIN t_address ts ON tw.f_loadportid = ts.f_id
  2299. LEFT JOIN t_address ty ON tw.f_destportid = ty.f_id
  2300. LEFT JOIN t_warehousebills_cntr tc ON tc.f_pid = tw.f_id
  2301. LEFT JOIN t_cntr tr ON tr.f_id = tc.f_cntrid
  2302. LEFT JOIN t_goods tg ON tc.f_goodsid = tg.f_id
  2303. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  2304. )tp,
  2305. (SELECT @rank:= 0) b
  2306. </select>
  2307. <select id="receivable" resultType="com.ruoyi.finance.shipping.ReceivableExcel">
  2308. SELECT
  2309. DISTINCT
  2310. tv.f_name AS shipsName,#船名
  2311. ty.f_no AS voyage,# 航次
  2312. tc.f_name AS unitOfAccount,#结算单位
  2313. tw.f_mblno AS blNo,#提单号
  2314. ta.f_name AS portOfLoading,#起运港
  2315. td.f_name AS destination,#目的港
  2316. tw.f_bsdate sailingDate,#开船日期
  2317. tf.f_review_date AS auditDate,#审核日期
  2318. ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
  2319. ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
  2320. ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
  2321. FROM
  2322. t_warehousebillsfees tf
  2323. LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
  2324. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2325. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2326. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  2327. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2328. LEFT JOIN t_address td ON td.f_id = tw.f_destportid
  2329. <where>
  2330. tf.f_dc = #{fDc}
  2331. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
  2332. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  2333. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  2334. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  2335. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  2336. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  2337. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  2338. and tf.f_billstatus != 6
  2339. </if>
  2340. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
  2341. and tf.f_billstatus = 6
  2342. </if>
  2343. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2344. and tf.f_review_date &gt;= #{timeExamine[0]}
  2345. </if>
  2346. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  2347. and tf.f_review_date &lt;= #{timeExamine[1]}
  2348. </if>
  2349. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2350. and tw.f_bsdate &gt;= #{timeInterval[0]}
  2351. </if>
  2352. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2353. and tw.f_bsdate &lt;= #{timeInterval[1]}
  2354. </if>
  2355. GROUP BY tw.f_mblno,tf.f_corpid
  2356. ORDER BY tw.f_bsdate DESC
  2357. </where>
  2358. </select>
  2359. <select id="profit" resultType="com.ruoyi.finance.shipping.ProfitExcel">
  2360. SELECT
  2361. DISTINCT
  2362. tv.f_name AS shipsName,
  2363. ty.f_no AS voyage,
  2364. ROUND(sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ),2) AS receivable,
  2365. ROUND(sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ),2) AS handle,
  2366. ROUND((sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )),2) AS profit,
  2367. ROUND(sum( CASE f_dc WHEN 'D' THEN f_stlamount ELSE 0 END ),2) AS actualReceivable,
  2368. ROUND(sum( CASE f_dc WHEN 'C' THEN f_stlamount ELSE 0 END ),2) AS actualHandle
  2369. FROM
  2370. t_warehousebillsfees tf
  2371. LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
  2372. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2373. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2374. <where>
  2375. 1=1
  2376. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  2377. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  2378. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  2379. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  2380. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  2381. and tf.f_billstatus != 6
  2382. </if>
  2383. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
  2384. and tf.f_billstatus = 6
  2385. </if>
  2386. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2387. and tf.f_review_date &gt;= #{timeExamine[0]}
  2388. </if>
  2389. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  2390. and tf.f_review_date &lt;= #{timeExamine[1]}
  2391. </if>
  2392. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2393. and tw.f_bsdate &gt;= #{timeInterval[0]}
  2394. </if>
  2395. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2396. and tw.f_bsdate &lt;= #{timeInterval[1]}
  2397. </if>
  2398. GROUP BY tw.f_vslid,tw.f_voyid
  2399. ORDER BY tw.f_bsdate DESC
  2400. </where>
  2401. </select>
  2402. </mapper>