TWarehousebillsfeesMapper.xml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  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="fFeeid" column="f_feeid"/>
  12. <result property="fFeeunitid" column="f_feeUnitid"/>
  13. <result property="fWarehouseid" column="f_warehouseid"/>
  14. <result property="fQty" column="f_qty"/>
  15. <result property="fUnitprice" column="f_unitprice"/>
  16. <result property="fAmount" column="f_amount"/>
  17. <result property="fCurrency" column="f_currency"/>
  18. <result property="fExrate" column="f_exrate"/>
  19. <result property="fTaxrate" column="f_taxrate"/>
  20. <result property="fDc" column="f_dc"/>
  21. <result property="fBillstatus" column="f_billstatus"/>
  22. <result property="fReviewDate" column="f_review_date"/>
  23. <result property="fAccamount" column="f_accamount"/>
  24. <result property="fStatementNo" column="f_statement_no"/>
  25. <result property="fStlamount" column="f_stlamount"/>
  26. <result property="fInvnos" column="f_invnos"/>
  27. <result property="fAccamountDate" column="f_accamount_date"/>
  28. <result property="fInvamount" column="f_invamount"/>
  29. <result property="fStlamountNo" column="f_stlamount_no"/>
  30. <result property="fAskamount" column="f_askamount"/>
  31. <result property="fStatus" column="f_status"/>
  32. <result property="fStlamountDate" column="f_stlamount_date"/>
  33. <result property="delFlag" column="del_flag"/>
  34. <result property="createBy" column="create_by"/>
  35. <result property="createTime" column="create_time"/>
  36. <result property="updateBy" column="update_by"/>
  37. <result property="updateTime" column="update_time"/>
  38. <result property="remark" column="remark"/>
  39. <result property="srcId" column="src_id"/>
  40. <result property="srcBillNo" column="src_bill_no"/>
  41. <result property="fMblno" column="f_mblno"/>
  42. <result property="fProductName" column="f_product_name"/>
  43. <result property="fMarks" column="f_marks"/>
  44. <result property="fChargedate" column="f_chargedate"/>
  45. <result property="fBillingDeadline" column="f_billing_deadline"/>
  46. <result property="fInventoryDays" column="f_inventory_days"/>
  47. <result property="fAmt" column="f_amt"/>
  48. <result property="fBillingDays" column="f_billing_days"/>
  49. <result property="fBillingQty" column="f_billing_qty"/>
  50. <result property="fBilltype" column="f_billtype"/>
  51. <result property="fBillingway" column="f_billingway"/>
  52. <result property="fBsdate" column="f_bsdate"/>
  53. <result property="priceDateRemarks" column="price_date_remarks"/>
  54. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  55. <result property="fStltypeid" column="f_stltypeid"/>
  56. <result property="fBusinessType" column="f_business_type"/>
  57. <result property="fSrcTypeId" column="f_src_type_id"/>
  58. </resultMap>
  59. <sql id="selectTWarehousebillsfeesVo">
  60. select f_id,
  61. f_pid,
  62. f_lineno,
  63. f_corpid,
  64. f_feeid,
  65. f_warehouseid,
  66. f_feeUnitid,
  67. f_qty,
  68. f_unitprice,
  69. f_amount,
  70. f_currency,
  71. f_exrate,
  72. f_taxrate,
  73. f_dc,
  74. f_billstatus,
  75. f_review_date,
  76. f_statement_no,
  77. f_accamount,
  78. f_stlamount,
  79. f_accamount_date,
  80. f_invnos,
  81. f_invamount,
  82. f_stlamount_no,
  83. f_askamount,
  84. f_status,
  85. f_stlamount_date,
  86. del_flag,
  87. create_by,
  88. create_time,
  89. update_by,
  90. update_time,
  91. remark,
  92. src_id,
  93. src_bill_no,
  94. f_mblno,
  95. f_product_name,
  96. f_marks,
  97. f_chargedate,
  98. f_billing_deadline,
  99. f_inventory_days,
  100. f_amt,
  101. f_billing_days,
  102. f_billing_qty,
  103. f_billtype,
  104. f_billingway,
  105. f_bsdate,
  106. f_originalbilldate,
  107. f_stltypeid,
  108. f_business_type,
  109. f_src_type_id,
  110. price_date_remarks
  111. from t_warehousebillsfees
  112. </sql>
  113. <select id="selectTWarehousebillsfeesList" parameterType="TWarehousebillsfees"
  114. resultMap="TWarehousebillsfeesResult">
  115. <include refid="selectTWarehousebillsfeesVo"/>
  116. <where>
  117. <if test="fPid != null ">and f_pid = #{fPid}</if>
  118. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  119. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  120. <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
  121. <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
  122. <if test="fQty != null ">and f_qty = #{fQty}</if>
  123. <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
  124. <if test="fAmount != null ">and f_amount = #{fAmount}</if>
  125. <if test="fCurrency != null and fCurrency != ''">and f_currency = #{fCurrency}</if>
  126. <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
  127. <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
  128. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  129. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  130. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  131. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  132. <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
  133. <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
  134. <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
  135. <if test="fInvnos != null and fInvnos != ''">and f_invnos = #{fInvnos}</if>
  136. <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
  137. <if test="fStlamountNo != null and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
  138. <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
  139. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  140. <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
  141. <if test="srcId != null ">and src_id = #{srcId}</if>
  142. <if test="srcBillNo != null and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
  143. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  144. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  145. '%')
  146. </if>
  147. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  148. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  149. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  150. <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
  151. <if test="fAmt != null ">and f_amt = #{fAmt}</if>
  152. <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
  153. <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
  154. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  155. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  156. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  157. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  158. <if test="fStltypeid != null">and f_stltypeid = #{fStltypeid},</if>
  159. <if test="fSrcTypeId != null">and f_src_type_id = #{fSrcTypeId},</if>
  160. </where>
  161. </select>
  162. <select id="selectTWarehousebillsfeesById" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  163. <include refid="selectTWarehousebillsfeesVo"/>
  164. where f_id = #{fId}
  165. </select>
  166. <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  167. select f_id, f_pid, f_billing_deadline, src_bill_no
  168. from t_warehousebillsfees
  169. where f_pid = #{fId}
  170. and f_billtype = 'SJCK'
  171. </select>
  172. <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  173. <include refid="selectTWarehousebillsfeesVo"/>
  174. where f_pid = #{fId}
  175. </select>
  176. <select id="selectReconciliation" resultType="java.lang.Integer">
  177. SELECT COUNT(d.f_id)
  178. FROM t_fee_do d
  179. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  180. WHERE d.f_srcpid = #{fId}
  181. AND f.f_billtype = 'DZ'
  182. </select>
  183. <select id="selectCharge" resultType="java.lang.Integer">
  184. SELECT COUNT(d.f_id)
  185. FROM t_fee_do d
  186. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  187. WHERE d.f_srcpid = #{fId}
  188. AND f.f_billtype = 'SF'
  189. </select>
  190. <select id="selectPay" resultType="java.lang.Integer">
  191. SELECT COUNT(d.f_id)
  192. FROM t_fee_do d
  193. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  194. WHERE d.f_srcpid = #{fId}
  195. AND f.f_billtype = 'FF'
  196. </select>
  197. <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
  198. SELECT
  199. CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
  200. CONCAT(
  201. YEAR ( s.f_bsdate ),
  202. '-',
  203. MONTH ( s.f_bsdate )) feelMonth,
  204. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  205. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  206. sum( s.f_amount ) totalAmount,
  207. sum( s.f_invamount ) invamount,
  208. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  209. FROM
  210. t_warehousebillsfees s
  211. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  212. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  213. WHERE
  214. s.f_dc = 'D'
  215. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  216. and s.f_bsdate &gt;= #{fMonth[0]}
  217. </if>
  218. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  219. and s.f_bsdate &lt;= #{fMonth[1]}
  220. </if>
  221. GROUP BY
  222. CONCAT(
  223. YEAR ( f_bsdate ),
  224. '-',
  225. MONTH ( f_bsdate ))
  226. </select>
  227. <select id="selectFleetExcelList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
  228. SELECT
  229. #{createBy} userName,
  230. CONCAT(
  231. YEAR ( s.f_bsdate ),
  232. '-',
  233. MONTH ( s.f_bsdate )) feelMonth,
  234. c.f_name corpName,
  235. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  236. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  237. sum( s.f_amount ) totalAmount,
  238. IF
  239. ( f_invamount = 0, 'F', 'T' ) isInvoice,
  240. sum( s.f_invamount ) invamount,
  241. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  242. FROM
  243. t_warehousebillsfees s
  244. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  245. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  246. WHERE
  247. s.f_dc = 'D'
  248. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  249. and s.f_bsdate &gt;= #{fMonth[0]}
  250. </if>
  251. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  252. and s.f_bsdate &lt;= #{fMonth[1]}
  253. </if>
  254. GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
  255. </select>
  256. <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
  257. keyProperty="fId">
  258. insert into t_warehousebillsfees
  259. <trim prefix="(" suffix=")" suffixOverrides=",">
  260. <if test="fId != null">f_id,</if>
  261. <if test="fPid != null">f_pid,</if>
  262. <if test="fLineno != null">f_lineno,</if>
  263. <if test="fCorpid != null">f_corpid,</if>
  264. <if test="fFeeid != null">f_feeid,</if>
  265. <if test="fWarehouseid != null">f_warehouseid,</if>
  266. <if test="fFeeunitid != null">f_feeUnitid,</if>
  267. <if test="fQty != null">f_qty,</if>
  268. <if test="fUnitprice != null">f_unitprice,</if>
  269. <if test="fAmount != null">f_amount,</if>
  270. <if test="fCurrency != null">f_currency,</if>
  271. <if test="fExrate != null">f_exrate,</if>
  272. <if test="fTaxrate != null">f_taxrate,</if>
  273. <if test="fDc != null">f_dc,</if>
  274. <if test="fBillstatus != null">f_billstatus,</if>
  275. <if test="fReviewDate != null">f_review_date,</if>
  276. <if test="fStatementNo != null">f_statement_no,</if>
  277. <if test="fAccamount != null">f_accamount,</if>
  278. <if test="fStlamount != null">f_stlamount,</if>
  279. <if test="fAccamountDate != null">f_accamount_date,</if>
  280. <if test="fInvnos != null">f_invnos,</if>
  281. <if test="fInvamount != null">f_invamount,</if>
  282. <if test="fStlamountNo != null">f_stlamount_no,</if>
  283. <if test="fAskamount != null">f_askamount,</if>
  284. <if test="fStatus != null">f_status,</if>
  285. <if test="fStlamountDate != null">f_stlamount_date,</if>
  286. <if test="delFlag != null">del_flag,</if>
  287. <if test="createBy != null">create_by,</if>
  288. <if test="createTime != null">create_time,</if>
  289. <if test="updateBy != null">update_by,</if>
  290. <if test="updateTime != null">update_time,</if>
  291. <if test="remark != null">remark,</if>
  292. <if test="srcId != null">src_id,</if>
  293. <if test="srcBillNo != null">src_bill_no,</if>
  294. <if test="fMblno != null">f_mblno,</if>
  295. <if test="fProductName != null">f_product_name,</if>
  296. <if test="fMarks != null">f_marks,</if>
  297. <if test="fChargedate != null">f_chargedate,</if>
  298. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  299. <if test="fInventoryDays != null">f_inventory_days,</if>
  300. <if test="fAmt != null">f_amt,</if>
  301. <if test="fBillingDays != null">f_billing_days,</if>
  302. <if test="fBillingQty != null">f_billing_qty,</if>
  303. <if test="fBilltype != null">f_billtype,</if>
  304. <if test="fBillingway != null">f_billingway,</if>
  305. <if test="fBsdate != null">f_bsdate,</if>
  306. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  307. <if test="fStltypeid != null">f_stltypeid,</if>
  308. <if test="fBusinessType != null">f_business_type,</if>
  309. <if test="fSrcTypeId != null">f_src_type_id,</if>
  310. <if test="priceDateRemarks != null">price_date_remarks,</if>
  311. </trim>
  312. <trim prefix="values (" suffix=")" suffixOverrides=",">
  313. <if test="fId != null">#{fId},</if>
  314. <if test="fPid != null">#{fPid},</if>
  315. <if test="fLineno != null">#{fLineno},</if>
  316. <if test="fCorpid != null">#{fCorpid},</if>
  317. <if test="fFeeid != null">#{fFeeid},</if>
  318. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  319. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  320. <if test="fQty != null">#{fQty},</if>
  321. <if test="fUnitprice != null">#{fUnitprice},</if>
  322. <if test="fAmount != null">#{fAmount},</if>
  323. <if test="fCurrency != null">#{fCurrency},</if>
  324. <if test="fExrate != null">#{fExrate},</if>
  325. <if test="fTaxrate != null">#{fTaxrate},</if>
  326. <if test="fDc != null">#{fDc},</if>
  327. <if test="fBillstatus != null">#{fBillstatus},</if>
  328. <if test="fReviewDate != null">#{fReviewDate},</if>
  329. <if test="fStatementNo != null">#{fStatementNo},</if>
  330. <if test="fAccamount != null">#{fAccamount},</if>
  331. <if test="fStlamount != null">#{fStlamount},</if>
  332. <if test="fAccamountDate != null">#{fAccamountDate},</if>
  333. <if test="fInvnos != null">#{fInvnos},</if>
  334. <if test="fInvamount != null">#{fInvamount},</if>
  335. <if test="fStlamountNo != null">#{fStlamountNo},</if>
  336. <if test="fAskamount != null">#{fAskamount},</if>
  337. <if test="fStatus != null">#{fStatus},</if>
  338. <if test="fStlamountDate != null">#{fStlamountDate},</if>
  339. <if test="delFlag != null">#{delFlag},</if>
  340. <if test="createBy != null">#{createBy},</if>
  341. <if test="createTime != null">#{createTime},</if>
  342. <if test="updateBy != null">#{updateBy},</if>
  343. <if test="updateTime != null">#{updateTime},</if>
  344. <if test="remark != null">#{remark},</if>
  345. <if test="srcId != null">#{srcId},</if>
  346. <if test="srcBillNo != null">#{srcBillNo},</if>
  347. <if test="fMblno != null">#{fMblno},</if>
  348. <if test="fProductName != null">#{fProductName},</if>
  349. <if test="fMarks != null">#{fMarks},</if>
  350. <if test="fChargedate != null">#{fChargedate},</if>
  351. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  352. <if test="fInventoryDays != null">#{fInventoryDays},</if>
  353. <if test="fAmt != null">#{fAmt},</if>
  354. <if test="fBillingDays != null">#{fBillingDays},</if>
  355. <if test="fBillingQty != null">#{fBillingQty},</if>
  356. <if test="fBilltype != null">#{fBilltype},</if>
  357. <if test="fBillingway != null">#{fBillingway},</if>
  358. <if test="fBsdate != null">#{fBsdate},</if>
  359. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  360. <if test="fStltypeid != null">#{fStltypeid},</if>
  361. <if test="fBusinessType != null">#{fBusinessType},</if>
  362. <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
  363. <if test="priceDateRemarks != null">#{priceDateRemarks},</if>
  364. </trim>
  365. </insert>
  366. <update id="updateTWarehousebillsfees" parameterType="TWarehousebillsfees">
  367. update t_warehousebillsfees
  368. <trim prefix="SET" suffixOverrides=",">
  369. <if test="fPid != null">f_pid = #{fPid},</if>
  370. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  371. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  372. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  373. <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
  374. <if test="fQty != null">f_qty = #{fQty},</if>
  375. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  376. <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
  377. <if test="fAmount != null">f_amount = #{fAmount},</if>
  378. <if test="fCurrency != null">f_currency = #{fCurrency},</if>
  379. <if test="fExrate != null">f_exrate = #{fExrate},</if>
  380. <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
  381. <if test="fDc != null">f_dc = #{fDc},</if>
  382. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  383. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  384. <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
  385. <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
  386. <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
  387. <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
  388. <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
  389. <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
  390. <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
  391. <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
  392. <if test="fStatus != null">f_status = #{fStatus},</if>
  393. <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
  394. <if test="delFlag != null">del_flag = #{delFlag},</if>
  395. <if test="createBy != null">create_by = #{createBy},</if>
  396. <if test="createTime != null">create_time = #{createTime},</if>
  397. <if test="updateBy != null">update_by = #{updateBy},</if>
  398. <if test="updateTime != null">update_time = #{updateTime},</if>
  399. <if test="remark != null">remark = #{remark},</if>
  400. <if test="srcId != null">src_id = #{srcId},</if>
  401. <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
  402. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  403. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  404. <if test="fMarks != null">f_marks = #{fMarks},</if>
  405. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  406. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  407. <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
  408. <if test="fAmt != null">f_amt = #{fAmt},</if>
  409. <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
  410. <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
  411. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  412. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  413. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  414. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  415. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  416. <if test="priceDateRemarks != null">price_date_remarks = #{priceDateRemarks},</if>
  417. <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
  418. </trim>
  419. where f_id = #{fId}
  420. </update>
  421. <delete id="deleteTWarehousebillsfeesById" parameterType="Long">
  422. delete
  423. from t_warehousebillsfees
  424. where f_id = #{fId}
  425. </delete>
  426. <delete id="deleteByFPid" parameterType="Long">
  427. delete
  428. from t_warehousebillsfees
  429. where f_pid = #{fId}
  430. </delete>
  431. <delete id="deleteTWarehousebillsfeesByIds" parameterType="String">
  432. delete from t_warehousebillsfees where f_id in
  433. <foreach item="fId" collection="array" open="(" separator="," close=")">
  434. #{fId}
  435. </foreach>
  436. </delete>
  437. <update id="warehouseFeesFollowUpdate">
  438. update
  439. t_warehousebillsfees
  440. <trim prefix="SET" suffixOverrides=",">
  441. <if test="fettle != null">f_billstatus = #{fettle},</if>
  442. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  443. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  444. </trim>
  445. where f_pid = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  446. </update>
  447. <update id="warehouseFeesFollowUpdateById">
  448. update
  449. t_warehousebillsfees
  450. <trim prefix="SET" suffixOverrides=",">
  451. <if test="fettle != null">f_billstatus = #{fettle},</if>
  452. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  453. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  454. </trim>
  455. where f_id = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  456. </update>
  457. <update id="updateTWarehousebillsfee" parameterType="Map">
  458. update t_warehousebillsfees
  459. <trim prefix="SET" suffixOverrides=",">
  460. /*判断确认对账*/
  461. <if test="map.billType == 'DZ'">
  462. f_statement_no = #{map.tFee.fBillno},
  463. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  464. f_accamount_date = #{map.tFee.fAccbilldate}
  465. </if>
  466. /*判断撤销对账*/
  467. <if test="map.billType == 'DZRevoke'">
  468. f_statement_no = #{map.tFee.fBillno},
  469. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  470. f_accamount_date = #{map.tFee.fAccbilldate}
  471. </if>
  472. /*判断收付款*/
  473. <if test="map.billType == 'DC'">
  474. f_stlamount_no = #{map.tFee.fBillno},
  475. f_stlamount = f_stlamount + #{map.tFeeDo.fAmt},
  476. f_stlamount_date =#{map.tFee.fAccbilldate}
  477. </if>
  478. /*判断撤销收付款*/
  479. <if test="map.billType == 'DCRevoke'">
  480. f_stlamount_no = #{map.tFee.fBillno},
  481. f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
  482. f_stlamount_date =#{map.tFee.fAccbilldate}
  483. </if>
  484. /*判断开发票款*/
  485. <if test="map.billType == 'invoiceFP'">
  486. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  487. f_stlamount_date =#{map.tFee.fAccbilldate}
  488. </if>
  489. <if test="map.billType == 'DZinvoiceFP'">
  490. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  491. f_stlamount_date =#{map.tFee.fAccbilldate}
  492. </if>
  493. /*判断申请发票款*/
  494. <if test="map.billType == 'ApplyFP'">
  495. f_askamount = f_askamount + #{map.tFeeDo.fAmt},
  496. f_stlamount_date =#{map.tFee.fAccbilldate}
  497. </if>
  498. <if test="map.billType == 'DZApplyFP'">
  499. f_askamount = f_askamount - #{map.tFeeDo.fAmt},
  500. f_stlamount_date =#{map.tFee.fAccbilldate}
  501. </if>
  502. /*判断确认对账*/
  503. <if test="map.billType == 'KHDZ'">
  504. f_statement_no = #{map.tFee.fBillno},
  505. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  506. f_accamount_date = #{map.tFee.fAccbilldate}
  507. </if>
  508. /*判断撤销对账*/
  509. <if test="map.billType == 'KHDZRevoke'">
  510. f_statement_no = #{map.tFee.fBillno},
  511. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  512. f_accamount_date = #{map.tFee.fAccbilldate}
  513. </if>
  514. /*判断确认仓库发票*/
  515. <if test="map.billType == 'FP'">
  516. f_invnos = #{map.tFee.fBillno},
  517. f_invamount = f_invamount + #{map.tFeeDo.fAmt}
  518. </if>
  519. /*判断撤销仓库发票*/
  520. <if test="map.billType == 'FPRevoke'">
  521. f_invnos = #{map.tFee.fBillno},
  522. f_invamount = f_invamount - #{map.tFeeDo.fAmt}
  523. </if>
  524. </trim>
  525. where f_id = #{map.tFeeDo.fSrcid}
  526. </update>
  527. <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  528. SELECT
  529. tw.f_id,
  530. tw.f_pid,
  531. tw.f_lineno,
  532. tw.f_corpid,
  533. tc.f_name corpName,
  534. tw.f_feeid,
  535. tf.f_name feeName,
  536. tw.f_feeUnitid,
  537. tw.f_qty,
  538. tw.f_unitprice,
  539. tw.f_amount,
  540. tw.f_currency,
  541. tw.f_exrate,
  542. tw.f_taxrate,
  543. tw.f_dc,
  544. tw.f_billstatus,
  545. CASE
  546. WHEN tw.f_billstatus = '1' THEN
  547. '新建'
  548. WHEN tw.f_billstatus = '2' THEN
  549. '暂存'
  550. WHEN tw.f_billstatus = '3' THEN
  551. '驳回'
  552. WHEN tw.f_billstatus = '4' THEN
  553. '提交'
  554. WHEN tw.f_billstatus = '5' THEN
  555. '审批中'
  556. WHEN tw.f_billstatus = '6' THEN
  557. '审批通过'
  558. END AS fBillstatusName,
  559. tw.f_review_date,
  560. tw.f_statement_no,
  561. tw.f_accamount,
  562. tw.f_stlamount,
  563. tw.f_accamount_date,
  564. tw.f_invnos,
  565. tw.f_invamount,
  566. tw.f_stlamount_no,
  567. tw.f_askamount,
  568. tw.f_status,
  569. tw.f_stlamount_date,
  570. tw.del_flag,
  571. tw.create_by,
  572. tw.create_time,
  573. tw.update_by,
  574. tw.update_time,
  575. tw.remark,
  576. tw.src_id,
  577. tw.src_bill_no,
  578. tw.f_mblno,
  579. tw.f_product_name,
  580. tw.f_marks,
  581. tw.price_date_remarks,
  582. tw.f_chargedate,
  583. tw.f_billing_deadline,
  584. tw.f_inventory_days,
  585. tw.f_amt,
  586. tw.f_billing_days,
  587. tw.f_billing_qty,
  588. tw.f_billtype,
  589. tw.f_billingway,
  590. tw.f_bsdate,
  591. tw.f_originalbilldate,
  592. tw.f_stltypeid,
  593. tw.f_business_type,
  594. tw.f_src_type_id
  595. FROM
  596. t_warehousebillsfees tw
  597. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  598. LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
  599. where tw.f_pid = #{fPid}
  600. and tw.f_billtype = 'KHDD'
  601. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  602. </select>
  603. <delete id="deleteFessByFPid" parameterType="object">
  604. delete
  605. from t_warehousebillsfees
  606. where f_pid = #{fPid}
  607. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  608. </delete>
  609. <!--网页版查询对账-->
  610. <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
  611. SELECT
  612. tb.f_billno AS fBillno,
  613. /**运单号*/
  614. tv.f_name AS vesselName,
  615. /**船名*/
  616. ty.f_no AS voyageName,
  617. /**航次*/
  618. tc.f_name AS invoice,
  619. /**收费单位*/
  620. tc.f_name AS drawee,
  621. /**受票单位*/
  622. tp.f_name AS corpName,
  623. /**货权方*/
  624. pro.dict_label AS fPaymode,
  625. /**付款方式*/
  626. te.f_name AS payment,
  627. /**费用名称*/
  628. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
  629. /**原始金额*/
  630. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
  631. /**本次金额*/
  632. ta.f_name AS fLoadportidName,
  633. /**始发港*/
  634. tr.f_name AS fDestportidName,
  635. /**目的港*/
  636. pr.dict_label AS fServiceitems,
  637. /**运输条款*/
  638. tg.f_name AS goodName,
  639. /**货名*/
  640. tn.f_name AS transit,
  641. /**箱型*/
  642. items.f_cntrcount AS fCntrcount,
  643. /**箱量*/
  644. tb.f_shippername AS fShippername,
  645. /**发货人*/
  646. tb.f_consigneername AS fConsigneername,
  647. /**收货人*/
  648. tf.f_id AS fSrcid,
  649. tf.f_pid AS fSrcpid,
  650. tf.create_by AS createBy,
  651. tf.create_time AS createTime,
  652. tf.update_by AS updateBy,
  653. tf.update_time AS updateTime,
  654. tf.remark AS remark,
  655. tf.f_mblno AS fMblno,
  656. tf.f_corpid AS fCorpid,
  657. tf.f_feeid AS fFeeid
  658. FROM
  659. t_warehousebillsfees tf
  660. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  661. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  662. LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
  663. LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
  664. LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
  665. LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
  666. LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
  667. LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
  668. AND pro.dict_type = 'data_settlement_type'
  669. LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
  670. AND pr.dict_type = 'f_serviceitems'
  671. LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid = tb.f_id
  672. LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
  673. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tb.f_id
  674. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tb.f_id
  675. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  676. LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
  677. WHERE
  678. tf.f_billstatus = 6
  679. AND tf.f_dc = 'D'
  680. AND tb.f_typeid = 1
  681. and tb.f_review_date IS NOT NULL
  682. and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
  683. <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
  684. <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
  685. <if test="fInvoceobj != null and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
  686. <if test="fShippername != null and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername}, '%') </if>
  687. <if test="fConsigneername != null and fConsigneername != ''">and tb.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
  688. <if test="fMblno != null and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%') </if>
  689. <if test="fBillno != null and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%') </if>
  690. <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
  691. <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
  692. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  693. <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
  694. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  695. and tf.create_time &gt;= #{sailTime[0]}
  696. </if>
  697. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  698. and tf.create_time &lt;= #{sailTime[1]}
  699. </if>
  700. <if test="fDocmentdate != null and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
  701. <if test="createBy != null and createBy != ''">and tb.create_by = #{createBy}</if>
  702. <if test="goodName != null and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
  703. ORDER BY tf.f_id desc
  704. </select>
  705. <!--网页版查询对账明细-->
  706. <select id="webVersionDetail" parameterType="TAccount" resultType="map">
  707. SELECT
  708. tf.f_id AS fId,
  709. te.f_billno AS accountBillno,
  710. /**账单编号*/
  711. tw.f_billno AS fBillno,
  712. /**运单编号*/
  713. tv.f_name AS vesselName,
  714. /**船名*/
  715. ty.f_no AS voyageName,
  716. /**航次*/
  717. te.f_ctrlcorpid AS fCtrlcorpid,
  718. /**获权方*/
  719. tp.f_name AS corpName,
  720. /**结算单位*/
  721. ta.f_name AS fLoadportidName,
  722. /**始发港*/
  723. tr.f_name AS fDestportidName,
  724. /**目的港*/
  725. pr.dict_label AS fServiceitems,
  726. /**运输条款*/
  727. ts.f_name AS payment,
  728. /**费用名称*/
  729. tf.f_amtdr AS fAmtdr,
  730. /**原始金额*/
  731. tf.f_amt AS fAmt,
  732. /**本次金额*/
  733. tn.f_name AS transit,
  734. /**箱型*/
  735. items.f_cntrcount AS fCntrcount,
  736. /**箱量*/
  737. tf.create_by AS createBy,
  738. tf.create_time AS createTime,
  739. CASE
  740. WHEN te.f_billstatus = '1' THEN
  741. '保存'
  742. WHEN te.f_billstatus = '2' THEN
  743. '暂存'
  744. WHEN te.f_billstatus = '3' THEN
  745. '审批驳回'
  746. WHEN te.f_billstatus = '4' THEN
  747. '提交审核'
  748. WHEN te.f_billstatus = '5' THEN
  749. '审核中'
  750. WHEN te.f_billstatus = '6' THEN
  751. '审核完成'
  752. END AS fBillstatus
  753. FROM
  754. t_fee_do tf
  755. LEFT JOIN t_fee te ON te.f_id = tf.f_pid
  756. LEFT JOIN t_warehousebills tw ON tf.f_srcpid = tw.f_id
  757. LEFT JOIN t_warehousebillsfees th ON th.f_id = tf.f_srcid
  758. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  759. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  760. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  761. LEFT JOIN t_address tr ON tr.f_id = tw.f_destportid
  762. LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
  763. AND pr.dict_type = 'f_serviceitems'
  764. LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
  765. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tw.f_id
  766. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tw.f_id
  767. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  768. LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
  769. WHERE
  770. te.f_billtype = 'KHDZ'
  771. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  772. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  773. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
  774. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername}, '%') </if>
  775. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
  776. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  777. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  778. <if test="fId != null">and tf.f_id = #{fId}</if>
  779. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  780. <if test="fCorpid != null">and te.f_corpid = #{fCorpid}</if>
  781. <if test="fPaymodeid != null">and tw.f_paymode = #{fPaymodeid}</if>
  782. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  783. and tf.create_time &gt;= #{sailTime[0]}
  784. </if>
  785. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  786. and tf.create_time &lt;= #{sailTime[1]}
  787. </if>
  788. <if test="fDocmentdate != null and fDocmentdate != ''">and tw.f_docmentdate = #{fDocmentdate}</if>
  789. <if test="createBy != null and createBy != ''">and te.create_by = #{createBy}</if>
  790. <if test="accountBillno != null and accountBillno != ''">and te.f_billno = #{accountBillno}</if>
  791. ORDER BY tf.f_id desc
  792. </select>
  793. <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
  794. select src_id
  795. FROM
  796. t_warehousebillsfees
  797. where f_pid = #{fId}
  798. AND src_id IS NOT NULL
  799. </select>
  800. <select id="accountsDue" resultType="map">
  801. SELECT
  802. CASE MONTH(tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
  803. CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0 END AS February,
  804. CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0 END AS March,
  805. CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0 END AS April,
  806. CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0 END AS May,
  807. CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0 END AS June,
  808. CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0 END AS July,
  809. CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0 END AS August,
  810. CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0 END AS September,
  811. CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0 END AS October,
  812. CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0 END AS November,
  813. CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0 END AS December,
  814. tc.f_name corpName
  815. FROM
  816. t_warehousebillsfees tf
  817. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  818. WHERE ifnull(tf.f_amount, 0) - ifnull(tf.f_stlamount, 0) >0
  819. AND tf.f_dc = 'D'
  820. AND YEAR(tf.create_time) = YEAR(NOW())
  821. GROUP BY tf.f_corpid
  822. LIMIT 10
  823. </select>
  824. <select id="selectQueryMenuList" parameterType="TWarehousebillsfees" resultType="map">
  825. SELECT tf.f_id AS fId,
  826. tf.f_pid AS fPid,
  827. tf.f_corpid AS fCorpid,
  828. tc.f_no AS corpNo,
  829. tc.f_cname AS corpCname,
  830. tc.f_name AS corpName,
  831. tf.f_mblno AS fMblno,
  832. tf.f_bsdate AS fBsdate,
  833. tf.f_review_date AS fReviewDate,
  834. tf.f_feeid AS fFeeid,
  835. te.f_no AS feeNo,
  836. te.f_name AS feeName,
  837. tf.f_dc AS fDc,
  838. tf.f_amount AS fAmount,
  839. tf.f_stlamount AS fStlamount,
  840. tf.f_stlamount_date AS fStlamountDate,
  841. tf.f_invamount AS fInvamount,
  842. tf.f_invnos AS fInvnos,
  843. tf.f_accamount AS fAccamount,
  844. tf.f_accamount_date AS fAccamountDate,
  845. tf.f_statement_no AS fStatementNo,
  846. tf.f_feeUnitid AS fFeeUnitid,
  847. tf.f_qty AS fQty,
  848. tf.f_unitprice AS fUnitprice,
  849. tf.f_billtype AS fBilltype,
  850. tf.f_product_name AS fProductName,
  851. tf.remark AS remark,
  852. tf.price_date_remarks AS priceDateRemarks,
  853. CASE
  854. WHEN tf.f_billstatus = '1' THEN '录入'
  855. WHEN tf.f_billstatus = '2' THEN '暂存'
  856. WHEN tf.f_billstatus = '3' THEN '审批驳回'
  857. WHEN tf.f_billstatus = '4' THEN '提交审核'
  858. WHEN tf.f_billstatus = '5' THEN '审核中'
  859. WHEN tf.f_billstatus = '6' THEN '审核通过'
  860. END AS fBillstatusName
  861. FROM t_warehousebillsfees tf
  862. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  863. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  864. <where>
  865. <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
  866. <if test="fDc != null and fDc != ''">and tf.f_dc = #{fDc}</if>
  867. <if test="fMblno != null and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
  868. <if test="fCorpid != null and fCorpid != ''">and tf.f_corpid = #{fCorpid}</if>
  869. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  870. and tf.f_review_date &gt;= #{fReviewDateList[0]}
  871. </if>
  872. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  873. and tf.f_review_date &lt;= #{fReviewDateList[1]}
  874. </if>
  875. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  876. and tf.f_bsdate &gt;= #{fBsdateList[0]}
  877. </if>
  878. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  879. and tf.f_bsdate &lt;= #{fBsdateList[1]}
  880. </if>
  881. </where>
  882. ORDER BY tf.f_bsdate desc
  883. </select>
  884. </mapper>