TFeeMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.finance.mapper.TFeeMapper">
  6. <resultMap type="TFee" id="TFeeResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="tMblno" column="t_mblno"/>
  12. <result property="fAmtdr" column="f_amtdr"/>
  13. <result property="fAmtcr" column="f_amtcr"/>
  14. <result property="fBilltype" column="f_billtype"/>
  15. <result property="fBillstatus" column="f_billstatus"/>
  16. <result property="fRemarks" column="f_remarks"/>
  17. <result property="fAccbilldate" column="f_accbilldate"/>
  18. <result property="delFlag" column="del_flag"/>
  19. <result property="createBy" column="create_by"/>
  20. <result property="fDeptid" column="f_deptid"/>
  21. <result property="createTime" column="create_time"/>
  22. <result property="updateBy" column="update_by"/>
  23. <result property="updateTime" column="update_time"/>
  24. </resultMap>
  25. <sql id="selectTFeeVo">
  26. select f_id, f_billno, f_ctrlcorpid, f_corpid, t_mblno, f_amtdr, f_amtcr, f_billtype, f_billstatus, f_remarks, f_accbilldate, del_flag, create_by, f_deptid, create_time, update_by, update_time from t_fee
  27. </sql>
  28. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  29. <include refid="selectTFeeVo"/>
  30. <where>
  31. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  32. <if test="fCtrlcorpid != null ">and f_ctrlcorpid = #{fCtrlcorpid}</if>
  33. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  34. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  35. <if test="fAmtdr != null ">and f_amtdr = #{fAmtdr}</if>
  36. <if test="fAmtcr != null ">and f_amtcr = #{fAmtcr}</if>
  37. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  38. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  39. <if test="fRemarks != null and fRemarks != ''">and f_remarks = #{fRemarks}</if>
  40. <if test="fAccbilldate != null ">and f_accbilldate = #{fAccbilldate}</if>
  41. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  42. </where>
  43. </select>
  44. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  45. SELECT
  46. f.f_id AS fId,
  47. f.f_billno AS fBillno,
  48. f.f_ctrlcorpid AS fCtrlcorpid,
  49. f.f_corpid AS fCorpid,
  50. c.f_name AS fCorpidName,
  51. f.f_accbilldate AS fAccbilldate,
  52. f.t_mblno AS tMblno,
  53. f.f_amtdr AS fAmtdr,
  54. f.f_amtcr AS fAmtcr,
  55. f.f_billtype AS fBilltype,
  56. f.f_billstatus AS fBillstatus,
  57. f.f_remarks AS fRemarks,
  58. f.create_by AS createBy
  59. FROM
  60. t_fee AS f
  61. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  62. <where>
  63. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  64. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  65. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  66. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  67. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  68. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  69. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  70. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  71. <if test="fRemarks != null and fRemarks != ''">and f.f_remarks = #{fRemarks}</if>
  72. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  73. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  74. </where>
  75. </select>
  76. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  77. <include refid="selectTFeeVo"/>
  78. where f_id = #{fId}
  79. </select>
  80. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  81. insert into t_fee
  82. <trim prefix="(" suffix=")" suffixOverrides=",">
  83. <if test="fBillno != null">f_billno,</if>
  84. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  85. <if test="fCorpid != null">f_corpid,</if>
  86. <if test="tMblno != null">t_mblno,</if>
  87. <if test="fAmtdr != null">f_amtdr,</if>
  88. <if test="fAmtcr != null">f_amtcr,</if>
  89. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  90. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  91. <if test="fRemarks != null">f_remarks,</if>
  92. <if test="fAccbilldate != null">f_accbilldate,</if>
  93. <if test="delFlag != null">del_flag,</if>
  94. <if test="createBy != null">create_by,</if>
  95. <if test="fDeptid != null">f_deptid,</if>
  96. <if test="createTime != null">create_time,</if>
  97. <if test="updateBy != null">update_by,</if>
  98. <if test="updateTime != null">update_time,</if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="fBillno != null">#{fBillno},</if>
  102. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  103. <if test="fCorpid != null">#{fCorpid},</if>
  104. <if test="tMblno != null">#{tMblno},</if>
  105. <if test="fAmtdr != null">#{fAmtdr},</if>
  106. <if test="fAmtcr != null">#{fAmtcr},</if>
  107. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  108. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  109. <if test="fRemarks != null">#{fRemarks},</if>
  110. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  111. <if test="delFlag != null">#{delFlag},</if>
  112. <if test="createBy != null">#{createBy},</if>
  113. <if test="fDeptid != null">#{fDeptid},</if>
  114. <if test="createTime != null">#{createTime},</if>
  115. <if test="updateBy != null">#{updateBy},</if>
  116. <if test="updateTime != null">#{updateTime},</if>
  117. </trim>
  118. </insert>
  119. <update id="updateTFee" parameterType="TFee">
  120. update t_fee
  121. <trim prefix="SET" suffixOverrides=",">
  122. <if test="fBillno != null">f_billno = #{fBillno},</if>
  123. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  124. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  125. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  126. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  127. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  128. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  129. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  130. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  131. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  132. <if test="delFlag != null">del_flag = #{delFlag},</if>
  133. <if test="createBy != null">create_by = #{createBy},</if>
  134. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  135. <if test="createTime != null">create_time = #{createTime},</if>
  136. <if test="updateBy != null">update_by = #{updateBy},</if>
  137. <if test="updateTime != null">update_time = #{updateTime},</if>
  138. </trim>
  139. where f_id = #{fId}
  140. </update>
  141. <delete id="deleteTFeeById" parameterType="Long">
  142. delete from t_fee where f_id = #{fId}
  143. </delete>
  144. <delete id="deleteTFeeByIds" parameterType="String">
  145. delete
  146. f.*,
  147. fd.*
  148. from
  149. t_fee f
  150. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  151. where f.f_id in
  152. <foreach item="fId" collection="array" open="(" separator="," close=")">
  153. #{fId}
  154. </foreach>
  155. </delete>
  156. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  157. SELECT
  158. w.f_id AS fSrcid,
  159. t.f_id AS fSrcpid,
  160. t.f_corpid AS fCorpid,
  161. c.f_name AS fName,
  162. w.fId AS fId,
  163. w.fName AS fFeesName,
  164. t.f_bscorpno AS fBscorpno,
  165. w.f_mblno AS fMblno,
  166. w.f_product_name AS fProductName,
  167. t.f_bsdate AS fBsdate,
  168. t.f_billtype AS fBilltype,
  169. t.f_review_date AS fReviewDate,
  170. w.f_feeid AS fFeeid,
  171. w.src_bill_no AS srcBillNo,
  172. w.f_mblno AS fMblno,
  173. w.f_product_name AS fProductName,
  174. w.f_marks AS fMarks,
  175. w.f_chargedate AS fChargedate,
  176. w.f_billing_days AS fBillingDays,
  177. w.f_billing_deadline AS fBillingDeadline,
  178. w.f_inventory_days AS fInventoryDays,
  179. w.f_originalbilldate AS fOriginalbilldate,
  180. f.f_name AS fFeeName,
  181. w.f_dc AS fSrcdc,
  182. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  183. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt
  184. FROM
  185. t_warehousebills t
  186. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  187. LEFT JOIN (
  188. SELECT
  189. f.f_id AS f_id,
  190. f.f_pid AS f_pid,
  191. f.f_lineno AS f_lineno,
  192. f.f_corpid,
  193. f.f_feeid,
  194. f.f_feeUnitid,
  195. f.f_qty,
  196. f.f_unitprice,
  197. f.f_amount,
  198. f.f_currency,
  199. f.f_exrate,
  200. f.f_taxrate,
  201. f.f_dc,
  202. f.f_billstatus,
  203. f.f_statement_no,
  204. f.f_accamount,
  205. f.f_accamount_date,
  206. f.f_stlamount_no,
  207. f.f_stlamount,
  208. f.f_stlamount_date,
  209. f.f_invnos,
  210. f.f_invamount,
  211. f.f_askamount,
  212. f.f_chargedate,
  213. f.f_status,
  214. f.remark,
  215. f.f_mblno,
  216. f.f_product_name,
  217. f.src_bill_no,
  218. f.f_billing_days,
  219. f.f_inventory_days,
  220. f.f_marks,
  221. f.f_billing_deadline,
  222. f.f_originalbilldate,
  223. c.f_id AS fId,
  224. c.f_name AS fName
  225. FROM
  226. t_warehousebillsfees AS f
  227. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  228. ) w ON w.f_pid = t.f_id
  229. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  230. <where>
  231. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  232. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  233. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  234. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  235. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  236. and w.f_accamount_date IS NOT NULL
  237. </if>
  238. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  239. and w.f_accamount_date IS NULL
  240. </if>
  241. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  242. and w.f_dc = #{map.tWareHouseFees.fDc}
  243. </if>
  244. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  245. and w.f_dc = #{map.tWareHouseFees.fDc}
  246. </if>
  247. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  248. and w.f_feeid in
  249. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  250. #{id}
  251. </foreach>
  252. </if>
  253. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  254. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  255. </if>
  256. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  257. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  258. </if>
  259. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  260. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  261. </if>
  262. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  263. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  264. </if>
  265. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  266. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  267. </if>
  268. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  269. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  270. </if>
  271. and t.f_review_date IS NOT NULL
  272. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  273. </where>
  274. </select>
  275. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  276. SELECT
  277. w.f_id AS fSrcid,
  278. t.f_id AS fSrcpid,
  279. t.f_corpid AS fCorpid,
  280. c.f_name AS fName,
  281. w.fId AS fId,
  282. w.fName AS fFeesName,
  283. t.f_bscorpno AS fBscorpno,
  284. w.f_mblno AS fMblno,
  285. w.f_product_name AS fProductName,
  286. t.f_bsdate AS fBsdate,
  287. t.f_billtype AS fBilltype,
  288. t.f_review_date AS fReviewDate,
  289. w.f_marks AS fMarks,
  290. w.f_feeid AS fFeeid,
  291. w.f_billtype AS fBilltype,
  292. w.f_chargedate AS fChargedate,
  293. w.f_originalbilldate AS fOriginalbilldate,
  294. w.f_billing_deadline AS fBillingDeadline,
  295. w.f_billing_days AS fBillingDays,
  296. w.f_inventory_days AS fInventoryDays,
  297. f.f_name AS fFeeName,
  298. w.f_dc AS fSrcdc,
  299. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  300. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt
  301. FROM
  302. t_warehousebills t
  303. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  304. LEFT JOIN (
  305. SELECT
  306. f.f_id AS f_id,
  307. f.f_pid AS f_pid,
  308. f.f_lineno AS f_lineno,
  309. f.f_corpid,
  310. f.f_feeid,
  311. f.f_feeUnitid,
  312. f.f_qty,
  313. f.f_unitprice,
  314. f.f_amount,
  315. f.f_currency,
  316. f.f_exrate,
  317. f.f_taxrate,
  318. f.f_dc,
  319. f.f_billstatus,
  320. f.f_statement_no,
  321. f.f_accamount,
  322. f.f_accamount_date,
  323. f.f_stlamount_no,
  324. f.f_stlamount,
  325. f.f_stlamount_date,
  326. f.f_invnos,
  327. f.f_invamount,
  328. f.f_askamount,
  329. f.f_status,
  330. f.remark,
  331. f.f_inventory_days,
  332. f.f_billing_days,
  333. f.f_billing_deadline,
  334. f.f_originalbilldate,
  335. f.f_mblno,
  336. f.f_product_name,
  337. f.f_chargedate,
  338. f.src_bill_no,
  339. f.f_billtype,
  340. f.f_marks,
  341. c.f_id AS fId,
  342. c.f_name AS fName
  343. FROM
  344. t_warehousebillsfees AS f
  345. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  346. ) w ON w.f_pid = t.f_id
  347. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  348. <where>
  349. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  350. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  351. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  352. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  353. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  354. and w.f_accamount_date IS NOT NULL
  355. </if>
  356. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  357. and w.f_accamount_date IS NULL
  358. </if>
  359. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  360. and w.f_dc = #{map.tWareHouseFees.fDc}
  361. </if>
  362. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  363. and w.f_dc = #{map.tWareHouseFees.fDc}
  364. </if>
  365. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  366. and w.f_feeid in
  367. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  368. #{id}
  369. </foreach>
  370. </if>
  371. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  372. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  373. </if>
  374. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  375. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  376. </if>
  377. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  378. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  379. </if>
  380. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  381. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  382. </if>
  383. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  384. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  385. </if>
  386. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  387. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  388. </if>
  389. and t.f_review_date IS NOT NULL
  390. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  391. </where>
  392. </select>
  393. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  394. SELECT
  395. w.f_id AS fSrcid,
  396. t.f_id AS fSrcpid,
  397. t.f_corpid AS fCorpid,
  398. c.f_name AS fName,
  399. w.fId AS fId,
  400. w.fName AS fFeesName,
  401. w.f_mblno AS fMblno,
  402. w.f_product_name AS fProductName,
  403. w.f_marks AS fMarks,
  404. t.f_billtype AS fBilltype,
  405. t.f_review_date AS fReviewDate,
  406. w.f_dc AS fSrcdc,
  407. SUM(w.f_amount) AS fAmount,
  408. SUM(w.f_stlamount) AS fStlamount
  409. FROM
  410. t_warehousebills t
  411. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  412. LEFT JOIN (
  413. SELECT
  414. f.f_id AS f_id,
  415. f.f_pid AS f_pid,
  416. f.f_lineno AS f_lineno,
  417. f.f_corpid,
  418. f.f_feeid,
  419. f.f_feeUnitid,
  420. f.f_qty,
  421. f.f_unitprice,
  422. f.f_amount,
  423. f.f_currency,
  424. f.f_exrate,
  425. f.f_taxrate,
  426. f.f_dc,
  427. f.f_billstatus,
  428. f.f_statement_no,
  429. f.f_accamount,
  430. f.f_accamount_date,
  431. f.f_stlamount_no,
  432. f.f_stlamount,
  433. f.f_stlamount_date,
  434. f.f_invnos,
  435. f.f_invamount,
  436. f.f_askamount,
  437. f.f_status,
  438. f.remark,
  439. f.f_mblno,
  440. f.f_product_name,
  441. f.f_marks,
  442. c.f_id AS fId,
  443. c.f_name AS fName
  444. FROM
  445. t_warehousebillsfees AS f
  446. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  447. ) w ON w.f_pid = t.f_id
  448. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  449. <where>
  450. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid} </if>
  451. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid} </if>
  452. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%') </if>
  453. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%') </if>
  454. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%', #{fProductName}, '%') </if>
  455. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  456. and w.f_billstatus != 6
  457. </if>
  458. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  459. and w.f_billstatus = 6
  460. </if>
  461. <if test='fDc != null and fDc != "" and fDc == "D" '>
  462. and w.f_dc = #{fDc}
  463. </if>
  464. <if test='fDc != null and fDc != "" and fDc == "C" '>
  465. and w.f_dc = #{fDc}
  466. </if>
  467. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  468. and t.f_review_date &gt;= #{timeExamine[0]}
  469. </if>
  470. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  471. and t.f_review_date &lt;= #{timeExamine[1]}
  472. </if>
  473. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  474. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  475. </if>
  476. and t.f_review_date IS NOT NULL
  477. GROUP BY
  478. w.f_pid,
  479. w.f_dc,
  480. w.f_corpid
  481. </where>
  482. </select>
  483. <select id="selectTWarehousebillsItemsList"
  484. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItem">
  485. SELECT
  486. ( @ii := @ii + 1 ) AS fId,
  487. wi.src_bill_no AS fMblno,
  488. CASE
  489. wi.f_billtype
  490. WHEN 'SJRK' THEN
  491. '入库'
  492. WHEN 'SJCK' THEN
  493. '出库'
  494. WHEN 'HQZY' THEN
  495. '货转'
  496. WHEN 'CKDB' THEN
  497. '调拨'
  498. WHEN 'KCZZ' THEN
  499. '库存总账'
  500. END AS fBilltype,
  501. wi.f_product_name AS fGoodsid,
  502. wi.f_marks AS fMarks,
  503. wi.f_qty AS fBillingQty,
  504. wi.f_bsdate AS fBsdate,
  505. wi.f_inventory_days AS fInventoryDays,
  506. wi.f_billing_days AS fBillingDays,
  507. f.f_name AS fFeeid,
  508. wi.f_accamount AS fAmt2
  509. FROM
  510. t_fee_do w
  511. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  512. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  513. ,(
  514. SELECT
  515. @ii := 0
  516. ) AS ii
  517. WHERE
  518. w.f_pid = #{fId}
  519. </select>
  520. </mapper>