TWarehouseAgreementitemsMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.warehouseBusiness.mapper.TWarehouseAgreementitemsMapper">
  6. <resultMap type="TWarehouseAgreementitems" id="TWarehouseAgreementitemsResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fLineno" column="f_lineno"/>
  10. <result property="fFeeid" column="f_feeid"/>
  11. <result property="fFeeunitid" column="f_feeUnitid"/>
  12. <result property="fFromdays" column="f_fromdays"/>
  13. <result property="fEndays" column="f_endays"/>
  14. <result property="fPrice" column="f_price"/>
  15. <result property="fStatus" column="f_status"/>
  16. <result property="delFlag" column="del_flag"/>
  17. <result property="createBy" column="create_by"/>
  18. <result property="createTime" column="create_time"/>
  19. <result property="updateBy" column="update_by"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="remark" column="remark"/>
  22. </resultMap>
  23. <sql id="selectTWarehouseAgreementitemsVo">
  24. select f_id, f_pid, f_lineno, f_feeid, f_feeUnitid, f_fromdays, f_endays, f_price, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_warehouse_agreementitems
  25. </sql>
  26. <select id="selectTWarehouseAgreementitemsList" parameterType="TWarehouseAgreementitems"
  27. resultMap="TWarehouseAgreementitemsResult">
  28. <include refid="selectTWarehouseAgreementitemsVo"/>
  29. <where>
  30. <if test="fPid != null ">and f_pid = #{fPid}</if>
  31. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  32. <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
  33. <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
  34. <if test="fFromdays != null ">and f_fromdays = #{fFromdays}</if>
  35. <if test="fEndays != null ">and f_endays = #{fEndays}</if>
  36. <if test="fPrice != null ">and f_price = #{fPrice}</if>
  37. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  38. </where>
  39. </select>
  40. <select id="selectTWarehouseAgreementList1" parameterType="TWarehouseAgreement"
  41. resultType="Map" >
  42. SELECT DISTINCT
  43. agre.f_id AS fId,
  44. corp.f_name AS fCorpid,
  45. agre.f_contractno AS fContractno,
  46. goods.f_name AS fGoodsid,
  47. agre.t_packages AS tPackages,
  48. agre.f_begindate AS fBegindate,
  49. agre.f_enddate AS fEnddate,
  50. agre.f_feetypeid AS fFeetypeid,
  51. agre.f_billstatus AS fBillstatus
  52. FROM
  53. t_warehouse_agreement agre
  54. LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
  55. LEFT JOIN t_goods goods ON goods.f_id = agre.f_goodsid
  56. <where>
  57. <if test="fBillno != null and fBillno != ''">and agre.f_billno = #{fBillno}</if>
  58. <if test="fContractno != null and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
  59. <if test="fDeptid != null ">and agre.f_deptid = #{fDeptid}</if>
  60. <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
  61. <if test="fGoodsid != null">and agre.f_goodsid = #{fGoodsid}</if>
  62. <if test="fStltypeid != null ">and agre.f_stltypeid = #{fStltypeid}</if>
  63. <if test="fFeetypeid != null ">and agre.f_feetypeid = #{fFeetypeid}</if>
  64. <if test="tPackages != null and tPackages != ''">and agre.t_packages = #{tPackages}</if>
  65. <if test="fTrademodeid != null ">and agre.f_trademodeid = #{fTrademodeid}</if>
  66. <if test="fFreedays != null ">and agre.f_freedays = #{fFreedays}</if>
  67. <if test="fBegindate != null ">and agre.f_begindate = #{fBegindate}</if>
  68. <if test="fEnddate != null ">and agre.f_enddate = #{fEnddate}</if>
  69. <if test="fBillstatus != null and fBillstatus != ''">and agre.f_billstatus = #{fBillstatus}</if>
  70. </where>
  71. </select>
  72. <select id="selectTWarehouseAgreementitemsById" parameterType="Long" resultMap="TWarehouseAgreementitemsResult">
  73. <include refid="selectTWarehouseAgreementitemsVo"/>
  74. where f_id = #{fId}
  75. </select>
  76. <!-- 联查计费规则信息 -->
  77. <select id="getItemsBytWarehouseAgreementMsg"
  78. resultMap="TWarehouseAgreementitemsResult"
  79. parameterType="object">
  80. SELECT
  81. items.f_id,
  82. items.f_pid,
  83. items.f_lineno,
  84. items.f_feeid,
  85. items.f_feeUnitid,
  86. items.f_fromdays,
  87. items.f_endays,
  88. items.f_price,
  89. items.f_status,
  90. items.del_flag,
  91. items.create_by,
  92. items.create_time,
  93. items.update_by,
  94. items.update_time,
  95. items.remark,
  96. agreement.f_warehouseid
  97. FROM
  98. t_warehouse_agreement AS agreement
  99. LEFT JOIN t_warehouse_agreementitems AS items ON agreement.f_id = items.f_pid
  100. <where>
  101. <if test="cangKey == '0'">AND JSON_CONTAINS( agreement.f_warehouseid -> '$[*]', #{cangKuZhi}, '$')</if>
  102. AND agreement.f_corpid = #{fCorpid}
  103. AND JSON_CONTAINS( agreement.t_packages -> '$[*]', #{fGoodsid}, '$')
  104. AND items.f_feeUnitid = #{feeUnitid}
  105. AND agreement.f_status = '0'
  106. AND agreement.del_flag = '0'
  107. AND agreement.f_feetypeid = '0'
  108. AND items.del_flag = '0'
  109. </where>
  110. ORDER BY
  111. items.f_fromdays
  112. </select>
  113. <select id="selectTWarehouseAgreementitemsList1" resultType="java.util.Map">
  114. SELECT DISTINCT
  115. agre.f_id AS fId,
  116. corp.f_name AS fCorpname,
  117. corp.f_id AS fCorpid,
  118. fee.f_name AS fName,
  119. fee.f_id AS feeFId,
  120. itme.f_feeUnitid AS fFeeUnitid,
  121. f_price AS fPrice
  122. FROM
  123. t_warehouse_agreement agre
  124. LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
  125. LEFT JOIN t_warehouse_agreementitems itme ON itme.f_pid = agre.f_id
  126. LEFT JOIN t_fees fee ON fee.f_id = itme.f_feeid
  127. Left JOIN t_goods goods ON goods.f_typeid = agre.t_packages
  128. <where>
  129. <if test="fLineno != null and fLineno != ''">and corp.f_id = #{fLineno}</if>
  130. <if test="fFeeid != null and fFeeid != ''">and goods.f_id = #{fFeeid}</if>
  131. and agre.f_billstatus = 6
  132. and agre.f_status = 0
  133. and agre.f_feetypeid = 1
  134. </where>
  135. </select>
  136. <select id="selectTWarehouseAgreementitemList" resultType="java.util.Map">
  137. SELECT DISTINCT
  138. agre.f_id AS fId,
  139. corp.f_name AS fCorpname,
  140. corp.f_id AS fCorpid,
  141. fee.f_name AS fName,
  142. fee.f_id AS feeFId,
  143. itme.f_feeUnitid AS fFeeUnitid,
  144. f_price AS fPrice,
  145. itme.remark AS remark
  146. FROM
  147. t_warehouse_agreement agre
  148. LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
  149. LEFT JOIN t_warehouse_agreementitems itme ON itme.f_pid = agre.f_id
  150. LEFT JOIN t_fees fee ON fee.f_id = itme.f_feeid
  151. Left JOIN t_goods goods ON goods.f_typeid = agre.t_packages
  152. <where>
  153. <if test="fCorpid != null and fCorpid != ''">
  154. and corp.f_id = #{fCorpid}
  155. and agre.f_dc = 'D'
  156. </if>
  157. <if test="fFeeid != null and fFeeid != ''">and goods.f_id = #{fFeeid}</if>
  158. <if test="fFleet != null and fFleet != ''">
  159. and corp.f_id = #{fFleet}
  160. and agre.f_dc = 'C'
  161. </if>
  162. <if test="fLabour != null and fLabour != ''">
  163. and corp.f_id = #{fLabour}
  164. and agre.f_dc = 'C'
  165. </if>
  166. <if test="fTaskType != null and fTaskType != ''">
  167. and agre.f_task_type = #{fTaskType}
  168. </if>
  169. <if test="fBilltype != null and fBilltype != ''">
  170. and agre.f_billtype like concat('%', #{fBilltype}, '%')
  171. </if>
  172. and agre.f_billstatus = 6
  173. and agre.f_status = 0
  174. and agre.f_feetypeid = 1
  175. </where>
  176. </select>
  177. <insert id="insertTWarehouseAgreementitems" parameterType="TWarehouseAgreementitems" useGeneratedKeys="true"
  178. keyProperty="fId">
  179. insert into t_warehouse_agreementitems
  180. <trim prefix="(" suffix=")" suffixOverrides=",">
  181. <if test="fPid != null">f_pid,</if>
  182. <if test="fLineno != null">f_lineno,</if>
  183. <if test="fFeeid != null">f_feeid,</if>
  184. <if test="fFeeunitid != null">f_feeUnitid,</if>
  185. <if test="fFromdays != null">f_fromdays,</if>
  186. <if test="fEndays != null">f_endays,</if>
  187. <if test="fPrice != null">f_price,</if>
  188. <if test="fStatus != null">f_status,</if>
  189. <if test="delFlag != null">del_flag,</if>
  190. <if test="createBy != null">create_by,</if>
  191. <if test="createTime != null">create_time,</if>
  192. <if test="updateBy != null">update_by,</if>
  193. <if test="updateTime != null">update_time,</if>
  194. <if test="remark != null">remark,</if>
  195. </trim>
  196. <trim prefix="values (" suffix=")" suffixOverrides=",">
  197. <if test="fPid != null">#{fPid},</if>
  198. <if test="fLineno != null">#{fLineno},</if>
  199. <if test="fFeeid != null">#{fFeeid},</if>
  200. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  201. <if test="fFromdays != null">#{fFromdays},</if>
  202. <if test="fEndays != null">#{fEndays},</if>
  203. <if test="fPrice != null">#{fPrice},</if>
  204. <if test="fStatus != null">#{fStatus},</if>
  205. <if test="delFlag != null">#{delFlag},</if>
  206. <if test="createBy != null">#{createBy},</if>
  207. <if test="createTime != null">#{createTime},</if>
  208. <if test="updateBy != null">#{updateBy},</if>
  209. <if test="updateTime != null">#{updateTime},</if>
  210. <if test="remark != null">#{remark},</if>
  211. </trim>
  212. </insert>
  213. <update id="updateTWarehouseAgreementitems" parameterType="TWarehouseAgreementitems">
  214. update t_warehouse_agreementitems
  215. <trim prefix="SET" suffixOverrides=",">
  216. <if test="fPid != null">f_pid = #{fPid},</if>
  217. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  218. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  219. <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
  220. <if test="fFromdays != null">f_fromdays = #{fFromdays},</if>
  221. <if test="fEndays != null">f_endays = #{fEndays},</if>
  222. <if test="fPrice != null">f_price = #{fPrice},</if>
  223. <if test="fStatus != null">f_status = #{fStatus},</if>
  224. <if test="delFlag != null">del_flag = #{delFlag},</if>
  225. <if test="createBy != null">create_by = #{createBy},</if>
  226. <if test="createTime != null">create_time = #{createTime},</if>
  227. <if test="updateBy != null">update_by = #{updateBy},</if>
  228. <if test="updateTime != null">update_time = #{updateTime},</if>
  229. <if test="remark != null">remark = #{remark},</if>
  230. </trim>
  231. where f_id = #{fId}
  232. </update>
  233. <delete id="deleteTWarehouseAgreementitemsById" parameterType="Long">
  234. delete from t_warehouse_agreementitems where f_id = #{fId}
  235. </delete>
  236. <delete id="deleteTWarehouseAgreementitemsByIds" parameterType="String">
  237. delete from t_warehouse_agreementitems where f_id in
  238. <foreach item="fId" collection="array" open="(" separator="," close=")">
  239. #{fId}
  240. </foreach>
  241. </delete>
  242. <delete id="deleteByFPid" parameterType="Long">
  243. delete from t_warehouse_agreementitems where f_pid = #{fId}
  244. </delete>
  245. <update id="agreementitemsFollowUpdate" parameterType="Long">
  246. update
  247. t_warehouse_agreementitems
  248. set f_status = #{fettle}
  249. where
  250. f_pid = #{fPid}
  251. </update>
  252. </mapper>