FTmsaccbillsitemsMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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.FTmsaccbillsitemsMapper">
  6. <resultMap type="FTmsaccbillsitems" id="FTmsaccbillsitemsResult">
  7. <result property="id" column="id" />
  8. <result property="fPid" column="f_pid" />
  9. <result property="fActId" column="f_act_id" />
  10. <result property="fSrcid" column="f_srcid" />
  11. <result property="orderNo" column="order_no" />
  12. <result property="fSrcpid" column="f_srcpid" />
  13. <result property="dc" column="dc" />
  14. <result property="fSrcdc" column="f_srcdc" />
  15. <result property="amtOrg" column="amt_org" />
  16. <result property="fLineno" column="f_lineno" />
  17. <result property="amtStl" column="amt_stl" />
  18. <result property="fFeeid" column="f_feeid" />
  19. <result property="amtBlc" column="amt_blc" />
  20. <result property="amtCur" column="amt_cur" />
  21. <result property="delFlag" column="del_flag" />
  22. <result property="fAmt" column="f_amt" />
  23. <result property="createBy" column="create_by" />
  24. <result property="fAmtdr" column="f_amtdr" />
  25. <result property="createTime" column="create_time" />
  26. <result property="fAmtStl" column="f_amt_stl" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="fAmtBlc" column="f_amt_blc" />
  29. <result property="updateTime" column="update_time" />
  30. <result property="fStatus" column="f_status" />
  31. <result property="fRemarks" column="f_remarks" />
  32. </resultMap>
  33. <sql id="selectFTmsaccbillsitemsVo">
  34. select id, f_pid, f_act_id, f_srcid, order_no, f_srcpid, dc, f_srcdc, amt_org, f_lineno, amt_stl, f_feeid, amt_blc, amt_cur, del_flag, f_amt, create_by, f_amtdr, create_time, f_amt_stl, update_by, f_amt_blc, update_time, f_status, f_remarks from F_TMSACCBILLSITEMS
  35. </sql>
  36. <select id="selectFTmsaccbillsitemsList" parameterType="FTmsaccbillsitems" resultMap="FTmsaccbillsitemsResult">
  37. <include refid="selectFTmsaccbillsitemsVo"/>
  38. <where>
  39. <if test="fPid != null "> and f_pid = #{fPid}</if>
  40. <if test="fActId != null "> and f_act_id = #{fActId}</if>
  41. <if test="fSrcid != null "> and f_srcid = #{fSrcid}</if>
  42. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  43. <if test="fSrcpid != null "> and f_srcpid = #{fSrcpid}</if>
  44. <if test="dc != null and dc != ''"> and dc = #{dc}</if>
  45. <if test="fSrcdc != null and fSrcdc != ''"> and f_srcdc = #{fSrcdc}</if>
  46. <if test="amtOrg != null "> and amt_org = #{amtOrg}</if>
  47. <if test="fLineno != null "> and f_lineno = #{fLineno}</if>
  48. <if test="amtStl != null "> and amt_stl = #{amtStl}</if>
  49. <if test="fFeeid != null "> and f_feeid = #{fFeeid}</if>
  50. <if test="amtBlc != null "> and amt_blc = #{amtBlc}</if>
  51. <if test="amtCur != null "> and amt_cur = #{amtCur}</if>
  52. <if test="fAmt != null "> and f_amt = #{fAmt}</if>
  53. <if test="fAmtdr != null "> and f_amtdr = #{fAmtdr}</if>
  54. <if test="fAmtStl != null "> and f_amt_stl = #{fAmtStl}</if>
  55. <if test="fAmtBlc != null "> and f_amt_blc = #{fAmtBlc}</if>
  56. <if test="fStatus != null and fStatus != ''"> and f_status = #{fStatus}</if>
  57. <if test="fRemarks != null and fRemarks != ''"> and f_remarks = #{fRemarks}</if>
  58. </where>
  59. </select>
  60. <select id="selectFTmsaccbillsitemsById" parameterType="Long" resultMap="FTmsaccbillsitemsResult">
  61. <include refid="selectFTmsaccbillsitemsVo"/>
  62. where id = #{id}
  63. </select>
  64. <select id="selectItemsMapById" resultType="java.util.Map">
  65. SELECT
  66. item.id itemId,
  67. t.id fSrcpid,
  68. c.f_name fFeesName,
  69. car.mblno fMblno,
  70. car.order_no orderNo,
  71. car.carreg_no carregNo,
  72. '对账' billType,
  73. date_format( car.accept_date, '%Y-%m-%d' ) AS acceptDate,
  74. t.load_addr loadAddr,
  75. t.md_load_addr mdLoadAddr,
  76. w.f_dc AS fSrcdc,
  77. w.f_qty fQty,
  78. cntr.dict_label cntrId,
  79. car.driver_name driverName,
  80. f.f_name fFeeName,
  81. w.f_feeid fFeeid,
  82. w.f_amount fAmount,
  83. w.f_amount fAmt
  84. FROM
  85. F_TMSACCBILLS tm
  86. LEFT JOIN F_TMSACCBILLSITEMS item ON tm.id = item.f_pid
  87. LEFT JOIN F_TMSORDERBILLS t ON t.id = item.f_srcpid
  88. LEFT JOIN F_TMSORDERBILLSCARS car ON car.org_id = t.id
  89. LEFT JOIN F_TMSORDERBILLSFEES w ON item.f_srcid = w.f_id
  90. LEFT JOIN t_corps c ON w.f_corpid = c.f_id
  91. LEFT JOIN sys_dict_data cntr ON cntr.dict_value = car.cntr_id
  92. AND cntr.dict_type = 'data_cntrId'
  93. AND cntr.status = '0'
  94. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  95. WHERE
  96. tm.id = #{id}
  97. GROUP BY item.id
  98. </select>
  99. <insert id="insertFTmsaccbillsitems" parameterType="FTmsaccbillsitems" useGeneratedKeys="true" keyProperty="id">
  100. insert into F_TMSACCBILLSITEMS
  101. <trim prefix="(" suffix=")" suffixOverrides=",">
  102. <if test="fPid != null">f_pid,</if>
  103. <if test="fActId != null">f_act_id,</if>
  104. <if test="fSrcid != null">f_srcid,</if>
  105. <if test="orderNo != null">order_no,</if>
  106. <if test="fSrcpid != null">f_srcpid,</if>
  107. <if test="dc != null">dc,</if>
  108. <if test="fSrcdc != null">f_srcdc,</if>
  109. <if test="amtOrg != null">amt_org,</if>
  110. <if test="fLineno != null">f_lineno,</if>
  111. <if test="amtStl != null">amt_stl,</if>
  112. <if test="fFeeid != null">f_feeid,</if>
  113. <if test="amtBlc != null">amt_blc,</if>
  114. <if test="amtCur != null">amt_cur,</if>
  115. <if test="delFlag != null">del_flag,</if>
  116. <if test="fAmt != null">f_amt,</if>
  117. <if test="createBy != null">create_by,</if>
  118. <if test="fAmtdr != null">f_amtdr,</if>
  119. <if test="createTime != null">create_time,</if>
  120. <if test="fAmtStl != null">f_amt_stl,</if>
  121. <if test="updateBy != null">update_by,</if>
  122. <if test="fAmtBlc != null">f_amt_blc,</if>
  123. <if test="updateTime != null">update_time,</if>
  124. <if test="fStatus != null">f_status,</if>
  125. <if test="fRemarks != null">f_remarks,</if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="fPid != null">#{fPid},</if>
  129. <if test="fActId != null">#{fActId},</if>
  130. <if test="fSrcid != null">#{fSrcid},</if>
  131. <if test="orderNo != null">#{orderNo},</if>
  132. <if test="fSrcpid != null">#{fSrcpid},</if>
  133. <if test="dc != null">#{dc},</if>
  134. <if test="fSrcdc != null">#{fSrcdc},</if>
  135. <if test="amtOrg != null">#{amtOrg},</if>
  136. <if test="fLineno != null">#{fLineno},</if>
  137. <if test="amtStl != null">#{amtStl},</if>
  138. <if test="fFeeid != null">#{fFeeid},</if>
  139. <if test="amtBlc != null">#{amtBlc},</if>
  140. <if test="amtCur != null">#{amtCur},</if>
  141. <if test="delFlag != null">#{delFlag},</if>
  142. <if test="fAmt != null">#{fAmt},</if>
  143. <if test="createBy != null">#{createBy},</if>
  144. <if test="fAmtdr != null">#{fAmtdr},</if>
  145. <if test="createTime != null">#{createTime},</if>
  146. <if test="fAmtStl != null">#{fAmtStl},</if>
  147. <if test="updateBy != null">#{updateBy},</if>
  148. <if test="fAmtBlc != null">#{fAmtBlc},</if>
  149. <if test="updateTime != null">#{updateTime},</if>
  150. <if test="fStatus != null">#{fStatus},</if>
  151. <if test="fRemarks != null">#{fRemarks},</if>
  152. </trim>
  153. </insert>
  154. <update id="updateFTmsaccbillsitems" parameterType="FTmsaccbillsitems">
  155. update F_TMSACCBILLSITEMS
  156. <trim prefix="SET" suffixOverrides=",">
  157. <if test="fPid != null">f_pid = #{fPid},</if>
  158. <if test="fActId != null">f_act_id = #{fActId},</if>
  159. <if test="fSrcid != null">f_srcid = #{fSrcid},</if>
  160. <if test="orderNo != null">order_no = #{orderNo},</if>
  161. <if test="fSrcpid != null">f_srcpid = #{fSrcpid},</if>
  162. <if test="dc != null">dc = #{dc},</if>
  163. <if test="fSrcdc != null">f_srcdc = #{fSrcdc},</if>
  164. <if test="amtOrg != null">amt_org = #{amtOrg},</if>
  165. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  166. <if test="amtStl != null">amt_stl = #{amtStl},</if>
  167. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  168. <if test="amtBlc != null">amt_blc = #{amtBlc},</if>
  169. <if test="amtCur != null">amt_cur = #{amtCur},</if>
  170. <if test="delFlag != null">del_flag = #{delFlag},</if>
  171. <if test="fAmt != null">f_amt = #{fAmt},</if>
  172. <if test="createBy != null">create_by = #{createBy},</if>
  173. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  174. <if test="createTime != null">create_time = #{createTime},</if>
  175. <if test="fAmtStl != null">f_amt_stl = #{fAmtStl},</if>
  176. <if test="updateBy != null">update_by = #{updateBy},</if>
  177. <if test="fAmtBlc != null">f_amt_blc = #{fAmtBlc},</if>
  178. <if test="updateTime != null">update_time = #{updateTime},</if>
  179. <if test="fStatus != null">f_status = #{fStatus},</if>
  180. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  181. </trim>
  182. where id = #{id}
  183. </update>
  184. <delete id="deleteFTmsaccbillsitemsById" parameterType="Long">
  185. delete from F_TMSACCBILLSITEMS where id = #{id}
  186. </delete>
  187. <delete id="deleteFTmsaccbillsitemsByIds" parameterType="String">
  188. delete from F_TMSACCBILLSITEMS where id in
  189. <foreach item="id" collection="array" open="(" separator="," close=")">
  190. #{id}
  191. </foreach>
  192. </delete>
  193. <delete id="deleteByFPid" parameterType="Long">
  194. delete from F_TMSACCBILLSITEMS where f_pid = #{fId}
  195. </delete>
  196. <update id="tfeeDoFollowUpdate" parameterType="Long">
  197. update
  198. F_TMSACCBILLSITEMS
  199. set f_status = #{fettle}
  200. where
  201. f_pid = #{fPid}
  202. </update>
  203. </mapper>