TWarehousebillsfeesMapper.xml 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  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.warehouseBusiness.mapper.TWarehousebillsfeesMapper">
  6. <resultMap type="TWarehousebillsfees" id="TWarehousebillsfeesResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fLineno" column="f_lineno"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fShipper" column="f_shipper"/>
  12. <result property="fFeeid" column="f_feeid"/>
  13. <result property="fFeeunitid" column="f_feeUnitid"/>
  14. <result property="fWarehouseid" column="f_warehouseid"/>
  15. <result property="fQty" column="f_qty"/>
  16. <result property="fUnitprice" column="f_unitprice"/>
  17. <result property="fAmount" column="f_amount"/>
  18. <result property="fCurrency" column="f_currency"/>
  19. <result property="fExrate" column="f_exrate"/>
  20. <result property="fTaxrate" column="f_taxrate"/>
  21. <result property="fTaxrateStr" column="f_taxratestr"/>
  22. <result property="fDc" column="f_dc"/>
  23. <result property="fBillstatus" column="f_billstatus"/>
  24. <result property="fReviewDate" column="f_review_date"/>
  25. <result property="fAccamount" column="f_accamount"/>
  26. <result property="fStatementNo" column="f_statement_no"/>
  27. <result property="fStlamount" column="f_stlamount"/>
  28. <result property="fInvnos" column="f_invnos"/>
  29. <result property="fAccamountDate" column="f_accamount_date"/>
  30. <result property="fInvamount" column="f_invamount"/>
  31. <result property="fInvoicingDate" column="f_invoicing_date"/>
  32. <result property="fStlamountNo" column="f_stlamount_no"/>
  33. <result property="fAskamount" column="f_askamount"/>
  34. <result property="fStatus" column="f_status"/>
  35. <result property="fStlamountDate" column="f_stlamount_date"/>
  36. <result property="delFlag" column="del_flag"/>
  37. <result property="createBy" column="create_by"/>
  38. <result property="createTime" column="create_time"/>
  39. <result property="updateBy" column="update_by"/>
  40. <result property="updateTime" column="update_time"/>
  41. <result property="remark" column="remark"/>
  42. <result property="srcId" column="src_id"/>
  43. <result property="srcBillNo" column="src_bill_no"/>
  44. <result property="fMblno" column="f_mblno"/>
  45. <result property="fProductName" column="f_product_name"/>
  46. <result property="fMarks" column="f_marks"/>
  47. <result property="fChargedate" column="f_chargedate"/>
  48. <result property="fBillingDeadline" column="f_billing_deadline"/>
  49. <result property="fInventoryDays" column="f_inventory_days"/>
  50. <result property="fAmt" column="f_amt"/>
  51. <result property="fBillingDays" column="f_billing_days"/>
  52. <result property="fBillingQty" column="f_billing_qty"/>
  53. <result property="fBilltype" column="f_billtype"/>
  54. <result property="fBillingway" column="f_billingway"/>
  55. <result property="fBsdate" column="f_bsdate"/>
  56. <result property="priceDateRemarks" column="price_date_remarks"/>
  57. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  58. <result property="fStltypeid" column="f_stltypeid"/>
  59. <result property="fBusinessType" column="f_business_type"/>
  60. <result property="fSrcTypeId" column="f_src_type_id"/>
  61. <result property="fSrcBillno" column="src_bill_no"/>
  62. <result property="fAddress" column="f_address"/>
  63. <result property="fAddressName" column="f_address_name"/>
  64. </resultMap>
  65. <sql id="selectTWarehousebillsfeesVo">
  66. select f_id,
  67. f_pid,
  68. f_lineno,
  69. f_corpid,
  70. f_feeid,
  71. f_warehouseid,
  72. f_feeUnitid,
  73. f_qty,
  74. f_unitprice,
  75. f_amount,
  76. f_currency,
  77. f_exrate,
  78. f_taxrate,
  79. CASE
  80. WHEN f_taxrate = 0 THEN '0.00%'
  81. WHEN f_taxrate != 0 THEN CONCAT(f_taxrate,'%')
  82. END as f_taxratestr,
  83. f_dc,
  84. f_billstatus,
  85. f_review_date,
  86. f_statement_no,
  87. f_accamount,
  88. f_stlamount,
  89. f_accamount_date,
  90. f_invnos,
  91. f_invamount,
  92. f_invoicing_date,
  93. f_stlamount_no,
  94. f_askamount,
  95. f_status,
  96. f_stlamount_date,
  97. del_flag,
  98. create_by,
  99. create_time,
  100. update_by,
  101. update_time,
  102. remark,
  103. src_id,
  104. src_bill_no,
  105. f_mblno,
  106. f_product_name,
  107. f_marks,
  108. f_chargedate,
  109. f_billing_deadline,
  110. f_inventory_days,
  111. f_amt,
  112. f_billing_days,
  113. f_billing_qty,
  114. f_billtype,
  115. f_billingway,
  116. f_bsdate,
  117. f_originalbilldate,
  118. f_stltypeid,
  119. f_business_type,
  120. f_src_type_id,
  121. price_date_remarks,
  122. f_address_name,
  123. f_address
  124. from t_warehousebillsfees
  125. </sql>
  126. <select id="selectTWarehousebillsfeesList" parameterType="TWarehousebillsfees"
  127. resultMap="TWarehousebillsfeesResult">
  128. <include refid="selectTWarehousebillsfeesVo"/>
  129. <where>
  130. del_flag = '0'
  131. <if test="fPid != null ">and f_pid = #{fPid}</if>
  132. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  133. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  134. <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
  135. <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
  136. <if test="fQty != null ">and f_qty = #{fQty}</if>
  137. <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
  138. <if test="fAmount != null ">and f_amount = #{fAmount}</if>
  139. <if test="fCurrency != null and fCurrency != ''">and f_currency = #{fCurrency}</if>
  140. <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
  141. <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
  142. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  143. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  144. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  145. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  146. <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
  147. <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
  148. <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
  149. <if test="fInvnos != null and fInvnos != ''">and f_invnos = #{fInvnos}</if>
  150. <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
  151. <if test="fInvoicingDate != null ">and f_invoicing_date = #{fInvoicingDate}</if>
  152. <if test="fStlamountNo != null and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
  153. <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
  154. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  155. <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
  156. <if test="srcId != null ">and src_id = #{srcId}</if>
  157. <if test="srcBillNo != null and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
  158. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  159. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  160. '%')
  161. </if>
  162. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  163. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  164. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  165. <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
  166. <if test="fAmt != null ">and f_amt = #{fAmt}</if>
  167. <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
  168. <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
  169. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  170. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  171. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  172. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  173. <if test="fStltypeid != null">and f_stltypeid = #{fStltypeid},</if>
  174. <if test="fSrcTypeId != null">and f_src_type_id = #{fSrcTypeId},</if>
  175. <if test="fAddress != null">and f_address = #{fAddress}</if>
  176. <if test="fAddressName != null and fAddressName != ''">and f_address_name = #{fAddressName}</if>
  177. </where>
  178. </select>
  179. <select id="selectTWarehousebillsfeesById" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  180. <include refid="selectTWarehousebillsfeesVo"/>
  181. where f_id = #{fId} and del_flag = 0
  182. </select>
  183. <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  184. select f_id, f_pid, f_billing_deadline, src_bill_no,f_billstatus
  185. from t_warehousebillsfees
  186. where f_pid = #{fId}
  187. and f_billtype = 'SJCK'
  188. and del_flag = '0'
  189. </select>
  190. <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  191. <include refid="selectTWarehousebillsfeesVo"/>
  192. where f_pid = #{fId} and del_flag = '0'
  193. </select>
  194. <select id="selectReconciliation" resultType="java.lang.Integer">
  195. SELECT COUNT(d.f_id)
  196. FROM t_fee_do d
  197. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  198. WHERE d.f_srcpid = #{fId}
  199. AND f.f_billtype = 'DZ'
  200. </select>
  201. <select id="selectCharge" resultType="java.lang.Integer">
  202. SELECT COUNT(d.f_id)
  203. FROM t_fee_do d
  204. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  205. WHERE d.f_srcpid = #{fId}
  206. AND f.f_billtype = 'SF'
  207. </select>
  208. <select id="selectPay" resultType="java.lang.Integer">
  209. SELECT COUNT(d.f_id)
  210. FROM t_fee_do d
  211. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  212. WHERE d.f_srcpid = #{fId}
  213. AND f.f_billtype = 'FF'
  214. </select>
  215. <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees"
  216. resultType="com.ruoyi.finance.excel.FleetExcel">
  217. SELECT
  218. CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
  219. CONCAT(
  220. YEAR ( s.f_bsdate ),
  221. '-',
  222. MONTH ( s.f_bsdate )) feelMonth,
  223. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  224. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  225. sum( s.f_amount ) totalAmount,
  226. sum( s.f_invamount ) invamount,
  227. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  228. FROM
  229. t_warehousebillsfees s
  230. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  231. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  232. WHERE
  233. s.f_dc = 'D'
  234. AND s.del_flag = '0'
  235. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  236. and s.f_bsdate &gt;= #{fMonth[0]}
  237. </if>
  238. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  239. and s.f_bsdate &lt;= #{fMonth[1]}
  240. </if>
  241. GROUP BY
  242. CONCAT(
  243. YEAR ( f_bsdate ),
  244. '-',
  245. MONTH ( f_bsdate ))
  246. </select>
  247. <select id="selectFleetExcelList" parameterType="TWarehousebillsfees"
  248. resultType="com.ruoyi.finance.excel.FleetExcel">
  249. SELECT
  250. #{createBy} userName,
  251. CONCAT(
  252. YEAR ( s.f_bsdate ),
  253. '-',
  254. MONTH ( s.f_bsdate )) feelMonth,
  255. c.f_name corpName,
  256. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  257. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  258. sum( s.f_amount ) totalAmount,
  259. IF
  260. ( f_invamount = 0, 'F', 'T' ) isInvoice,
  261. sum( s.f_invamount ) invamount,
  262. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  263. FROM
  264. t_warehousebillsfees s
  265. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  266. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  267. WHERE
  268. s.f_dc = 'D'
  269. and s.del_flag = '0'
  270. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  271. and s.f_bsdate &gt;= #{fMonth[0]}
  272. </if>
  273. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  274. and s.f_bsdate &lt;= #{fMonth[1]}
  275. </if>
  276. GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
  277. </select>
  278. <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
  279. keyProperty="fId">
  280. insert into t_warehousebillsfees
  281. <trim prefix="(" suffix=")" suffixOverrides=",">
  282. <if test="fId != null">f_id,</if>
  283. <if test="fPid != null">f_pid,</if>
  284. <if test="fLineno != null">f_lineno,</if>
  285. <if test="fCorpid != null">f_corpid,</if>
  286. <if test="fFeeid != null">f_feeid,</if>
  287. <if test="fWarehouseid != null">f_warehouseid,</if>
  288. <if test="fFeeunitid != null">f_feeUnitid,</if>
  289. <if test="fQty != null">f_qty,</if>
  290. <if test="fUnitprice != null">f_unitprice,</if>
  291. <if test="fAmount != null">f_amount,</if>
  292. <if test="fCurrency != null">f_currency,</if>
  293. <if test="fExrate != null">f_exrate,</if>
  294. <if test="fTaxrate != null">f_taxrate,</if>
  295. <if test="fDc != null">f_dc,</if>
  296. <if test="fBillstatus != null">f_billstatus,</if>
  297. <if test="fReviewDate != null">f_review_date,</if>
  298. <if test="fStatementNo != null">f_statement_no,</if>
  299. <if test="fAccamount != null">f_accamount,</if>
  300. <if test="fStlamount != null">f_stlamount,</if>
  301. <if test="fAccamountDate != null">f_accamount_date,</if>
  302. <if test="fInvnos != null">f_invnos,</if>
  303. <if test="fInvamount != null">f_invamount,</if>
  304. <if test="fInvoicingDate != null ">f_invoicing_date,</if>
  305. <if test="fStlamountNo != null">f_stlamount_no,</if>
  306. <if test="fAskamount != null">f_askamount,</if>
  307. <if test="fStatus != null">f_status,</if>
  308. <if test="fStlamountDate != null">f_stlamount_date,</if>
  309. <if test="delFlag != null">del_flag,</if>
  310. <if test="createBy != null">create_by,</if>
  311. <if test="createTime != null">create_time,</if>
  312. <if test="updateBy != null">update_by,</if>
  313. <if test="updateTime != null">update_time,</if>
  314. <if test="remark != null">remark,</if>
  315. <if test="srcId != null">src_id,</if>
  316. <if test="srcBillNo != null">src_bill_no,</if>
  317. <if test="fMblno != null">f_mblno,</if>
  318. <if test="fProductName != null">f_product_name,</if>
  319. <if test="fMarks != null">f_marks,</if>
  320. <if test="fChargedate != null">f_chargedate,</if>
  321. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  322. <if test="fInventoryDays != null">f_inventory_days,</if>
  323. <if test="fAmt != null">f_amt,</if>
  324. <if test="fBillingDays != null">f_billing_days,</if>
  325. <if test="fBillingQty != null">f_billing_qty,</if>
  326. <if test="fBilltype != null">f_billtype,</if>
  327. <if test="fBillingway != null">f_billingway,</if>
  328. <if test="fBsdate != null">f_bsdate,</if>
  329. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  330. <if test="fStltypeid != null">f_stltypeid,</if>
  331. <if test="fBusinessType != null">f_business_type,</if>
  332. <if test="fSrcTypeId != null">f_src_type_id,</if>
  333. <if test="priceDateRemarks != null">price_date_remarks,</if>
  334. <if test="fAddress != null">f_address,</if>
  335. <if test="fAddressName != null">f_address_name,</if>
  336. </trim>
  337. <trim prefix="values (" suffix=")" suffixOverrides=",">
  338. <if test="fId != null">#{fId},</if>
  339. <if test="fPid != null">#{fPid},</if>
  340. <if test="fLineno != null">#{fLineno},</if>
  341. <if test="fCorpid != null">#{fCorpid},</if>
  342. <if test="fFeeid != null">#{fFeeid},</if>
  343. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  344. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  345. <if test="fQty != null">#{fQty},</if>
  346. <if test="fUnitprice != null">#{fUnitprice},</if>
  347. <if test="fAmount != null">#{fAmount},</if>
  348. <if test="fCurrency != null">#{fCurrency},</if>
  349. <if test="fExrate != null">#{fExrate},</if>
  350. <if test="fTaxrate != null">#{fTaxrate},</if>
  351. <if test="fDc != null">#{fDc},</if>
  352. <if test="fBillstatus != null">#{fBillstatus},</if>
  353. <if test="fReviewDate != null">#{fReviewDate},</if>
  354. <if test="fStatementNo != null">#{fStatementNo},</if>
  355. <if test="fAccamount != null">#{fAccamount},</if>
  356. <if test="fStlamount != null">#{fStlamount},</if>
  357. <if test="fAccamountDate != null">#{fAccamountDate},</if>
  358. <if test="fInvnos != null">#{fInvnos},</if>
  359. <if test="fInvamount != null">#{fInvamount},</if>
  360. <if test="fInvoicingDate != null ">#{fInvoicingDate},</if>
  361. <if test="fStlamountNo != null">#{fStlamountNo},</if>
  362. <if test="fAskamount != null">#{fAskamount},</if>
  363. <if test="fStatus != null">#{fStatus},</if>
  364. <if test="fStlamountDate != null">#{fStlamountDate},</if>
  365. <if test="delFlag != null">#{delFlag},</if>
  366. <if test="createBy != null">#{createBy},</if>
  367. <if test="createTime != null">#{createTime},</if>
  368. <if test="updateBy != null">#{updateBy},</if>
  369. <if test="updateTime != null">#{updateTime},</if>
  370. <if test="remark != null">#{remark},</if>
  371. <if test="srcId != null">#{srcId},</if>
  372. <if test="srcBillNo != null">#{srcBillNo},</if>
  373. <if test="fMblno != null">#{fMblno},</if>
  374. <if test="fProductName != null">#{fProductName},</if>
  375. <if test="fMarks != null">#{fMarks},</if>
  376. <if test="fChargedate != null">#{fChargedate},</if>
  377. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  378. <if test="fInventoryDays != null">#{fInventoryDays},</if>
  379. <if test="fAmt != null">#{fAmt},</if>
  380. <if test="fBillingDays != null">#{fBillingDays},</if>
  381. <if test="fBillingQty != null">#{fBillingQty},</if>
  382. <if test="fBilltype != null">#{fBilltype},</if>
  383. <if test="fBillingway != null">#{fBillingway},</if>
  384. <if test="fBsdate != null">#{fBsdate},</if>
  385. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  386. <if test="fStltypeid != null">#{fStltypeid},</if>
  387. <if test="fBusinessType != null">#{fBusinessType},</if>
  388. <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
  389. <if test="priceDateRemarks != null">#{priceDateRemarks},</if>
  390. <if test="fAddress != null">#{fAddress},</if>
  391. <if test="fAddressName != null">#{fAddressName},</if>
  392. </trim>
  393. </insert>
  394. <update id="updateTWarehousebillsfees" parameterType="TWarehousebillsfees">
  395. update t_warehousebillsfees
  396. <trim prefix="SET" suffixOverrides=",">
  397. <if test="fPid != null">f_pid = #{fPid},</if>
  398. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  399. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  400. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  401. <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
  402. <if test="fQty != null">f_qty = #{fQty},</if>
  403. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  404. <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
  405. <if test="fAmount != null">f_amount = #{fAmount},</if>
  406. <if test="fCurrency != null">f_currency = #{fCurrency},</if>
  407. <if test="fExrate != null">f_exrate = #{fExrate},</if>
  408. <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
  409. <if test="fDc != null">f_dc = #{fDc},</if>
  410. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  411. <if test="fReviewDate != null || fReviewDate == null">f_review_date = #{fReviewDate},</if>
  412. <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
  413. <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
  414. <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
  415. <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
  416. <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
  417. <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
  418. <if test="fInvoicingDate != null ">f_invoicing_date = #{fInvoicingDate},</if>
  419. <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
  420. <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
  421. <if test="fStatus != null">f_status = #{fStatus},</if>
  422. <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
  423. <if test="delFlag != null">del_flag = #{delFlag},</if>
  424. <if test="createBy != null">create_by = #{createBy},</if>
  425. <if test="createTime != null">create_time = #{createTime},</if>
  426. <if test="updateBy != null">update_by = #{updateBy},</if>
  427. <if test="updateTime != null">update_time = #{updateTime},</if>
  428. <if test="remark != null">remark = #{remark},</if>
  429. <if test="srcId != null">src_id = #{srcId},</if>
  430. <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
  431. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  432. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  433. <if test="fMarks != null">f_marks = #{fMarks},</if>
  434. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  435. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  436. <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
  437. <if test="fAmt != null">f_amt = #{fAmt},</if>
  438. <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
  439. <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
  440. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  441. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  442. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  443. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  444. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  445. <if test="priceDateRemarks != null">price_date_remarks = #{priceDateRemarks},</if>
  446. <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
  447. <if test="fAddress != null">f_address = #{fAddress},</if>
  448. <if test="fAddressName != null">f_address_name = #{fAddressName},</if>
  449. </trim>
  450. where f_id = #{fId}
  451. </update>
  452. <delete id="deleteTWarehousebillsfeesById" parameterType="Long">
  453. delete
  454. from t_warehousebillsfees
  455. where f_id = #{fId}
  456. </delete>
  457. <delete id="deleteByFPid" parameterType="Long">
  458. update
  459. t_warehousebillsfees
  460. set del_flag = '1'
  461. where f_pid = #{fId}
  462. </delete>
  463. <delete id="deleteTWarehousebillsfeesByIds" parameterType="String">
  464. update
  465. t_warehousebillsfees
  466. set del_flag = '1'
  467. where f_id in
  468. <foreach item="fId" collection="array" open="(" separator="," close=")">
  469. #{fId}
  470. </foreach>
  471. </delete>
  472. <update id="warehouseFeesFollowUpdate">
  473. update
  474. t_warehousebillsfees
  475. <trim prefix="SET" suffixOverrides=",">
  476. <if test="fettle != null">f_billstatus = #{fettle},</if>
  477. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  478. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  479. </trim>
  480. where f_pid = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  481. </update>
  482. <update id="warehouseFeesFollowUpdateById">
  483. update
  484. t_warehousebillsfees
  485. <trim prefix="SET" suffixOverrides=",">
  486. <if test="fettle != null">f_billstatus = #{fettle},</if>
  487. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  488. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  489. </trim>
  490. where f_id = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  491. </update>
  492. <update id="updateTWarehousebillsfee" parameterType="Map">
  493. update t_warehousebillsfees
  494. <trim prefix="SET" suffixOverrides=",">
  495. /*判断确认对账*/
  496. <if test="map.billType == 'DZ'">
  497. f_statement_no = #{map.tFee.fBillno},
  498. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  499. f_accamount_date = #{map.tFee.fAccbilldate}
  500. </if>
  501. /*判断撤销对账*/
  502. <if test="map.billType == 'DZRevoke'">
  503. f_statement_no = "",
  504. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  505. f_accamount_date = null
  506. </if>
  507. /*判断收付款*/
  508. <if test="map.billType == 'DC'">
  509. f_stlamount_no = #{map.tFee.fBillno},
  510. f_stlamount = f_stlamount + #{map.tFeeDo.fAmt},
  511. f_stlamount_date =#{map.tFee.fAccbilldate}
  512. </if>
  513. /*判断撤销收付款*/
  514. <if test="map.billType == 'DCRevoke'">
  515. f_stlamount_no = #{map.tFee.fBillno},
  516. f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
  517. f_stlamount_date =#{map.tFee.fAccbilldate}
  518. </if>
  519. /*判断开发票款*/
  520. <if test="map.billType == 'invoiceFP'">
  521. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  522. f_stlamount_date =#{map.tFee.fAccbilldate}
  523. </if>
  524. <if test="map.billType == 'DZinvoiceFP'">
  525. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  526. f_stlamount_date =#{map.tFee.fAccbilldate}
  527. </if>
  528. /*判断申请发票款*/
  529. <if test="map.billType == 'ApplyFP'">
  530. f_askamount = f_askamount + #{map.tFeeDo.fAmt},
  531. f_stlamount_date =#{map.tFee.fAccbilldate}
  532. </if>
  533. <if test="map.billType == 'DZApplyFP'">
  534. f_askamount = f_askamount - #{map.tFeeDo.fAmt},
  535. f_stlamount_date =#{map.tFee.fAccbilldate}
  536. </if>
  537. /*判断确认对账*/
  538. <if test="map.billType == 'KHDZ'">
  539. f_statement_no = #{map.tFee.fBillno},
  540. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  541. f_accamount_date = #{map.tFee.fAccbilldate}
  542. </if>
  543. /*判断撤销对账*/
  544. <if test="map.billType == 'KHDZRevoke'">
  545. f_statement_no = "",
  546. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  547. f_accamount_date = null
  548. </if>
  549. /*判断确认仓库发票*/
  550. <if test="map.billType == 'FP'">
  551. f_invnos = #{map.tFee.invoiceNo},
  552. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  553. f_invoicing_date = #{map.tFee.fAccbilldate}
  554. </if>
  555. /*判断撤销仓库发票*/
  556. <if test="map.billType == 'FPRevoke'">
  557. f_invnos = #{map.tFee.invoiceNo},
  558. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  559. f_invoicing_date = #{map.tFee.fAccbilldate}
  560. </if>
  561. </trim>
  562. where f_id = #{map.tFeeDo.fSrcid}
  563. </update>
  564. <update id="updateByPid">
  565. update t_warehousebillsfees set f_bsdate = #{fChargedate} where f_pid = #{fId}
  566. </update>
  567. <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  568. SELECT
  569. tw.f_id,
  570. tw.f_pid,
  571. tw.f_lineno,
  572. tw.f_corpid,
  573. tc.f_name corpName,
  574. tw.f_feeid,
  575. tf.f_name feeName,
  576. tw.f_feeUnitid,
  577. tw.f_qty,
  578. tw.f_unitprice,
  579. tw.f_amount,
  580. tw.f_currency,
  581. tw.f_exrate,
  582. tw.f_taxrate,
  583. tw.f_dc,
  584. tw.f_billstatus,
  585. CASE
  586. WHEN tw.f_billstatus = '1' THEN
  587. '新建'
  588. WHEN tw.f_billstatus = '2' THEN
  589. '暂存'
  590. WHEN tw.f_billstatus = '3' THEN
  591. '驳回'
  592. WHEN tw.f_billstatus = '4' THEN
  593. '提交'
  594. WHEN tw.f_billstatus = '5' THEN
  595. '审批中'
  596. WHEN tw.f_billstatus = '6' THEN
  597. '审批通过'
  598. END AS fBillstatusName,
  599. tw.f_review_date,
  600. tw.f_statement_no,
  601. tw.f_accamount,
  602. tw.f_stlamount,
  603. tw.f_accamount_date,
  604. tw.f_invnos,
  605. tw.f_invamount,
  606. tw.f_stlamount_no,
  607. tw.f_askamount,
  608. tw.f_status,
  609. tw.f_stlamount_date,
  610. tw.del_flag,
  611. tw.create_by,
  612. tw.create_time,
  613. tw.update_by,
  614. tw.update_time,
  615. tw.remark,
  616. tw.src_id,
  617. tw.src_bill_no,
  618. tw.f_mblno,
  619. tw.f_product_name,
  620. tw.f_marks,
  621. tw.price_date_remarks,
  622. tw.f_chargedate,
  623. tw.f_billing_deadline,
  624. tw.f_inventory_days,
  625. tw.f_amt,
  626. tw.f_billing_days,
  627. tw.f_billing_qty,
  628. tw.f_billtype,
  629. tw.f_billingway,
  630. tw.f_bsdate,
  631. tw.f_originalbilldate,
  632. tw.f_stltypeid,
  633. tw.f_business_type,
  634. tw.f_src_type_id,
  635. tw.f_address,
  636. tw.f_address_name
  637. FROM
  638. t_warehousebillsfees tw
  639. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  640. LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
  641. where tw.f_pid = #{fPid}
  642. and tw.del_flag = '0'
  643. and tw.f_billtype = 'KHDD'
  644. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  645. </select>
  646. <select id="voyageFeeDetails" resultType="map">
  647. SELECT
  648. tf.f_name feeName,
  649. SUM(tw.f_unitprice) fUnitprice,
  650. SUM(tw.f_amount) fAmount
  651. FROM
  652. t_warehousebillsfees tw
  653. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  654. WHERE
  655. tw.f_pid = #{fPid}
  656. and tw.del_flag = '0'
  657. AND tw.f_billtype = 'KHDD'
  658. <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
  659. GROUP BY feeName;
  660. </select>
  661. <select id="selectSubItemsFeeDetails" resultType="map">
  662. select tf.f_name feeName,
  663. tw.f_unitprice fUnitprice,
  664. tw.f_amount fAmount
  665. from t_warehousebillsfees tw
  666. LEFT JOIN t_fees tf on tw.f_feeid = tf.f_id
  667. where
  668. tw.del_flag = '0'
  669. <if test="fPid != null and fPid != ''">and tw.f_pid = #{fPid}</if>
  670. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  671. </select>
  672. <delete id="deleteFessByFPid" parameterType="object">
  673. delete
  674. from t_warehousebillsfees
  675. where f_pid = #{fPid}
  676. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  677. </delete>
  678. <!--网页版查询对账-->
  679. <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
  680. SELECT
  681. tb.f_billno AS fBillno,
  682. /**运单号*/
  683. tv.f_name AS vesselName,
  684. /**船名*/
  685. ty.f_no AS voyageName,
  686. /**航次*/
  687. tc.f_name AS invoice,
  688. /**收费单位*/
  689. tc.f_name AS drawee,
  690. /**受票单位*/
  691. tp.f_name AS corpName,
  692. /**货权方*/
  693. pro.dict_label AS fPaymode,
  694. /**付款方式*/
  695. te.f_name AS payment,
  696. /**费用名称*/
  697. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
  698. /**原始金额*/
  699. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
  700. /**本次金额*/
  701. ta.f_name AS fLoadportidName,
  702. /**始发港*/
  703. tr.f_name AS fDestportidName,
  704. /**目的港*/
  705. pr.dict_label AS fServiceitems,
  706. /**运输条款*/
  707. tg.f_name AS goodName,
  708. /**货名*/
  709. tn.f_name AS transit,
  710. /**箱型*/
  711. items.f_cntrcount AS fCntrcount,
  712. /**箱量*/
  713. tb.f_shippername AS fShippername,
  714. /**发货人*/
  715. tb.f_consigneername AS fConsigneername,
  716. /**收货人*/
  717. tf.f_id AS fSrcid,
  718. tf.f_pid AS fSrcpid,
  719. tf.create_by AS createBy,
  720. tf.create_time AS createTime,
  721. tf.update_by AS updateBy,
  722. tf.update_time AS updateTime,
  723. tf.remark AS remark,
  724. tf.f_mblno AS fMblno,
  725. tf.f_corpid AS fCorpid,
  726. tf.f_feeid AS fFeeid
  727. FROM
  728. t_warehousebillsfees tf
  729. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  730. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  731. LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
  732. LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
  733. LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
  734. LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
  735. LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
  736. LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
  737. AND pro.dict_type = 'data_settlement_type'
  738. LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
  739. AND pr.dict_type = 'f_serviceitems'
  740. LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid =
  741. tb.f_id
  742. LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
  743. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
  744. ON items.f_pid = tb.f_id
  745. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
  746. twc.f_pid = tb.f_id
  747. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  748. LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
  749. WHERE
  750. tf.f_billstatus = 6
  751. and tf.del_flag = '0'
  752. AND tf.f_dc = 'D'
  753. AND tb.f_typeid = 1
  754. and tb.f_review_date IS NOT NULL
  755. and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
  756. <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
  757. <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
  758. <if test="fInvoceobj != null and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
  759. <if test="fShippername != null and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername},
  760. '%')
  761. </if>
  762. <if test="fConsigneername != null and fConsigneername != ''">and tb.f_consigneername like concat('%',
  763. #{fConsigneername}, '%')
  764. </if>
  765. <if test="fMblno != null and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%')</if>
  766. <if test="fBillno != null and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%')</if>
  767. <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
  768. <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
  769. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  770. <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
  771. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  772. and tf.create_time &gt;= #{sailTime[0]}
  773. </if>
  774. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  775. and tf.create_time &lt;= #{sailTime[1]}
  776. </if>
  777. <if test="fDocmentdate != null and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
  778. <if test="createBy != null and createBy != ''">and tb.create_by = #{createBy}</if>
  779. <if test="goodName != null and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
  780. ORDER BY tf.f_id desc
  781. </select>
  782. <!--网页版查询对账明细-->
  783. <select id="webVersionDetail" parameterType="TAccount" resultType="map">
  784. SELECT
  785. tf.f_id AS fId,
  786. te.f_billno AS accountBillno,
  787. /**账单编号*/
  788. tw.f_billno AS fBillno,
  789. /**运单编号*/
  790. tv.f_name AS vesselName,
  791. /**船名*/
  792. ty.f_no AS voyageName,
  793. /**航次*/
  794. te.f_ctrlcorpid AS fCtrlcorpid,
  795. /**获权方*/
  796. tp.f_name AS corpName,
  797. /**结算单位*/
  798. ta.f_name AS fLoadportidName,
  799. /**始发港*/
  800. tr.f_name AS fDestportidName,
  801. /**目的港*/
  802. pr.dict_label AS fServiceitems,
  803. /**运输条款*/
  804. ts.f_name AS payment,
  805. /**费用名称*/
  806. tf.f_amtdr AS fAmtdr,
  807. /**原始金额*/
  808. tf.f_amt AS fAmt,
  809. /**本次金额*/
  810. tn.f_name AS transit,
  811. /**箱型*/
  812. items.f_cntrcount AS fCntrcount,
  813. /**箱量*/
  814. tf.create_by AS createBy,
  815. tf.create_time AS createTime,
  816. CASE
  817. WHEN te.f_billstatus = '1' THEN
  818. '保存'
  819. WHEN te.f_billstatus = '2' THEN
  820. '暂存'
  821. WHEN te.f_billstatus = '3' THEN
  822. '审批驳回'
  823. WHEN te.f_billstatus = '4' THEN
  824. '提交审核'
  825. WHEN te.f_billstatus = '5' THEN
  826. '审核中'
  827. WHEN te.f_billstatus = '6' THEN
  828. '审核完成'
  829. END AS fBillstatus
  830. FROM
  831. t_fee_do tf
  832. LEFT JOIN t_fee te ON te.f_id = tf.f_pid
  833. LEFT JOIN t_warehousebills tw ON tf.f_srcpid = tw.f_id
  834. LEFT JOIN t_warehousebillsfees th ON th.f_id = tf.f_srcid
  835. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  836. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  837. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  838. LEFT JOIN t_address tr ON tr.f_id = tw.f_destportid
  839. LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
  840. AND pr.dict_type = 'f_serviceitems'
  841. LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
  842. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
  843. ON items.f_pid = tw.f_id
  844. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
  845. twc.f_pid = tw.f_id
  846. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  847. LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
  848. WHERE
  849. te.f_billtype = 'KHDZ'
  850. and th.del_flag = '0'
  851. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  852. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  853. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
  854. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername},
  855. '%')
  856. </if>
  857. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  858. #{fConsigneername}, '%')
  859. </if>
  860. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  861. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  862. <if test="fId != null">and tf.f_id = #{fId}</if>
  863. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  864. <if test="fCorpid != null">and te.f_corpid = #{fCorpid}</if>
  865. <if test="fPaymodeid != null">and tw.f_paymode = #{fPaymodeid}</if>
  866. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  867. and tf.create_time &gt;= #{sailTime[0]}
  868. </if>
  869. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  870. and tf.create_time &lt;= #{sailTime[1]}
  871. </if>
  872. <if test="fDocmentdate != null and fDocmentdate != ''">and tw.f_docmentdate = #{fDocmentdate}</if>
  873. <if test="createBy != null and createBy != ''">and te.create_by = #{createBy}</if>
  874. <if test="accountBillno != null and accountBillno != ''">and te.f_billno = #{accountBillno}</if>
  875. ORDER BY tf.f_id desc
  876. </select>
  877. <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
  878. select src_id
  879. FROM t_warehousebillsfees
  880. where f_pid = #{fId} and del_flag = '0'
  881. AND src_id IS NOT NULL
  882. </select>
  883. <select id="accountsDue" resultType="map">
  884. SELECT CASE MONTH (tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
  885. CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0
  886. END
  887. AS February,
  888. CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0
  889. END
  890. AS March,
  891. CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0
  892. END
  893. AS April,
  894. CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0
  895. END
  896. AS May,
  897. CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0
  898. END
  899. AS June,
  900. CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0
  901. END
  902. AS July,
  903. CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0
  904. END
  905. AS August,
  906. CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0
  907. END
  908. AS September,
  909. CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0
  910. END
  911. AS October,
  912. CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0
  913. END
  914. AS November,
  915. CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0
  916. END
  917. AS December,
  918. tc.f_name corpName
  919. FROM
  920. t_warehousebillsfees tf
  921. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  922. WHERE ifnull(tf.f_amount, 0) - ifnull(tf.f_stlamount, 0) >0
  923. AND tf.f_dc = 'D'
  924. and tf.del_flag = '0'
  925. AND YEAR(tf.create_time) = YEAR(NOW())
  926. GROUP BY tf.f_corpid
  927. LIMIT 10
  928. </select>
  929. <select id="selectQueryMenuList" parameterType="TWarehousebillsfees"
  930. resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
  931. SELECT
  932. tc.f_name AS corpName,
  933. tf.f_mblno AS fMblno,
  934. IF(tf.f_billtype = 'SJRK' || tf.f_billtype = 'SJCK' || tf.f_billtype = 'CKDB' || tf.f_billtype = 'HQZY' || tf.f_billtype = 'KCZZ' || tf.f_billtype = 'QTZW',tf.f_bsdate, null) AS fBsdate,
  935. tf.f_review_date AS fReviewDate,
  936. te.f_name AS feeName,
  937. tf.f_dc AS fDc,
  938. tf.f_amount AS fAmount,
  939. tf.f_stlamount_no AS fStlamountNo,
  940. tw.f_shipper AS fShipper,
  941. tw.f_emblno AS fEmblno,
  942. tf.f_stlamount AS fStlamount,
  943. tf.f_stlamount_date AS fStlamountDate,
  944. tf.f_invamount AS fInvamount,
  945. tf.f_invnos AS fInvnos,
  946. tf.f_accamount AS fAccamount,
  947. tf.f_accamount_date AS fAccamountDate,
  948. tf.f_statement_no AS fStatementNo,
  949. tf.f_feeUnitid AS fFeeUnitid,
  950. tf.f_qty AS fQty,
  951. tf.f_unitprice AS fUnitprice,
  952. tf.f_billtype AS fBilltype,
  953. tf.f_product_name AS fProductName,
  954. tf.f_stltypeid AS fStltypeid,
  955. tf.remark AS remark,
  956. tf.src_bill_no AS fSrcBillno,
  957. tf.f_chargedate AS fChargedate,
  958. tf.f_billing_deadline AS fBillingDeadline,
  959. tf.f_originalbilldate AS fOriginalbilldate,
  960. tf.f_exrate AS fExrate,
  961. tf.f_taxrate AS fTaxrate,
  962. CASE
  963. WHEN tf.f_billstatus = '1' THEN '录入'
  964. WHEN tf.f_billstatus = '2' THEN '暂存'
  965. WHEN tf.f_billstatus = '3' THEN '审批驳回'
  966. WHEN tf.f_billstatus = '4' THEN '提交审核'
  967. WHEN tf.f_billstatus = '5' THEN '审核中'
  968. WHEN tf.f_billstatus = '6' THEN '审核通过'
  969. END AS fBillstatusName
  970. FROM t_warehousebillsfees tf
  971. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  972. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  973. LEFT JOIN t_warehousebills tw on tf.f_pid = tw.f_id
  974. <where>
  975. tf.del_flag = '0'
  976. <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
  977. <if test="fDc != null and fDc != ''">and tf.f_dc = #{fDc}</if>
  978. <if test="fMblno != null and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
  979. <if test="fStalmountStatus == 1">and tf.f_stlamount_no is not null and tf.f_stlamount!=0</if>
  980. <if test="fStalmountStatus == 2">and tf.f_stlamount_no is null</if>
  981. <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount &gt;= 0 and tf.f_accamount
  982. != 0
  983. </if>
  984. <if test="feesStatus == 2">and tf.f_statement_no is null</if>
  985. <if test="fInvnosStatus == 1">and tf.f_invnos is not null and tf.f_invamount != 0</if>
  986. <if test="fInvnosStatus == 2">and tf.f_invnos is null</if>
  987. <if test="fCorpid != null and fCorpid != ''">and tf.f_corpid = #{fCorpid}</if>
  988. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
  989. <if test="fEmblno != null and fEmblno != ''">and tw.f_emblno like concat('%',#{fEmblno},'%')</if>
  990. <if test="fStltypeid != null">and tf.f_stltypeid = #{fStltypeid}</if>
  991. <if test="fSrcBillno != null">and tf.src_bill_no = #{fSrcBillno}</if>
  992. <if test='fFeeids != null'>
  993. and tf.f_feeid in
  994. <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
  995. #{fFeeid}
  996. </foreach>
  997. </if>
  998. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  999. and tf.f_review_date &gt;= #{fReviewDateList[0]}
  1000. </if>
  1001. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  1002. and tf.f_review_date &lt;= #{fReviewDateList[1]}
  1003. </if>
  1004. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  1005. and tf.f_bsdate &gt;= #{fBsdateList[0]}
  1006. </if>
  1007. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  1008. and tf.f_bsdate &lt;= #{fBsdateList[1]}
  1009. </if>
  1010. </where>
  1011. ORDER BY tf.f_bsdate desc
  1012. </select>
  1013. <select id="selectBillDetailsSubItemNew" parameterType="TWarehousebillsfees" resultType="map">
  1014. select
  1015. twf.f_pid as fId,
  1016. twf.f_mblno as fMblno,
  1017. dict.dict_label as fBusinesstype,
  1018. CASE
  1019. WHEN twf.f_billtype = 'SJRK' THEN '入库'
  1020. WHEN twf.f_billtype = 'SJCK' THEN '实际出库'
  1021. WHEN twf.f_billtype = 'CKDB' THEN '调拨'
  1022. WHEN twf.f_billtype = 'HQZY' THEN '货权转移'
  1023. WHEN twf.f_billtype = 'CDZZ' THEN '场地直装'
  1024. END as fBilltype,
  1025. twf.f_corpid as fCorpid,
  1026. twf.f_statement_no as fStatementno,
  1027. twf.f_product_name as tgfName,
  1028. tc.f_name as tcfName,
  1029. twf.f_qty as fQty,
  1030. tw.f_netweight as fNetweight,
  1031. tw.f_volumn as fVolumn,
  1032. date_format(twf.f_originalbilldate, '%Y-%m-%d') fOriginalbilldate,
  1033. date_format(twf.f_bsdate, '%Y-%m-%d') fBsdate,
  1034. twf.f_billing_days as fBillingdays,
  1035. twf.f_amt as fAmt,
  1036. twf.f_amount as fAmount,
  1037. twf.create_by as createBy,
  1038. date_format(twf.f_chargedate, '%Y-%m-%d') fChargedate,
  1039. date_format(twf.f_billing_deadline, '%Y-%m-%d') fStlamountdate,
  1040. th.f_name as fhName,
  1041. twf.f_dc as fDc,
  1042. twf.remark as remark
  1043. from t_warehousebillsfees twf
  1044. LEFT JOIN t_warehousebills tw on twf.f_pid = tw.f_id
  1045. LEFT JOIN t_goods tg on tw.f_goodsid = tg.f_id
  1046. LEFT JOIN t_corps tc on twf.f_corpid = tc.f_id
  1047. LEFT JOIN t_warehouse th on tw.f_warehouseid = th.f_id
  1048. LEFT JOIN (
  1049. SELECT
  1050. *
  1051. FROM
  1052. sys_dict_data dictIn
  1053. WHERE
  1054. dictIn.dict_label =
  1055. IF((
  1056. (dictIn.dict_type = 'st_in_type' AND dictIn.`status` = '0') OR
  1057. (dictIn.dict_type = 'st_out_type'AND dictIn.status = '0') OR
  1058. (dictIn.dict_type = 'st_trans_type' AND dictIn.status = '0')
  1059. ),dictIn.dict_label,NULL)
  1060. ) dict ON dict.dict_value = twf.f_business_type
  1061. <where>
  1062. twf.del_flag = '0'
  1063. <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
  1064. <if test="fMblno != null and fMblno != ''">and twf.f_mblno like concat('%', #{fMblno}, '%')</if>
  1065. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  1066. and twf.f_bsdate &gt;= #{fBsdateList[0]}
  1067. </if>
  1068. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  1069. and twf.f_bsdate &lt;= #{fBsdateList[1]}
  1070. </if>
  1071. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  1072. and twf.f_review_date &gt;= #{fReviewDateList[0]}
  1073. </if>
  1074. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  1075. and twf.f_review_date &lt;= #{fReviewDateList[1]}
  1076. </if>
  1077. <if test="fStalmountStatus == 1">and twf.f_stlamount_no is not null and twf.f_stlamount!=0</if>
  1078. <if test="fStalmountStatus == 2">and twf.f_stlamount_no is null</if>
  1079. <if test="feesStatus == 1">and twf.f_statement_no is not null and twf.f_accamount &gt;= 0 and
  1080. twf.f_accamount != 0
  1081. </if>
  1082. <if test="feesStatus == 2">and twf.f_statement_no is null</if>
  1083. <if test="fInvnosStatus == 1">and twf.f_invnos is not null and twf.f_invamount != 0</if>
  1084. <if test="fInvnosStatus == 2">and twf.f_invnos is null</if>
  1085. <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
  1086. <if test='fFeeids != null'>
  1087. and twf.f_feeid in
  1088. <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
  1089. #{fFeeid}
  1090. </foreach>
  1091. </if>
  1092. <if test="fBillstatus != null and fBillstatus != ''">and twf.f_billstatus = #{fBillstatus}</if>
  1093. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
  1094. </where>
  1095. GROUP BY
  1096. twf.f_mblno,tc.f_name
  1097. ORDER BY twf.f_bsdate desc
  1098. </select>
  1099. <select id="selectFeesBymblnoAndFname" resultType="map">
  1100. SELECT
  1101. tf.f_name as feeName,
  1102. SUM(twf.f_unitprice) as fUnitprice,
  1103. SUM(twf.f_amount) as fAmount
  1104. FROM
  1105. t_fees tf
  1106. LEFT JOIN t_warehousebillsfees twf on tf.f_id = twf.f_feeid
  1107. <where>
  1108. twf.del_flag = '0'
  1109. <if test="fMblno != null and fMblno != ''">and twf.f_mblno = #{fMblno}</if>
  1110. <if test="fCorpid != null and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
  1111. <if test="fDc != null and fDc != ''">and twf.f_dc = #{fDc}</if>
  1112. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  1113. and twf.f_bsdate &gt;= #{fBsdateList[0]}
  1114. </if>
  1115. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  1116. and twf.f_bsdate &lt;= #{fBsdateList[1]}
  1117. </if>
  1118. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  1119. and twf.f_review_date &gt;= #{fReviewDateList[0]}
  1120. </if>
  1121. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  1122. and twf.f_review_date &lt;= #{fReviewDateList[1]}
  1123. </if>
  1124. </where>
  1125. GROUP BY
  1126. feeName
  1127. </select>
  1128. <select id="getCorpid" resultType="long">
  1129. SELECT f_corpid FROM t_warehousebillsfees where del_flag = '0' and f_id in
  1130. <foreach item="fId" collection="fIds" open="(" separator="," close=")">
  1131. #{fId}
  1132. </foreach>
  1133. </select>
  1134. <select id="selectTWarehousebillsfeesList1" resultType="java.util.Map">
  1135. SELECT
  1136. tw.f_id AS fId,
  1137. tw.f_pid AS fPid,
  1138. tw.f_lineno AS fLineno,
  1139. tw.f_corpid AS fCorpid,
  1140. tw.f_feeid AS fFeeid,
  1141. tw.f_warehouseid AS fWarehouseid,
  1142. tw.f_feeUnitid AS fFeeUnitid,
  1143. tw.f_qty AS fQty,
  1144. tw.f_unitprice AS fUnitprice,
  1145. tw.f_amount AS fAmount,
  1146. tw.f_currency AS fCurrency,
  1147. tw.f_exrate AS fExrate,
  1148. tw.f_taxrate AS fTaxrate,
  1149. CASE
  1150. WHEN tw.f_taxrate = 0 THEN
  1151. '0.00%'
  1152. WHEN tw.f_taxrate != 0 THEN
  1153. CONCAT( tw.f_taxrate, '%' )
  1154. END AS f_taxratestr,
  1155. tw.f_dc AS fDc,
  1156. tw.f_billstatus AS fBillstatus,
  1157. tw.f_review_date AS fReviewDate,
  1158. tw.f_statement_no AS fStatementNo,
  1159. tw.f_accamount AS fAccamount,
  1160. tw.f_stlamount AS fStlamount,
  1161. tw.f_accamount_date AS fAccamountDate,
  1162. tw.f_stlamount_no AS fStlamountNo,
  1163. tw.f_askamount AS fAskamount,
  1164. tw.f_status AS f_status,
  1165. tw.f_stlamount_date AS fStlamountDate,
  1166. tw.del_flag AS delFlag,
  1167. tw.create_by AS createBy,
  1168. tw.create_time AS createTime,
  1169. tw.update_by AS updateBy,
  1170. tw.update_time AS updateTime,
  1171. tw.remark AS remark,
  1172. tw.src_id AS srcId,
  1173. tw.src_bill_no AS srcBillNo,
  1174. tw.f_mblno AS fMblno,
  1175. tw.f_product_name AS fProductName,
  1176. tw.f_marks AS fMarks,
  1177. tw.f_chargedate AS fChargedate,
  1178. tw.f_billing_deadline AS fBillingDeadline,
  1179. tw.f_inventory_days AS fInventoryDays,
  1180. tw.f_amt AS fAmt,
  1181. tw.f_billing_days AS fBillingDays,
  1182. tw.f_billing_qty AS fBillingQty,
  1183. tw.f_billtype AS fBilltype,
  1184. tw.f_billingway AS fBillingway,
  1185. tw.f_bsdate AS fBsdate,
  1186. tw.f_originalbilldate AS fOriginalbilldate,
  1187. tw.f_stltypeid AS fStltypeid,
  1188. tw.f_business_type AS fBusinessType,
  1189. tw.f_src_type_id AS fSrcTypeId,
  1190. tw.price_date_remarks AS priceDateRemarks,
  1191. tw.f_address_name AS fAddress_name,
  1192. tw.f_address AS fAddress,
  1193. tw.f_invnos AS fInvnos,
  1194. tw.f_invamount AS fInvamount,
  1195. tw.f_invoicing_date AS fInvoicingDate
  1196. FROM
  1197. t_warehousebillsfees tw
  1198. <where>
  1199. tw.del_flag = '0'
  1200. <if test="fPid != null ">and tw.f_pid = #{fPid}</if>
  1201. <if test="fLineno != null ">and tw.f_lineno = #{fLineno}</if>
  1202. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  1203. <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
  1204. <if test="fFeeunitid != null ">and tw.f_feeUnitid = #{fFeeunitid}</if>
  1205. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  1206. <if test="fUnitprice != null ">and tw.f_unitprice = #{fUnitprice}</if>
  1207. <if test="fAmount != null ">and tw.f_amount = #{fAmount}</if>
  1208. <if test="fCurrency != null and fCurrency != ''">and tw.f_currency = #{fCurrency}</if>
  1209. <if test="fExrate != null ">and tw.f_exrate = #{fExrate}</if>
  1210. <if test="fTaxrate != null ">and tw.f_taxrate = #{fTaxrate}</if>
  1211. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  1212. <if test="fBillstatus != null and fBillstatus != ''">and tw.f_billstatus = #{fBillstatus}</if>
  1213. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  1214. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  1215. <if test="fAccamount != null ">and tw.f_accamount = #{fAccamount}</if>
  1216. <if test="fStlamount != null ">and tw.f_stlamount = #{fStlamount}</if>
  1217. <if test="fAccamountDate != null ">and tw.f_accamount_date = #{fAccamountDate}</if>
  1218. <if test="fInvnos != null and fInvnos != ''">and tw.f_invnos = #{fInvnos}</if>
  1219. <if test="fInvamount != null ">and tw.f_invamount = #{fInvamount}</if>
  1220. <if test="fInvoicingDate != null ">and tw.f_invoicing_date = #{fInvoicingDate}</if>
  1221. <if test="fStlamountNo != null and fStlamountNo != ''">and tw.f_stlamount_no = #{fStlamountNo}</if>
  1222. <if test="fAskamount != null ">and tw.f_askamount = #{fAskamount}</if>
  1223. <if test="fStatus != null and fStatus != ''">and tw.f_status = #{fStatus}</if>
  1224. <if test="fStlamountDate != null ">and tw.f_stlamount_date = #{fStlamountDate}</if>
  1225. <if test="srcId != null ">and tw.src_id = #{srcId}</if>
  1226. <if test="srcBillNo != null and srcBillNo != ''">and tw.src_bill_no = #{srcBillNo}</if>
  1227. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  1228. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%', #{fProductName},
  1229. '%')
  1230. </if>
  1231. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  1232. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  1233. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  1234. <if test="fInventoryDays != null ">and tw.f_inventory_days = #{fInventoryDays}</if>
  1235. <if test="fAmt != null ">and tw.f_amt = #{fAmt}</if>
  1236. <if test="fBillingDays != null ">and tw.f_billing_days = #{fBillingDays}</if>
  1237. <if test="fBillingQty != null ">and tw.f_billing_qty = #{fBillingQty}</if>
  1238. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  1239. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  1240. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  1241. <if test="fOriginalbilldate != null ">and tw.f_originalbilldate = #{fOriginalbilldate}</if>
  1242. <if test="fStltypeid != null">and tw.f_stltypeid = #{fStltypeid},</if>
  1243. <if test="fSrcTypeId != null">and tw.f_src_type_id = #{fSrcTypeId},</if>
  1244. <if test="fAddress != null">and tw.f_address = #{fAddress}</if>
  1245. <if test="fAddressName != null and fAddressName != ''">and tw.f_address_name = #{fAddressName}</if>
  1246. GROUP BY tw.f_id
  1247. </where>
  1248. </select>
  1249. </mapper>