TFeeMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. FROM
  59. t_fee AS f
  60. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  61. <where>
  62. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  63. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  64. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  65. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  66. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  67. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  68. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  69. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  70. <if test="fRemarks != null and fRemarks != ''">and f.f_remarks = #{fRemarks}</if>
  71. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  72. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  73. </where>
  74. </select>
  75. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  76. <include refid="selectTFeeVo"/>
  77. where f_id = #{fId}
  78. </select>
  79. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  80. insert into t_fee
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="fBillno != null">f_billno,</if>
  83. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  84. <if test="fCorpid != null">f_corpid,</if>
  85. <if test="tMblno != null">t_mblno,</if>
  86. <if test="fAmtdr != null">f_amtdr,</if>
  87. <if test="fAmtcr != null">f_amtcr,</if>
  88. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  89. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  90. <if test="fRemarks != null">f_remarks,</if>
  91. <if test="fAccbilldate != null">f_accbilldate,</if>
  92. <if test="delFlag != null">del_flag,</if>
  93. <if test="createBy != null">create_by,</if>
  94. <if test="fDeptid != null">f_deptid,</if>
  95. <if test="createTime != null">create_time,</if>
  96. <if test="updateBy != null">update_by,</if>
  97. <if test="updateTime != null">update_time,</if>
  98. </trim>
  99. <trim prefix="values (" suffix=")" suffixOverrides=",">
  100. <if test="fBillno != null">#{fBillno},</if>
  101. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  102. <if test="fCorpid != null">#{fCorpid},</if>
  103. <if test="tMblno != null">#{tMblno},</if>
  104. <if test="fAmtdr != null">#{fAmtdr},</if>
  105. <if test="fAmtcr != null">#{fAmtcr},</if>
  106. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  107. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  108. <if test="fRemarks != null">#{fRemarks},</if>
  109. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  110. <if test="delFlag != null">#{delFlag},</if>
  111. <if test="createBy != null">#{createBy},</if>
  112. <if test="fDeptid != null">#{fDeptid},</if>
  113. <if test="createTime != null">#{createTime},</if>
  114. <if test="updateBy != null">#{updateBy},</if>
  115. <if test="updateTime != null">#{updateTime},</if>
  116. </trim>
  117. </insert>
  118. <update id="updateTFee" parameterType="TFee">
  119. update t_fee
  120. <trim prefix="SET" suffixOverrides=",">
  121. <if test="fBillno != null">f_billno = #{fBillno},</if>
  122. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  123. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  124. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  125. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  126. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  127. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  128. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  129. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  130. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  131. <if test="delFlag != null">del_flag = #{delFlag},</if>
  132. <if test="createBy != null">create_by = #{createBy},</if>
  133. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  134. <if test="createTime != null">create_time = #{createTime},</if>
  135. <if test="updateBy != null">update_by = #{updateBy},</if>
  136. <if test="updateTime != null">update_time = #{updateTime},</if>
  137. </trim>
  138. where f_id = #{fId}
  139. </update>
  140. <delete id="deleteTFeeById" parameterType="Long">
  141. delete from t_fee where f_id = #{fId}
  142. </delete>
  143. <delete id="deleteTFeeByIds" parameterType="String">
  144. delete from t_fee where f_id in
  145. <foreach item="fId" collection="array" open="(" separator="," close=")">
  146. #{fId}
  147. </foreach>
  148. </delete>
  149. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  150. SELECT
  151. w.f_id AS fSrcid,
  152. t.f_id AS fSrcpid,
  153. t.f_corpid AS fCorpid,
  154. c.f_name AS fName,
  155. w.fId AS fId,
  156. w.fName AS fFeesName,
  157. t.f_bscorpno AS fBscorpno,
  158. t.f_mblno AS fMblno,
  159. t.f_product_name AS fProductName,
  160. t.f_bsdate AS fBsdate,
  161. t.f_billtype AS fBilltype,
  162. t.f_review_date AS fReviewDate,
  163. w.f_amount AS fAmtdr,
  164. w.f_feeid AS fFeeid,
  165. f.f_name AS fFeeName,
  166. w.f_dc AS fSrcdc,
  167. w.f_amount AS fAmt
  168. FROM
  169. t_warehousebills t
  170. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  171. LEFT JOIN (
  172. SELECT
  173. f.f_id AS f_id,
  174. f.f_pid AS f_pid,
  175. f.f_lineno AS f_lineno,
  176. f.f_corpid,
  177. f.f_feeid,
  178. f.f_feeUnitid,
  179. f.f_qty,
  180. f.f_unitprice,
  181. f.f_amount,
  182. f.f_currency,
  183. f.f_exrate,
  184. f.f_taxrate,
  185. f.f_dc,
  186. f.f_billstatus,
  187. f.f_statement_no,
  188. f.f_accamount,
  189. f.f_accamount_date,
  190. f.f_stlamount_no,
  191. f.f_stlamount,
  192. f.f_stlamount_date,
  193. f.f_invnos,
  194. f.f_invamount,
  195. f.f_askamount,
  196. f.f_status,
  197. f.remark,
  198. c.f_id AS fId,
  199. c.f_name AS fName
  200. FROM
  201. t_warehousebillsfees AS f
  202. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  203. ) w ON w.f_pid = t.f_id
  204. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  205. <where>
  206. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid = #{map.tWareHouseFees.fCorpid} </if>
  207. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid = #{map.tWareHouseFees.fToCorpid} </if>
  208. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and t.f_mblno like concat('%', #{map.tWareHouseFees.fMblno}, '%') </if>
  209. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%') </if>
  210. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  211. and w.f_accamount_date IS NOT NULL
  212. </if>
  213. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  214. and w.f_accamount_date IS NULL
  215. </if>
  216. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  217. and w.f_dc = #{map.tWareHouseFees.fDc}
  218. </if>
  219. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  220. and w.f_dc = #{map.tWareHouseFees.fDc}
  221. </if>
  222. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  223. and w.f_feeid in
  224. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")" separator=",">
  225. #{id}
  226. </foreach>
  227. </if>
  228. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  229. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  230. </if>
  231. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  232. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  233. </if>
  234. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  235. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  236. </if>
  237. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  238. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  239. </if>
  240. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  241. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  242. </if>
  243. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  244. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  245. </if>
  246. and t.f_review_date IS NOT NULL
  247. </where>
  248. </select>
  249. </mapper>