TFeeMapper.xml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.finance.mapper.TFeeMapper">
  6. <resultMap type="TFee" id="TFeeResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  10. <result property="fActId" column="f_act_id"/>
  11. <result property="fCorpid" column="f_corpid"/>
  12. <result property="fTransActId" column="f_trans_act_id"/>
  13. <result property="tMblno" column="t_mblno"/>
  14. <result property="fAmtdr" column="f_amtdr"/>
  15. <result property="fAmtcr" column="f_amtcr"/>
  16. <result property="fBilltype" column="f_billtype"/>
  17. <result property="fBillstatus" column="f_billstatus"/>
  18. <result property="fRemarks" column="f_remarks"/>
  19. <result property="fFromDate" column="f_from_date"/>
  20. <result property="fAccbilldate" column="f_accbilldate"/>
  21. <result property="fToDate" column="f_to_date"/>
  22. <result property="fRefNo" column="f_ref_no"/>
  23. <result property="delFlag" column="del_flag"/>
  24. <result property="createBy" column="create_by"/>
  25. <result property="fDeptid" column="f_deptid"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="chargingMethod" column="charging_method"/>
  30. <result property="invoiceNo" column="invoice_no"/>
  31. <result property="bank" column="bank"/>
  32. <result property="waterBillNo" column="water_bill_no"/>
  33. </resultMap>
  34. <sql id="selectTFeeVo">
  35. select f_id, f_billno, f_ctrlcorpid, f_act_id, f_corpid, f_trans_act_id, t_mblno, f_amtdr, f_amtcr, f_billtype, f_billstatus, f_remarks, f_from_date, f_accbilldate, f_to_date, f_ref_no, del_flag, create_by, f_deptid, create_time, update_by,
  36. update_time,charging_method ,invoice_no , bank , water_bill_no from t_fee
  37. </sql>
  38. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  39. select
  40. ware.*
  41. from
  42. t_fee ware
  43. left join sys_user u on ware.create_by = u.user_name
  44. left join sys_dept d on ware.f_deptid = d.dept_id
  45. <where>
  46. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  47. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  48. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  49. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  50. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  51. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  52. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  53. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  54. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  55. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  56. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  57. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  58. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  59. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  60. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  61. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  62. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  63. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  64. </if>
  65. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  66. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  67. </if>
  68. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  69. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  70. <if test="bank != null ">and ware.bank = #{bank}</if>
  71. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  72. </where>
  73. ${params.dataScope}
  74. </select>
  75. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  76. SELECT
  77. f.f_id AS fId,
  78. f.f_billno AS fBillno,
  79. f.f_ctrlcorpid AS fCtrlcorpid,
  80. f.f_corpid AS fCorpid,
  81. c.f_name AS fCorpidName,
  82. f.f_accbilldate AS fAccbilldate,
  83. f.t_mblno AS tMblno,
  84. f.f_amtdr AS fAmtdr,
  85. f.f_amtcr AS fAmtcr,
  86. f.f_billtype AS fBilltype,
  87. CASE
  88. WHEN f.f_billstatus = '1' THEN '保存'
  89. WHEN f.f_billstatus = '2' THEN '暂存'
  90. WHEN f.f_billstatus = '3' THEN '审批驳回'
  91. WHEN f.f_billstatus = '4' THEN '提交审核'
  92. WHEN f.f_billstatus = '5' THEN '审核中'
  93. WHEN f.f_billstatus = '6' THEN '审核完成'
  94. END
  95. AS fBillstatus,
  96. f.f_remarks AS fRemarks,
  97. f.create_by AS createBy
  98. FROM
  99. t_fee AS f
  100. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  101. left join sys_user u on f.create_by = u.user_name
  102. left join sys_dept d on f.f_deptid = d.dept_id
  103. <where>
  104. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  105. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  106. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  107. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  108. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  109. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  110. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  111. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  112. <if test="fRemarks != null and fRemarks != ''">and f.f_remarks = #{fRemarks}</if>
  113. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  114. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  115. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  116. and f.f_accbilldate &gt;= #{timeInterval[0]}
  117. </if>
  118. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  119. and f.f_accbilldate &lt;= #{timeInterval[1]}
  120. </if>
  121. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  122. <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
  123. <if test="bank != null ">and f.bank = #{bank}</if>
  124. <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
  125. </where>
  126. ${params.dataScope}
  127. </select>
  128. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  129. <include refid="selectTFeeVo"/>
  130. where f_id = #{fId}
  131. </select>
  132. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  133. insert into t_fee
  134. <trim prefix="(" suffix=")" suffixOverrides=",">
  135. <if test="fId != null">f_id,</if>
  136. <if test="fBillno != null">f_billno,</if>
  137. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  138. <if test="fActId != null">f_act_id,</if>
  139. <if test="fCorpid != null">f_corpid,</if>
  140. <if test="fTransActId != null">f_trans_act_id,</if>
  141. <if test="tMblno != null">t_mblno,</if>
  142. <if test="fAmtdr != null">f_amtdr,</if>
  143. <if test="fAmtcr != null">f_amtcr,</if>
  144. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  145. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  146. <if test="fRemarks != null">f_remarks,</if>
  147. <if test="fFromDate != null">f_from_date,</if>
  148. <if test="fAccbilldate != null">f_accbilldate,</if>
  149. <if test="fToDate != null">f_to_date,</if>
  150. <if test="fRefNo != null">f_ref_no,</if>
  151. <if test="delFlag != null">del_flag,</if>
  152. <if test="createBy != null">create_by,</if>
  153. <if test="fDeptid != null">f_deptid,</if>
  154. <if test="createTime != null">create_time,</if>
  155. <if test="updateBy != null">update_by,</if>
  156. <if test="updateTime != null">update_time,</if>
  157. <if test="chargingMethod != null">charging_method,</if>
  158. <if test="invoiceNo != null">invoice_no,</if>
  159. <if test="bank != null">bank,</if>
  160. <if test="waterBillNo != null">water_bill_no,</if>
  161. </trim>
  162. <trim prefix="values (" suffix=")" suffixOverrides=",">
  163. <if test="fId != null">#{fId},</if>
  164. <if test="fBillno != null">#{fBillno},</if>
  165. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  166. <if test="fActId != null">#{fActId},</if>
  167. <if test="fCorpid != null">#{fCorpid},</if>
  168. <if test="fTransActId != null">#{fTransActId},</if>
  169. <if test="tMblno != null">#{tMblno},</if>
  170. <if test="fAmtdr != null">#{fAmtdr},</if>
  171. <if test="fAmtcr != null">#{fAmtcr},</if>
  172. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  173. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  174. <if test="fRemarks != null">#{fRemarks},</if>
  175. <if test="fFromDate != null">#{fFromDate},</if>
  176. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  177. <if test="fToDate != null">#{fToDate},</if>
  178. <if test="fRefNo != null">#{fRefNo},</if>
  179. <if test="delFlag != null">#{delFlag},</if>
  180. <if test="createBy != null">#{createBy},</if>
  181. <if test="fDeptid != null">#{fDeptid},</if>
  182. <if test="createTime != null">#{createTime},</if>
  183. <if test="updateBy != null">#{updateBy},</if>
  184. <if test="updateTime != null">#{updateTime},</if>
  185. <if test="chargingMethod != null">#{chargingMethod},</if>
  186. <if test="invoiceNo != null">#{invoiceNo},</if>
  187. <if test="bank != null">#{bank},</if>
  188. <if test="waterBillNo != null">#{waterBillNo},</if>
  189. </trim>
  190. </insert>
  191. <update id="updateTFee" parameterType="TFee">
  192. update t_fee
  193. <trim prefix="SET" suffixOverrides=",">
  194. <if test="fBillno != null">f_billno = #{fBillno},</if>
  195. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  196. <if test="fActId != null">f_act_id = #{fActId},</if>
  197. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  198. <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
  199. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  200. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  201. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  202. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  203. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  204. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  205. <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
  206. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  207. <if test="fToDate != null">f_to_date = #{fToDate},</if>
  208. <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
  209. <if test="delFlag != null">del_flag = #{delFlag},</if>
  210. <if test="createBy != null">create_by = #{createBy},</if>
  211. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  212. <if test="createTime != null">create_time = #{createTime},</if>
  213. <if test="updateBy != null">update_by = #{updateBy},</if>
  214. <if test="updateTime != null">update_time = #{updateTime},</if>
  215. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  216. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  217. <if test="bank != null">bank = #{bank},</if>
  218. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  219. </trim>
  220. where f_id = #{fId}
  221. </update>
  222. <delete id="deleteTFeeById" parameterType="Long">
  223. delete from t_fee where f_id = #{fId}
  224. </delete>
  225. <delete id="deleteTFeeByIds" parameterType="String">
  226. delete
  227. f.*,
  228. fd.*
  229. from
  230. t_fee f
  231. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  232. where f.f_id in
  233. <foreach item="fId" collection="array" open="(" separator="," close=")">
  234. #{fId}
  235. </foreach>
  236. </delete>
  237. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  238. SELECT
  239. w.f_id AS fSrcid,
  240. t.f_id AS fSrcpid,
  241. t.f_corpid AS fCorpid,
  242. c.f_name AS fName,
  243. w.fId AS fId,
  244. w.fName AS fFeesName,
  245. t.f_bscorpno AS fBscorpno,
  246. w.f_mblno AS fMblno,
  247. w.f_product_name AS fProductName,
  248. w.f_bsdate AS fBsdate,
  249. t.f_billtype AS fBilltype,
  250. t.f_review_date AS fReviewDate,
  251. w.f_feeid AS fFeeid,
  252. w.src_bill_no AS srcBillNo,
  253. w.f_mblno AS fMblno,
  254. w.f_product_name AS fProductName,
  255. w.f_marks AS fMarks,
  256. w.f_chargedate AS fChargedate,
  257. w.f_billing_days AS fBillingDays,
  258. w.f_billing_deadline AS fBillingDeadline,
  259. w.f_inventory_days AS fInventoryDays,
  260. w.f_originalbilldate AS fOriginalbilldate,
  261. f.f_name AS fFeeName,
  262. w.f_dc AS fSrcdc,
  263. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  264. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  265. dictIn.dict_label AS fBusinessType
  266. FROM
  267. t_warehousebills t
  268. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  269. LEFT JOIN (
  270. SELECT
  271. f.f_id AS f_id,
  272. f.f_pid AS f_pid,
  273. f.f_lineno AS f_lineno,
  274. f.f_corpid,
  275. f.f_feeid,
  276. f.f_feeUnitid,
  277. f.f_qty,
  278. f.f_unitprice,
  279. f.f_amount,
  280. f.f_currency,
  281. f.f_exrate,
  282. f.f_taxrate,
  283. f.f_dc,
  284. f.f_billstatus,
  285. f.f_statement_no,
  286. f.f_accamount,
  287. f.f_accamount_date,
  288. f.f_stlamount_no,
  289. f.f_stlamount,
  290. f.f_stlamount_date,
  291. f.f_invnos,
  292. f.f_invamount,
  293. f.f_askamount,
  294. f.f_chargedate,
  295. f.f_status,
  296. f.remark,
  297. f.f_mblno,
  298. f.f_product_name,
  299. f.src_bill_no,
  300. f.f_billing_days,
  301. f.f_inventory_days,
  302. f.f_marks,
  303. f.f_billing_deadline,
  304. f.f_originalbilldate,
  305. f.f_billtype,
  306. f.f_business_type,
  307. f.f_bsdate,
  308. c.f_id AS fId,
  309. c.f_name AS fName
  310. FROM
  311. t_warehousebillsfees AS f
  312. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  313. ) w ON w.f_pid = t.f_id
  314. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  315. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  316. <where>
  317. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  318. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  319. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  320. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  321. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  322. and w.f_accamount_date IS NOT NULL
  323. </if>
  324. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  325. and w.f_accamount_date IS NULL
  326. </if>
  327. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  328. and w.f_dc = #{map.tWareHouseFees.fDc}
  329. </if>
  330. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  331. and w.f_dc = #{map.tWareHouseFees.fDc}
  332. </if>
  333. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  334. and w.f_feeid in
  335. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  336. #{id}
  337. </foreach>
  338. </if>
  339. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  340. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  341. </if>
  342. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  343. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  344. </if>
  345. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  346. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  347. </if>
  348. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  349. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  350. </if>
  351. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  352. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  353. </if>
  354. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  355. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  356. </if>
  357. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  358. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  359. AND dictIn.dict_type = 'st_in_type'
  360. AND dictIn.status = '0'
  361. </if>
  362. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  363. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  364. AND dictIn.dict_type = 'st_out_type'
  365. AND dictIn.status = '0'
  366. </if>
  367. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  368. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  369. AND dictIn.dict_type = 'st_trans_type'
  370. AND dictIn.status = '0'
  371. </if>
  372. <if test="map.tWareHouseFees.fBilltype == null ">
  373. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  374. AND dictIn.status = '0'
  375. </if>
  376. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  377. and w.f_business_type in
  378. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  379. #{id}
  380. </foreach>
  381. </if>
  382. and t.f_review_date IS NOT NULL
  383. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) > 0
  384. GROUP BY w.f_id
  385. </where>
  386. </select>
  387. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  388. SELECT
  389. w.f_id AS fSrcid,
  390. t.f_id AS fSrcpid,
  391. t.f_corpid AS fCorpid,
  392. c.f_name AS fName,
  393. w.fName AS fFeesName,
  394. t.f_bscorpno AS fBscorpno,
  395. w.f_mblno AS fMblno,
  396. w.f_product_name AS fProductName,
  397. w.f_bsdate AS fBsdate,
  398. t.f_billtype AS fBilltype,
  399. t.f_review_date AS fReviewDate,
  400. w.f_marks AS fMarks,
  401. w.f_feeid AS fFeeid,
  402. w.f_billtype AS fBilltype,
  403. w.f_chargedate AS fChargedate,
  404. w.f_originalbilldate AS fOriginalbilldate,
  405. w.f_billing_deadline AS fBillingDeadline,
  406. w.f_billing_days AS fBillingDays,
  407. w.f_inventory_days AS fInventoryDays,
  408. f.f_name AS fFeeName,
  409. w.f_dc AS fSrcdc,
  410. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  411. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  412. dict.dict_label AS fFeeunitid,
  413. w.f_qty AS fQty ,
  414. w.f_unitprice AS fUnitprice ,
  415. dictIn.dict_label AS fBusinessType
  416. FROM
  417. t_warehousebills t
  418. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  419. LEFT JOIN (
  420. SELECT
  421. f.f_id AS f_id,
  422. f.f_pid AS f_pid,
  423. f.f_lineno AS f_lineno,
  424. f.f_corpid,
  425. f.f_feeid,
  426. f.f_feeUnitid,
  427. f.f_qty,
  428. f.f_unitprice,
  429. f.f_amount,
  430. f.f_currency,
  431. f.f_exrate,
  432. f.f_taxrate,
  433. f.f_dc,
  434. f.f_billstatus,
  435. f.f_statement_no,
  436. f.f_accamount,
  437. f.f_accamount_date,
  438. f.f_stlamount_no,
  439. f.f_stlamount,
  440. f.f_stlamount_date,
  441. f.f_invnos,
  442. f.f_invamount,
  443. f.f_askamount,
  444. f.f_status,
  445. f.remark,
  446. f.f_inventory_days,
  447. f.f_billing_days,
  448. f.f_billing_deadline,
  449. f.f_originalbilldate,
  450. f.f_mblno,
  451. f.f_product_name,
  452. f.f_chargedate,
  453. f.src_bill_no,
  454. f.f_billtype,
  455. f.f_marks,
  456. f.f_business_type,
  457. f.f_bsdate,
  458. c.f_id AS fId,
  459. c.f_name AS fName
  460. FROM
  461. t_warehousebillsfees AS f
  462. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  463. ) w ON w.f_pid = t.f_id
  464. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  465. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  466. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  467. <where>
  468. dict.status = '0'
  469. AND dict.dict_type = 'data_unitfees'
  470. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  471. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  472. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  473. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  474. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  475. and w.f_accamount_date IS NOT NULL
  476. </if>
  477. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  478. and w.f_accamount_date IS NULL
  479. </if>
  480. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  481. and w.f_dc = #{map.tWareHouseFees.fDc}
  482. </if>
  483. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  484. and w.f_dc = #{map.tWareHouseFees.fDc}
  485. </if>
  486. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  487. and w.f_feeid in
  488. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  489. #{id}
  490. </foreach>
  491. </if>
  492. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  493. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  494. </if>
  495. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  496. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  497. </if>
  498. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  499. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  500. </if>
  501. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  502. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  503. </if>
  504. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  505. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  506. </if>
  507. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  508. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  509. </if>
  510. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  511. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  512. AND dictIn.dict_type = 'st_in_type'
  513. AND dictIn.status = '0'
  514. </if>
  515. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  516. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  517. AND dictIn.dict_type = 'st_out_type'
  518. AND dictIn.status = '0'
  519. </if>
  520. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  521. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  522. AND dictIn.dict_type = 'st_trans_type'
  523. AND dictIn.status = '0'
  524. </if>
  525. <if test="map.tWareHouseFees.fBilltype == null ">
  526. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  527. AND dictIn.status = '0'
  528. </if>
  529. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  530. and w.f_business_type in
  531. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  532. #{id}
  533. </foreach>
  534. </if>
  535. and t.f_review_date IS NOT NULL
  536. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  537. GROUP BY w.f_id
  538. </where>
  539. </select>
  540. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  541. SELECT
  542. a.*,
  543. ifnull( a.fAmount, 0 ) - ifnull( a.fStlamount, 0 ) AS nnfinished
  544. FROM
  545. (
  546. SELECT
  547. w.f_id AS fSrcid,
  548. t.f_id AS fSrcpid,
  549. t.f_corpid AS fCorpid,
  550. c.f_name AS fName,
  551. w.fId AS fId,
  552. w.fName AS fFeesName,
  553. w.f_mblno AS fMblno,
  554. w.f_product_name AS fProductName,
  555. w.f_marks AS fMarks,
  556. t.f_billtype AS fBilltype,
  557. t.f_review_date AS fReviewDate,
  558. w.f_dc AS fSrcdc,
  559. SUM(w.f_amount) AS fAmount,
  560. SUM(w.f_stlamount) AS fStlamount
  561. FROM
  562. t_warehousebills t
  563. left join sys_user u on t.create_by = u.user_name
  564. left join sys_dept d on t.f_bsdeptid = d.dept_id
  565. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  566. LEFT JOIN (
  567. SELECT
  568. f.f_id AS f_id,
  569. f.f_pid AS f_pid,
  570. f.f_lineno AS f_lineno,
  571. f.f_corpid,
  572. f.f_feeid,
  573. f.f_feeUnitid,
  574. f.f_qty,
  575. f.f_unitprice,
  576. f.f_amount,
  577. f.f_currency,
  578. f.f_exrate,
  579. f.f_taxrate,
  580. f.f_dc,
  581. f.f_billstatus,
  582. f.f_statement_no,
  583. f.f_accamount,
  584. f.f_accamount_date,
  585. f.f_stlamount_no,
  586. f.f_stlamount,
  587. f.f_stlamount_date,
  588. f.f_invnos,
  589. f.f_invamount,
  590. f.f_askamount,
  591. f.f_status,
  592. f.remark,
  593. f.f_mblno,
  594. f.f_product_name,
  595. f.f_marks,
  596. c.f_id AS fId,
  597. c.f_name AS fName
  598. FROM
  599. t_warehousebillsfees AS f
  600. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  601. ) w ON w.f_pid = t.f_id
  602. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  603. <where>
  604. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid} </if>
  605. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid} </if>
  606. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%') </if>
  607. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%') </if>
  608. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%', #{fProductName}, '%') </if>
  609. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  610. and w.f_billstatus != 6
  611. </if>
  612. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  613. and w.f_billstatus = 6
  614. </if>
  615. <if test='fDc != null and fDc != "" and fDc == "D" '>
  616. and w.f_dc = #{fDc}
  617. </if>
  618. <if test='fDc != null and fDc != "" and fDc == "C" '>
  619. and w.f_dc = #{fDc}
  620. </if>
  621. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  622. and t.f_review_date &gt;= #{timeExamine[0]}
  623. </if>
  624. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  625. and t.f_review_date &lt;= #{timeExamine[1]}
  626. </if>
  627. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  628. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  629. </if>
  630. and t.f_review_date IS NOT NULL
  631. ${params.dataScope}
  632. GROUP BY
  633. w.f_pid,
  634. w.f_dc,
  635. w.f_corpid
  636. </where>
  637. ) a
  638. </select>
  639. <select id="selectTWarehousebillsItemsList"
  640. resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
  641. SELECT
  642. ( @ii := @ii + 1 ) AS fId,
  643. wi.f_mblno AS fMblno,
  644. wi.f_bsdate AS fBsdate,
  645. f.f_name AS fFeeid,
  646. CASE
  647. WHEN w.f_srcdc = 'D' THEN
  648. '收'
  649. WHEN w.f_srcdc = 'C' THEN
  650. '付'
  651. END AS fSrcdc,
  652. w.f_amtdr AS fAmtdr,
  653. dict.dict_label AS fFeeunitid,
  654. wi.f_qty AS fBillingQty,
  655. wi.f_unitprice AS fUnitprice,
  656. w.f_amt AS fAmt,
  657. wi.f_business_type AS fBusinessType,
  658. CASE
  659. wi.f_billtype
  660. WHEN 'SJRK' THEN
  661. '入库'
  662. WHEN 'SJCK' THEN
  663. '出库'
  664. WHEN 'HQZY' THEN
  665. '货转'
  666. WHEN 'CKDB' THEN
  667. '调拨'
  668. WHEN 'HWTG' THEN
  669. '货物通关'
  670. WHEN 'KCZZ' THEN
  671. '库存总账'
  672. END AS fBilltype,
  673. wi.f_product_name AS fGoodsid,
  674. wi.f_marks AS fMarks,
  675. wi.f_chargedate AS fChargedate,
  676. wi.f_billing_deadline AS fBillingDeadline,
  677. wi.f_inventory_days AS fInventoryDays,
  678. wi.f_billing_days AS fBillingDays,
  679. w.f_remarks AS fRemarks
  680. FROM
  681. t_fee_do w
  682. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  683. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  684. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  685. ,(
  686. SELECT
  687. @ii := 0
  688. ) AS ii
  689. WHERE
  690. dict.status = '0'
  691. AND dict.dict_type = 'data_unitfees'
  692. AND w.f_pid = #{fId}
  693. </select>
  694. <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
  695. SELECT
  696. t.f_id AS fSrcpid,
  697. c.f_name AS fName,
  698. c1.f_name AS fFeesName,
  699. w.f_mblno AS fMblno,
  700. w.f_product_name AS fProductName,
  701. w.f_marks AS fMarks,
  702. t.f_billtype AS fBilltype,
  703. w.f_review_date AS fReviewDate,
  704. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  705. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  706. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) nnfinished
  707. FROM
  708. t_warehousebillsfees w
  709. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  710. left join sys_user u on t.create_by = u.user_name
  711. left join sys_dept d on t.f_bsdeptid = d.dept_id
  712. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  713. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  714. <where>
  715. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid} </if>
  716. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid} </if>
  717. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%') </if>
  718. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%') </if>
  719. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%', #{fProductName}, '%') </if>
  720. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  721. and w.f_billstatus != 6
  722. </if>
  723. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  724. and w.f_billstatus = 6
  725. </if>
  726. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  727. and w.f_review_date &gt;= #{timeExamine[0]}
  728. </if>
  729. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  730. and w.f_review_date &lt;= #{timeExamine[1]}
  731. </if>
  732. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  733. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  734. </if>
  735. <if test="fBusinessType != null and fBusinessType != '' ">
  736. and w.f_business_type in
  737. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  738. #{id}
  739. </foreach>
  740. </if>
  741. <if test="fFeeid != null and fFeeid != '' ">
  742. and w.f_feeid in
  743. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  744. #{id}
  745. </foreach>
  746. </if>
  747. and w.f_review_date IS NOT NULL
  748. ${params.dataScope}
  749. GROUP BY
  750. w.f_mblno
  751. </where>
  752. </select>
  753. <select id="selectFeeList" resultType="java.util.Map">
  754. select
  755. ware.create_by AS createBy,
  756. ware.f_billno AS fBillno,
  757. ware.f_ctrlcorpid AS fCtrlcorpid,
  758. ware.create_time AS createTime,
  759. ware.f_accbilldate AS fAccbilldate,
  760. ware.t_mblno AS tMblno,
  761. dict.dict_label AS chargingMethod,
  762. ware.invoice_no AS invoiceNo,
  763. ware.bank AS bank,
  764. ware.water_bill_no AS waterBillNo,
  765. ware.f_amtdr AS fAmtdr,
  766. ware.f_amtcr AS fAmtcr,
  767. ware.f_remarks AS fRemarks,
  768. CASE
  769. WHEN ware.f_billstatus = '1' THEN '保存'
  770. WHEN ware.f_billstatus = '2' THEN '暂存'
  771. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  772. WHEN ware.f_billstatus = '4' THEN '提交审核'
  773. WHEN ware.f_billstatus = '5' THEN '审核中'
  774. WHEN ware.f_billstatus = '6' THEN '审核完成'
  775. END
  776. AS fBillstatus
  777. from
  778. t_fee ware
  779. left join sys_user u on ware.create_by = u.user_name
  780. left join sys_dept d on ware.f_deptid = d.dept_id
  781. LEFT JOIN sys_dict_data dict ON dict.dict_value = ware.charging_method
  782. <where>
  783. dict.status = '0'
  784. AND dict.dict_type = 'data_settlement_type'
  785. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  786. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  787. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  788. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  789. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  790. <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
  791. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  792. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  793. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  794. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  795. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  796. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  797. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  798. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  799. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  800. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  801. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  802. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  803. </if>
  804. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  805. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  806. </if>
  807. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  808. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  809. <if test="bank != null ">and ware.bank = #{bank}</if>
  810. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  811. </where>
  812. ${params.dataScope}
  813. </select>
  814. <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
  815. SELECT
  816. ( @ii := @ii + 1 ) AS fId,
  817. wi.f_mblno AS fMblno,
  818. wi.f_bsdate AS fBsdate,
  819. t.f_bscorpno AS fBscorpno,
  820. f.f_name AS fFeeid,
  821. CASE
  822. WHEN w.f_srcdc = 'D' THEN
  823. '收'
  824. WHEN w.f_srcdc = 'C' THEN
  825. '付'
  826. END AS fSrcdc,
  827. w.f_amtdr AS fAmtdr,
  828. dict.dict_label AS fFeeunitid,
  829. wi.f_qty AS fBillingQty,
  830. wi.f_unitprice AS fUnitprice,
  831. w.f_amt AS fAmt,
  832. wi.f_business_type AS fBusinessType,
  833. CASE
  834. wi.f_billtype
  835. WHEN 'SJRK' THEN
  836. '入库'
  837. WHEN 'SJCK' THEN
  838. '出库'
  839. WHEN 'HQZY' THEN
  840. '货转'
  841. WHEN 'CKDB' THEN
  842. '调拨'
  843. WHEN 'HWTG' THEN
  844. '货物通关'
  845. WHEN 'KCZZ' THEN
  846. '库存总账'
  847. END AS fBilltype,
  848. wi.f_product_name AS fGoodsid,
  849. wi.f_marks AS fMarks,
  850. w.f_remarks AS fRemarks
  851. FROM
  852. t_fee_do w
  853. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  854. LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
  855. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  856. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  857. ,(
  858. SELECT
  859. @ii := 0
  860. ) AS ii
  861. WHERE
  862. dict.status = '0'
  863. AND dict.dict_type = 'data_unitfees'
  864. AND w.f_pid = #{fId}
  865. </select>
  866. </mapper>