TFeeMapper.xml 11 KB

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