FTmsaccbillsMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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.orderManagement.finance.mapper.FTmsaccbillsMapper">
  6. <resultMap type="FTmsaccbills" id="FTmsaccbillsResult">
  7. <result property="id" column="id" />
  8. <result property="accYear" column="acc_year" />
  9. <result property="accMonth" column="acc_month" />
  10. <result property="actId" column="act_id" />
  11. <result property="billNo" column="bill_no" />
  12. <result property="corpId" column="corp_id" />
  13. <result property="transactId" column="transact_id" />
  14. <result property="fromDate" column="from_date" />
  15. <result property="toDate" column="to_date" />
  16. <result property="amt" column="amt" />
  17. <result property="refNo" column="ref_no" />
  18. <result property="postDate" column="post_date" />
  19. <result property="billStatus" column="bill_status" />
  20. <result property="delFlag" column="del_flag" />
  21. <result property="createBy" column="create_by" />
  22. <result property="createTime" column="create_time" />
  23. <result property="updateBy" column="update_by" />
  24. <result property="updateTime" column="update_time" />
  25. <result property="remarks" column="remarks" />
  26. <result property="fCtrlcorpid" column="f_ctrlcorpid" />
  27. <result property="tMblno" column="t_mblno" />
  28. <result property="fBilltype" column="f_billtype" />
  29. <result property="fAccbilldate" column="f_accbilldate" />
  30. <result property="fBillno" column="f_billno" />
  31. <result property="chargingMethod" column="charging_method"/>
  32. <result property="invoiceNo" column="invoice_no"/>
  33. <result property="bank" column="bank"/>
  34. <result property="waterBillNo" column="water_bill_no"/>
  35. <result property="fCorpid" column="f_corpid"/>
  36. </resultMap>
  37. <sql id="selectFTmsaccbillsVo">
  38. select id, acc_year, acc_month, act_id, bill_no, corp_id, transact_id, from_date, to_date, amt, ref_no, post_date, bill_status, del_flag, create_by, create_time, update_by, update_time, remarks ,
  39. f_ctrlcorpid ,t_mblno ,f_billtype,f_accbilldate,f_billno,charging_method ,invoice_no , bank , water_bill_no ,f_corpid from F_TMSACCBILLS
  40. </sql>
  41. <select id="selectFTmsaccbillsList" parameterType="FTmsaccbills" resultMap="FTmsaccbillsResult">
  42. <include refid="selectFTmsaccbillsVo"/>
  43. <where>
  44. <if test="accYear != null "> and acc_year = #{accYear}</if>
  45. <if test="accMonth != null "> and acc_month = #{accMonth}</if>
  46. <if test="actId != null "> and act_id = #{actId}</if>
  47. <if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
  48. <if test="corpId != null "> and corp_id = #{corpId}</if>
  49. <if test="transactId != null "> and transact_id = #{transactId}</if>
  50. <if test="fromDate != null "> and from_date = #{fromDate}</if>
  51. <if test="toDate != null "> and to_date = #{toDate}</if>
  52. <if test="amt != null "> and amt = #{amt}</if>
  53. <if test="refNo != null and refNo != ''"> and ref_no = #{refNo}</if>
  54. <if test="postDate != null "> and post_date = #{postDate}</if>
  55. <if test="billStatus != null "> and bill_status = #{billStatus}</if>
  56. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  57. <if test="chargingMethod != null ">and charging_method = #{chargingMethod}</if>
  58. <if test="invoiceNo != null ">and invoice_no = #{invoiceNo}</if>
  59. <if test="bank != null ">and bank = #{bank}</if>
  60. <if test="waterBillNo != null ">and water_bill_no = #{waterBillNo}</if>
  61. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  62. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  63. and f_accbilldate &gt;= #{timeInterval[0]}
  64. </if>
  65. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  66. and f_accbilldate &lt;= #{timeInterval[1]}
  67. </if>
  68. </where>
  69. </select>
  70. <select id="selectFTmsaccbillsById" parameterType="Long" resultMap="FTmsaccbillsResult">
  71. <include refid="selectFTmsaccbillsVo"/>
  72. where id = #{id}
  73. </select>
  74. <insert id="insertFTmsaccbills" parameterType="FTmsaccbills" useGeneratedKeys="true" keyProperty="id">
  75. insert into F_TMSACCBILLS
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="accYear != null">acc_year,</if>
  78. <if test="accMonth != null">acc_month,</if>
  79. <if test="actId != null">act_id,</if>
  80. <if test="billNo != null">bill_no,</if>
  81. <if test="corpId != null">corp_id,</if>
  82. <if test="transactId != null">transact_id,</if>
  83. <if test="fromDate != null">from_date,</if>
  84. <if test="toDate != null">to_date,</if>
  85. <if test="amt != null">amt,</if>
  86. <if test="refNo != null">ref_no,</if>
  87. <if test="postDate != null">post_date,</if>
  88. <if test="billStatus != null">bill_status,</if>
  89. <if test="delFlag != null">del_flag,</if>
  90. <if test="createBy != null">create_by,</if>
  91. <if test="createTime != null">create_time,</if>
  92. <if test="updateBy != null">update_by,</if>
  93. <if test="updateTime != null">update_time,</if>
  94. <if test="remarks != null">remarks,</if>
  95. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  96. <if test="tMblno != null">t_mblno,</if>
  97. <if test="fBilltype != null">f_billtype,</if>
  98. <if test="fAccbilldate != null">f_accbilldate,</if>
  99. <if test="fBillno != null">f_billno,</if>
  100. <if test="chargingMethod != null">charging_method,</if>
  101. <if test="invoiceNo != null">invoice_no,</if>
  102. <if test="bank != null">bank,</if>
  103. <if test="waterBillNo != null">water_bill_no,</if>
  104. <if test="fCorpid != null">f_corpid,</if>
  105. </trim>
  106. <trim prefix="values (" suffix=")" suffixOverrides=",">
  107. <if test="accYear != null">#{accYear},</if>
  108. <if test="accMonth != null">#{accMonth},</if>
  109. <if test="actId != null">#{actId},</if>
  110. <if test="billNo != null">#{billNo},</if>
  111. <if test="corpId != null">#{corpId},</if>
  112. <if test="transactId != null">#{transactId},</if>
  113. <if test="fromDate != null">#{fromDate},</if>
  114. <if test="toDate != null">#{toDate},</if>
  115. <if test="amt != null">#{amt},</if>
  116. <if test="refNo != null">#{refNo},</if>
  117. <if test="postDate != null">#{postDate},</if>
  118. <if test="billStatus != null">#{billStatus},</if>
  119. <if test="delFlag != null">#{delFlag},</if>
  120. <if test="createBy != null">#{createBy},</if>
  121. <if test="createTime != null">#{createTime},</if>
  122. <if test="updateBy != null">#{updateBy},</if>
  123. <if test="updateTime != null">#{updateTime},</if>
  124. <if test="remarks != null">#{remarks},</if>
  125. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  126. <if test="tMblno != null">#{tMblno},</if>
  127. <if test="fBilltype != null">#{fBilltype},</if>
  128. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  129. <if test="fBillno != null">#{fBillno},</if>
  130. <if test="chargingMethod != null">#{chargingMethod},</if>
  131. <if test="invoiceNo != null">#{invoiceNo},</if>
  132. <if test="bank != null">#{bank},</if>
  133. <if test="waterBillNo != null">#{waterBillNo},</if>
  134. <if test="fCorpid != null">#{fCorpid},</if>
  135. </trim>
  136. </insert>
  137. <update id="updateFTmsaccbills" parameterType="FTmsaccbills">
  138. update F_TMSACCBILLS
  139. <trim prefix="SET" suffixOverrides=",">
  140. <if test="accYear != null">acc_year = #{accYear},</if>
  141. <if test="accMonth != null">acc_month = #{accMonth},</if>
  142. <if test="actId != null">act_id = #{actId},</if>
  143. <if test="billNo != null">bill_no = #{billNo},</if>
  144. <if test="corpId != null">corp_id = #{corpId},</if>
  145. <if test="transactId != null">transact_id = #{transactId},</if>
  146. <if test="fromDate != null">from_date = #{fromDate},</if>
  147. <if test="toDate != null">to_date = #{toDate},</if>
  148. <if test="amt != null">amt = #{amt},</if>
  149. <if test="refNo != null">ref_no = #{refNo},</if>
  150. <if test="postDate != null">post_date = #{postDate},</if>
  151. <if test="billStatus != null">bill_status = #{billStatus},</if>
  152. <if test="delFlag != null">del_flag = #{delFlag},</if>
  153. <if test="createBy != null">create_by = #{createBy},</if>
  154. <if test="createTime != null">create_time = #{createTime},</if>
  155. <if test="updateBy != null">update_by = #{updateBy},</if>
  156. <if test="updateTime != null">update_time = #{updateTime},</if>
  157. <if test="remarks != null">remarks = #{remarks},</if>
  158. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  159. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  160. <if test="bank != null">bank = #{bank},</if>
  161. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  162. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  163. </trim>
  164. where id = #{id}
  165. </update>
  166. <delete id="deleteFTmsaccbillsById" parameterType="Long">
  167. delete from F_TMSACCBILLS where id = #{id}
  168. </delete>
  169. <delete id="deleteFTmsaccbillsByIds" parameterType="String">
  170. delete from F_TMSACCBILLS where id in
  171. <foreach item="id" collection="array" open="(" separator="," close=")">
  172. #{id}
  173. </foreach>
  174. </delete>
  175. <select id="fTmsaccbillsListAccamount" resultType="java.util.Map">
  176. SELECT
  177. t.id AS fSrcpid,
  178. c1.f_name AS fName,
  179. w.f_id AS fSrcid,
  180. c.f_name AS fFeesName,
  181. w.f_mblno AS fMblno,
  182. w.f_product_name AS fProductName,
  183. w.create_time AS createTime,
  184. w.act_id AS actId,
  185. dict.dict_label AS billType,
  186. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  187. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  188. f.f_name AS fFeeName,
  189. w.f_dc AS fSrcdc,
  190. w.f_qty AS fQty,
  191. w.f_unitprice AS fUnitprice,
  192. w.f_amount AS fAmount,
  193. w.f_feeUnitid AS fFeeUnitid,
  194. t.load_date AS loadDate,
  195. t.un_load_date AS unLoadDate
  196. FROM
  197. F_TMSORDERBILLSFEES w
  198. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  199. LEFT JOIN t_corps AS c ON w.f_corpid = c.f_id
  200. LEFT JOIN F_TMSORDERBILLS AS t ON w.org_id = t.id
  201. LEFT JOIN t_corps AS c1 ON t.corp_id = c1.f_id
  202. LEFT JOIN sys_dict_data dict ON dict.dict_value = t.bill_type
  203. <where>
  204. dict.status = '0'
  205. AND dict.dict_type = 'data_billType'
  206. <if test="fCorpid != null and fCorpid != ''">and t.corp_id = #{ fCorpid} </if>
  207. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{ fToCorpid} </if>
  208. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{ fMblno}, '%') </if>
  209. <if test="fStatementNo != null and fStatementNo != ''">and w.f_statement_no like concat('%', #{ fStatementNo}, '%') </if>
  210. <if test='fReconciliation != null and fReconciliation != "" and fReconciliation == "1" '>
  211. and w.f_accamount_date IS NOT NULL
  212. </if>
  213. <if test=' fReconciliation != null and fReconciliation != "" and fReconciliation == "0" '>
  214. and w.f_accamount_date IS NULL
  215. </if>
  216. <if test=' fDc != null and fDc != "" and fDc == "D" '>
  217. and w.f_dc = #{ fDc}
  218. </if>
  219. <if test=' fDc != null and fDc != "" and fDc == "C" '>
  220. and w.f_dc = #{ fDc}
  221. </if>
  222. <if test=" fFeeid != null and fFeeid != '' ">
  223. and w.f_feeid in
  224. <foreach collection=" fFeeid" item="id" index="index" open="(" close=")" separator=",">
  225. #{id}
  226. </foreach>
  227. </if>
  228. <if test=' timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  229. and w.f_review_date &gt;= #{ timeExamine[0]}
  230. </if>
  231. <if test=' timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  232. and w.f_review_date &lt;= #{ timeExamine[1]}
  233. </if>
  234. <if test=' timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  235. and t.f_bsdate &gt;= #{ timeInterval[0]}
  236. </if>
  237. <if test=' timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  238. and t.f_bsdate &lt;= #{ timeInterval[1]}
  239. </if>
  240. <if test=' timeReconci != null and timeReconci[0] != null and timeReconci[0]!= ""'>
  241. and w.f_accamount_date &gt;= #{ timeReconci[0]}
  242. </if>
  243. <if test=' timeReconci != null and timeReconci[1] != null and timeReconci[1]!= ""'>
  244. and w.f_accamount_date &lt;= #{ timeReconci[1]}
  245. </if>
  246. <if test=" fBusinessType != null and fBusinessType != '' ">
  247. and w.f_business_type in
  248. <foreach collection=" fBusinessType" item="id" open="(" close=")" separator=",">
  249. #{id}
  250. </foreach>
  251. </if>
  252. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) != 0
  253. GROUP BY w.f_id
  254. </where>
  255. </select>
  256. <select id="fTmsaccbillsList" resultType="java.util.Map">
  257. SELECT
  258. w.f_id AS fSrcid,
  259. t.id AS fSrcpid ,
  260. t.corp_id AS fCorpid,
  261. c1.f_name AS fName,
  262. c.f_id AS fId,
  263. c.f_name AS fFeesName,
  264. w.f_mblno AS fMblno,
  265. w.f_product_name AS fProductName,
  266. w.create_time AS fBsdate,
  267. w.act_id AS fBilltype,
  268. dict.dict_label AS billType,
  269. w.f_feeid AS fFeeid,
  270. w.src_bill_no AS srcBillNo,
  271. f.f_name AS fFeeName,
  272. w.f_dc AS fSrcdc,
  273. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  274. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt
  275. FROM
  276. f_tmsorderbillsfees w
  277. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  278. LEFT JOIN t_corps AS c ON w.f_corpid = c.f_id
  279. LEFT JOIN f_tmsorderbills AS t ON w.org_id = t.id
  280. LEFT JOIN t_corps AS c1 ON t.corp_id = c1.f_id
  281. LEFT JOIN sys_dict_data dict ON dict.dict_value = t.bill_type
  282. <where>
  283. dict.status = '0'
  284. AND dict.dict_type = 'data_billType'
  285. <if test=" fCorpid != null and fCorpid != ''">and t.corp_id = #{ fCorpid} </if>
  286. <if test=" fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{ fToCorpid} </if>
  287. <if test=" fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{ fMblno}, '%') </if>
  288. <if test=" fStatementNo != null and fStatementNo != ''">and w.f_statement_no like concat('%', #{ fStatementNo}, '%') </if>
  289. <if test=' fReconciliation != null and fReconciliation != "" and fReconciliation == "1" '>
  290. and w.f_accamount_date IS NOT NULL
  291. </if>
  292. <if test=' fReconciliation != null and fReconciliation != "" and fReconciliation == "0" '>
  293. and w.f_accamount_date IS NULL
  294. </if>
  295. <if test=' fDc != null and fDc != "" and fDc == "D" '>
  296. and w.f_dc = #{ fDc}
  297. </if>
  298. <if test=' fDc != null and fDc != "" and fDc == "C" '>
  299. and w.f_dc = #{ fDc}
  300. </if>
  301. <if test=" fFeeid != null and fFeeid != '' ">
  302. and w.f_feeid in
  303. <foreach collection=" fFeeid" item="id" index="index" open="(" close=")" separator=",">
  304. #{id}
  305. </foreach>
  306. </if>
  307. <if test=' timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  308. and w.f_review_date &gt;= #{ timeExamine[0]}
  309. </if>
  310. <if test=' timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  311. and w.f_review_date &lt;= #{ timeExamine[1]}
  312. </if>
  313. <if test=' timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  314. and t.f_bsdate &gt;= #{ timeInterval[0]}
  315. </if>
  316. <if test=' timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  317. and t.f_bsdate &lt;= #{ timeInterval[1]}
  318. </if>
  319. <if test=' timeReconci != null and timeReconci[0] != null and timeReconci[0]!= ""'>
  320. and w.f_stlamount_date &gt;= #{ timeReconci[0]}
  321. </if>
  322. <if test=' timeReconci != null and timeReconci[1] != null and timeReconci[1]!= ""'>
  323. and w.f_stlamount_date &lt;= #{ timeReconci[1]}
  324. </if>
  325. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  326. GROUP BY w.f_id
  327. </where>
  328. </select>
  329. <select id="selectFTmsaccbillsMapList" parameterType="FTmsaccbills" resultType="java.util.Map">
  330. SELECT
  331. f.id AS fId,
  332. f.bill_no AS fBillno,
  333. f.f_ctrlcorpid AS fCtrlcorpid,
  334. f.corp_id AS fCorpid,
  335. c.f_name AS fCorpidName,
  336. f.f_accbilldate AS fAccbilldate,
  337. f.t_mblno AS tMblno,
  338. f.amt AS fAmtdr,
  339. f.f_billtype AS fBilltype,
  340. f.bill_status AS fBillstatus,
  341. f.remarks AS fRemarks,
  342. f.create_by AS createBy
  343. FROM
  344. F_TMSACCBILLS f
  345. LEFT JOIN t_corps AS c ON f.corp_id = c.f_id
  346. <where>
  347. <if test="actId != null "> and f.act_id = #{actId}</if>
  348. <if test="billNo != null and billNo != ''"> and f.bill_no = #{billNo}</if>
  349. <if test="corpId != null "> and f.corp_id = #{corpId}</if>
  350. <if test="fromDate != null "> and f.from_date = #{fromDate}</if>
  351. <if test="toDate != null "> and f.to_date = #{toDate}</if>
  352. <if test="amt != null "> and f.amt = #{amt}</if>
  353. <if test="refNo != null and refNo != ''"> and f.ref_no = #{refNo}</if>
  354. <if test="postDate != null "> and f.post_date = #{postDate}</if>
  355. <if test="billStatus != null "> and f.bill_status = #{billStatus}</if>
  356. <if test="remarks != null and remarks != ''"> and f.remarks = #{remarks}</if>
  357. </where>
  358. </select>
  359. </mapper>