TFeeMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. t.f_mblno AS fMblno,
  166. t.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. f.f_name AS fFeeName,
  172. w.f_dc AS fSrcdc,
  173. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmtdr,
  174. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS fAmt
  175. FROM
  176. t_warehousebills t
  177. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  178. LEFT JOIN (
  179. SELECT
  180. f.f_id AS f_id,
  181. f.f_pid AS f_pid,
  182. f.f_lineno AS f_lineno,
  183. f.f_corpid,
  184. f.f_feeid,
  185. f.f_feeUnitid,
  186. f.f_qty,
  187. f.f_unitprice,
  188. f.f_amount,
  189. f.f_currency,
  190. f.f_exrate,
  191. f.f_taxrate,
  192. f.f_dc,
  193. f.f_billstatus,
  194. f.f_statement_no,
  195. f.f_accamount,
  196. f.f_accamount_date,
  197. f.f_stlamount_no,
  198. f.f_stlamount,
  199. f.f_stlamount_date,
  200. f.f_invnos,
  201. f.f_invamount,
  202. f.f_askamount,
  203. f.f_status,
  204. f.remark,
  205. c.f_id AS fId,
  206. c.f_name AS fName
  207. FROM
  208. t_warehousebillsfees AS f
  209. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  210. ) w ON w.f_pid = t.f_id
  211. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  212. <where>
  213. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  214. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  215. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and t.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  216. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  217. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  218. and w.f_accamount_date IS NOT NULL
  219. </if>
  220. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  221. and w.f_accamount_date IS NULL
  222. </if>
  223. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  224. and w.f_dc = #{map.tWareHouseFees.fDc}
  225. </if>
  226. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  227. and w.f_dc = #{map.tWareHouseFees.fDc}
  228. </if>
  229. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  230. and w.f_feeid in
  231. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  232. #{id}
  233. </foreach>
  234. </if>
  235. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  236. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  237. </if>
  238. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  239. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  240. </if>
  241. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  242. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  243. </if>
  244. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  245. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  246. </if>
  247. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  248. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  249. </if>
  250. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  251. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  252. </if>
  253. and t.f_review_date IS NOT NULL
  254. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  255. </where>
  256. </select>
  257. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  258. SELECT
  259. w.f_id AS fSrcid,
  260. t.f_id AS fSrcpid,
  261. t.f_corpid AS fCorpid,
  262. c.f_name AS fName,
  263. w.fId AS fId,
  264. w.fName AS fFeesName,
  265. t.f_bscorpno AS fBscorpno,
  266. t.f_mblno AS fMblno,
  267. t.f_product_name AS fProductName,
  268. t.f_bsdate AS fBsdate,
  269. t.f_billtype AS fBilltype,
  270. t.f_review_date AS fReviewDate,
  271. w.f_feeid AS fFeeid,
  272. f.f_name AS fFeeName,
  273. w.f_dc AS fSrcdc,
  274. ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmtdr,
  275. ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) AS fAmt
  276. FROM
  277. t_warehousebills t
  278. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  279. LEFT JOIN (
  280. SELECT
  281. f.f_id AS f_id,
  282. f.f_pid AS f_pid,
  283. f.f_lineno AS f_lineno,
  284. f.f_corpid,
  285. f.f_feeid,
  286. f.f_feeUnitid,
  287. f.f_qty,
  288. f.f_unitprice,
  289. f.f_amount,
  290. f.f_currency,
  291. f.f_exrate,
  292. f.f_taxrate,
  293. f.f_dc,
  294. f.f_billstatus,
  295. f.f_statement_no,
  296. f.f_accamount,
  297. f.f_accamount_date,
  298. f.f_stlamount_no,
  299. f.f_stlamount,
  300. f.f_stlamount_date,
  301. f.f_invnos,
  302. f.f_invamount,
  303. f.f_askamount,
  304. f.f_status,
  305. f.remark,
  306. c.f_id AS fId,
  307. c.f_name AS fName
  308. FROM
  309. t_warehousebillsfees AS f
  310. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  311. ) w ON w.f_pid = t.f_id
  312. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  313. <where>
  314. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  315. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  316. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and t.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  317. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  318. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  319. and w.f_accamount_date IS NOT NULL
  320. </if>
  321. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  322. and w.f_accamount_date IS NULL
  323. </if>
  324. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  325. and w.f_dc = #{map.tWareHouseFees.fDc}
  326. </if>
  327. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  328. and w.f_dc = #{map.tWareHouseFees.fDc}
  329. </if>
  330. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  331. and w.f_feeid in
  332. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  333. #{id}
  334. </foreach>
  335. </if>
  336. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  337. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  338. </if>
  339. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  340. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  341. </if>
  342. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  343. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  344. </if>
  345. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  346. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  347. </if>
  348. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  349. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  350. </if>
  351. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  352. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  353. </if>
  354. and t.f_review_date IS NOT NULL
  355. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  356. </where>
  357. </select>
  358. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  359. SELECT
  360. w.f_id AS fSrcid,
  361. t.f_id AS fSrcpid,
  362. t.f_corpid AS fCorpid,
  363. c.f_name AS fName,
  364. w.fId AS fId,
  365. w.fName AS fFeesName,
  366. t.f_mblno AS fMblno,
  367. t.f_product_name AS fProductName,
  368. t.f_marks AS fMarks,
  369. t.f_billtype AS fBilltype,
  370. t.f_review_date AS fReviewDate,
  371. w.f_dc AS fSrcdc,
  372. SUM(w.f_amount) AS fAmount,
  373. SUM(w.f_stlamount) AS fStlamount
  374. FROM
  375. t_warehousebills t
  376. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  377. LEFT JOIN (
  378. SELECT
  379. f.f_id AS f_id,
  380. f.f_pid AS f_pid,
  381. f.f_lineno AS f_lineno,
  382. f.f_corpid,
  383. f.f_feeid,
  384. f.f_feeUnitid,
  385. f.f_qty,
  386. f.f_unitprice,
  387. f.f_amount,
  388. f.f_currency,
  389. f.f_exrate,
  390. f.f_taxrate,
  391. f.f_dc,
  392. f.f_billstatus,
  393. f.f_statement_no,
  394. f.f_accamount,
  395. f.f_accamount_date,
  396. f.f_stlamount_no,
  397. f.f_stlamount,
  398. f.f_stlamount_date,
  399. f.f_invnos,
  400. f.f_invamount,
  401. f.f_askamount,
  402. f.f_status,
  403. f.remark,
  404. c.f_id AS fId,
  405. c.f_name AS fName
  406. FROM
  407. t_warehousebillsfees AS f
  408. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  409. ) w ON w.f_pid = t.f_id
  410. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  411. <where>
  412. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid} </if>
  413. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid} </if>
  414. <if test="fMblno != null and fMblno != ''">and t.f_mblno like concat('%', #{fMblno}, '%') </if>
  415. <if test="fMarks != null and fMarks != ''">and t.f_marks like concat('%', #{fMarks}, '%') </if>
  416. <if test="fProductName != null and fProductName != ''">and t.f_product_name like concat('%', #{fProductName}, '%') </if>
  417. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  418. and w.f_billstatus != 1
  419. </if>
  420. <if test='fBillstatus!= null and fBillstatus != "" and fBillstatus == "0" '>
  421. and w.f_billstatus = 1
  422. </if>
  423. <if test='fDc != null and fDc != "" and fDc == "D" '>
  424. and w.f_dc = #{fDc}
  425. </if>
  426. <if test='fDc != null and fDc != "" and fDc == "C" '>
  427. and w.f_dc = #{fDc}
  428. </if>
  429. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  430. and t.f_review_date &gt;= #{timeExamine[0]}
  431. </if>
  432. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  433. and t.f_review_date &lt;= #{timeExamine[1]}
  434. </if>
  435. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  436. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  437. </if>
  438. and t.f_review_date IS NOT NULL
  439. GROUP BY
  440. w.f_pid,
  441. w.f_dc,
  442. w.f_corpid
  443. </where>
  444. </select>
  445. </mapper>