ftmsorderbillsplansMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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.orderPlan.mapper.FtmsorderbillsplansMapper">
  6. <resultMap type="ftmsorderbillsplans" id="ftmsorderbillsplansResult">
  7. <result property="id" column="id"/>
  8. <result property="pId" column="p_id"/>
  9. <result property="orgId" column="org_id"/>
  10. <result property="cntrId" column="cntr_id"/>
  11. <result property="cntrQty" column="cntr_qty"/>
  12. <result property="carQty" column="car_qty"/>
  13. <result property="planCntrQty" column="plan_cntr_qty"/>
  14. <result property="carcorPid" column="carcor_pid"/>
  15. <result property="pricecrType" column="pricecr_type"/>
  16. <result property="pricecr" column="pricecr"/>
  17. <result property="ifNeedInvCr" column="if_need_inv_cr"/>
  18. <result property="transProp" column="trans_prop"/>
  19. <result property="carnolist" column="carnolist"/>
  20. <result property="planDate" column="plan_date"/>
  21. <result property="planreMarks" column="planre_marks"/>
  22. <result property="freightPriceDr" column="freight_price_dr"/>
  23. <result property="freightPriceCr" column="freight_price_cr"/>
  24. <result property="acceptDate" column="accept_date"/>
  25. <result property="acceptRemarks" column="accept_remarks"/>
  26. <result property="billStatus" column="bill_status"/>
  27. <result property="delFlag" column="del_flag"/>
  28. <result property="createBy" column="create_by"/>
  29. <result property="createTime" column="create_time"/>
  30. <result property="updateBy" column="update_by"/>
  31. <result property="updateTime" column="update_time"/>
  32. <result property="remarks" column="remarks"/>
  33. </resultMap>
  34. <sql id="selectftmsorderbillsplansVo">
  35. select id, p_id, org_id, cntr_id, cntr_qty, car_qty, plan_cntr_qty, carcor_pid, pricecr_type, pricecr, if_need_inv_cr, trans_prop, carnolist,
  36. plan_date, planre_marks, accept_date, accept_remarks, bill_status, del_flag, create_by, create_time, freight_price_dr, freight_price_cr,
  37. update_by, update_time, remarks from F_TMSORDERBILLSPLANS
  38. </sql>
  39. <select id="selectftmsorderbillsplansList" parameterType="ftmsorderbillsplans"
  40. resultMap="ftmsorderbillsplansResult">
  41. <include refid="selectftmsorderbillsplansVo"/>
  42. <where>
  43. <if test="pId != null ">and p_id = #{pId}</if>
  44. <if test="orgId != null ">and org_id = #{orgId}</if>
  45. <if test="cntrId != null ">and cntr_id = #{cntrId}</if>
  46. <if test="cntrQty != null ">and cntr_qty = #{cntrQty}</if>
  47. <if test="carQty != null ">and car_qty = #{carQty}</if>
  48. <if test="carQty != null ">and plan_cntr_qty = #{planCntrQty}</if>
  49. <if test="carcorPid != null ">and carcor_pid = #{carcorPid}</if>
  50. <if test="pricecrType != null and pricecrType != ''">and pricecr_type = #{pricecrType}</if>
  51. <if test="pricecr != null ">and pricecr = #{pricecr}</if>
  52. <if test="ifNeedInvCr != null and ifNeedInvCr != ''">and if_need_inv_cr = #{ifNeedInvCr}</if>
  53. <if test="transProp != null and transProp != ''">and trans_prop = #{transProp}</if>
  54. <if test="carnolist != null and carnolist != ''">and carnolist = #{carnolist}</if>
  55. <if test="planDate != null ">and plan_date = #{planDate}</if>
  56. <if test="planreMarks != null and planreMarks != ''">and planre_marks = #{planreMarks}</if>
  57. <if test="acceptDate != null ">and accept_date = #{acceptDate}</if>
  58. <if test="acceptRemarks != null and acceptRemarks != ''">and accept_remarks = #{acceptRemarks}</if>
  59. <if test="billStatus != null ">and bill_status = #{billStatus}</if>
  60. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  61. </where>
  62. </select>
  63. <select id="selectftmsorderbillsplansMapList" parameterType="ftmsorderbills" resultType="Map">
  64. SELECT
  65. plan.id,
  66. plan.carnolist,
  67. plan.car_qty AS carQty,
  68. plan.cntr_qty AS cntrQty,
  69. f.bill_no AS billNo,
  70. f.act_id AS actId,
  71. c.f_name AS corpId,
  72. sysCntr.dict_label AS cntrName,
  73. p.nick_name AS planUserId,
  74. a.nick_name AS transUserId,
  75. type.dict_label AS billType,
  76. trans.dict_label AS transType,
  77. prop.dict_label AS transProp,
  78. f.if_contracted AS ifContracted,
  79. f.contract_no AS contractNo,
  80. f.accstl_type AS accstlType,
  81. f.accdays,
  82. m.f_name AS carcorPid,
  83. f.load_addr AS loadAddr,
  84. f.md_load_addr AS mdLoadAddr,
  85. f.un_load_addr AS unLoadAddr,
  86. g.f_name AS goodsId,
  87. f.goods_price AS goodsPrice,
  88. f.mblno,
  89. f.load_date AS loadDate,
  90. f.qty_plan AS qtyPlan,
  91. f.qty_dis_patch AS qtyDisPatch,
  92. f.weight_plan AS weightPlan,
  93. plan.bill_status AS billStatus,
  94. f.create_time AS createTime
  95. FROM
  96. F_TMSORDERBILLSPLANS plan
  97. LEFT JOIN F_TMSORDERBILLS f ON f.id = plan.org_id
  98. LEFT JOIN sys_dict_data sysCntr ON sysCntr.dict_type = 'data_cntrId'
  99. AND sysCntr.dict_value = plan.cntr_id
  100. LEFT JOIN sys_dict_data type ON type.dict_type = 'data_billType'
  101. AND type.dict_value = f.bill_type
  102. LEFT JOIN sys_dict_data trans ON trans.dict_type = 'data_transType'
  103. AND trans.dict_value = f.trans_type
  104. LEFT JOIN sys_dict_data prop ON prop.dict_type = 'data_transProp'
  105. AND prop.dict_value = f.trans_prop
  106. LEFT JOIN t_corps m ON m.f_id = plan.carcor_pid
  107. LEFT JOIN t_corps c ON c.f_id = f.corp_id
  108. LEFT JOIN sys_user p ON p.user_id = f.plan_user_id
  109. LEFT JOIN sys_user a ON a.user_id = f.trans_user_id
  110. LEFT JOIN t_goods g ON g.f_id = f.goods_id
  111. WHERE
  112. plan.bill_status >= 6
  113. <if test="corpId != null and corpId != ''">
  114. AND f.corp_id = #{corpId}
  115. </if>
  116. <if test="actId != null and actId != 0">
  117. AND f.act_id = #{actId}
  118. </if>
  119. <if test="billType != null and billType != ''">
  120. AND f.bill_type = #{billType}
  121. </if>
  122. <if test="transType != null and transType != ''">
  123. AND f.trans_type = #{transType}
  124. </if>
  125. <if test="transProp != null and transProp != ''">
  126. AND f.trans_prop = #{transProp}
  127. </if>
  128. <if test="goodsId != null and goodsId != 0">
  129. AND f.goods_id = #{goodsId}
  130. </if>
  131. <if test="planBillStatus != null and planBillStatus != ''">
  132. AND plan.bill_status = #{planBillStatus}
  133. </if>
  134. <if test="mblno != null and mblno != ''">
  135. AND f.mblno LIKE "%${mblno}%"
  136. </if>
  137. <if test="loadAddr != null and loadAddr != ''">
  138. AND f.load_addr LIKE "%${loadAddr}%"
  139. </if>
  140. <if test="mdLoadAddr != null and mdLoadAddr != ''">
  141. AND f.md_load_addr LIKE "%${mdLoadAddr}%"
  142. </if>
  143. <if test="unLoadAddr != null and unLoadAddr != ''">
  144. AND f.un_load_addr LIKE "%${unLoadAddr}%"
  145. </if>
  146. <if test="billStatus != null and billStatus != ''">
  147. AND f.bill_status LIKE "%${billStatus}%"
  148. </if>
  149. ORDER BY plan.bill_status, plan.id asc
  150. </select>
  151. <select id="selectftmsorderbillsplansCountList" parameterType="ftmsorderbillsplans" resultType="int">
  152. select count(id) from F_TMSORDERBILLSPLANS
  153. <where>
  154. <if test="pId != null ">and p_id = #{pId}</if>
  155. <if test="orgId != null ">and org_id = #{orgId}</if>
  156. <if test="cntrId != null ">and cntr_id = #{cntrId}</if>
  157. <if test="cntrQty != null ">and cntr_qty = #{cntrQty}</if>
  158. <if test="carQty != null ">and car_qty = #{carQty}</if>
  159. <if test="carQty != null ">and plan_cntr_qty = #{planCntrQty}</if>
  160. <if test="carcorPid != null ">and carcor_pid = #{carcorPid}</if>
  161. <if test="pricecrType != null and pricecrType != ''">and pricecr_type = #{pricecrType}</if>
  162. <if test="pricecr != null ">and pricecr = #{pricecr}</if>
  163. <if test="ifNeedInvCr != null and ifNeedInvCr != ''">and if_need_inv_cr = #{ifNeedInvCr}</if>
  164. <if test="carnolist != null and carnolist != ''">and carnolist = #{carnolist}</if>
  165. <if test="planDate != null ">and plan_date = #{planDate}</if>
  166. <if test="planreMarks != null and planreMarks != ''">and planre_marks = #{planreMarks}</if>
  167. <if test="acceptDate != null ">and accept_date = #{acceptDate}</if>
  168. <if test="acceptRemarks != null and acceptRemarks != ''">and accept_remarks = #{acceptRemarks}</if>
  169. <if test="billStatus != null ">and bill_status = #{billStatus}</if>
  170. <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
  171. </where>
  172. </select>
  173. <select id="selectftmsorderbillsplansById" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  174. <include refid="selectftmsorderbillsplansVo"/>
  175. where id = #{id}
  176. </select>
  177. <select id="selectftmsorderbillsplansByPId" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  178. <include refid="selectftmsorderbillsplansVo"/>
  179. where p_id = #{id}
  180. </select>
  181. <select id="selectftmsorderbillsplansByOrgId" parameterType="Long" resultMap="ftmsorderbillsplansResult">
  182. <include refid="selectftmsorderbillsplansVo"/>
  183. where org_id = #{orgId}
  184. </select>
  185. <insert id="insertftmsorderbillsplans" parameterType="ftmsorderbillsplans" useGeneratedKeys="true" keyProperty="id">
  186. insert into F_TMSORDERBILLSPLANS
  187. <trim prefix="(" suffix=")" suffixOverrides=",">
  188. <if test="id != null">id,</if>
  189. <if test="pId != null">p_id,</if>
  190. <if test="orgId != null">org_id,</if>
  191. <if test="cntrId != null">cntr_id,</if>
  192. <if test="cntrQty != null">cntr_qty,</if>
  193. <if test="carQty != null">car_qty,</if>
  194. <if test="planCntrQty != null">plan_cntr_qty,</if>
  195. <if test="carcorPid != null">carcor_pid,</if>
  196. <if test="pricecrType != null">pricecr_type,</if>
  197. <if test="pricecr != null">pricecr,</if>
  198. <if test="ifNeedInvCr != null">if_need_inv_cr,</if>
  199. <if test="transProp != null">trans_prop,</if>
  200. <if test="carnolist != null">carnolist,</if>
  201. <if test="planDate != null">plan_date,</if>
  202. <if test="planreMarks != null">planre_marks,</if>
  203. <if test="acceptDate != null">accept_date,</if>
  204. <if test="acceptRemarks != null">accept_remarks,</if>
  205. <if test="billStatus != null">bill_status,</if>
  206. <if test="delFlag != null">del_flag,</if>
  207. <if test="createBy != null">create_by,</if>
  208. <if test="createTime != null">create_time,</if>
  209. <if test="updateBy != null">update_by,</if>
  210. <if test="updateTime != null">update_time,</if>
  211. <if test="remarks != null">remarks,</if>
  212. <if test="freightPriceDr != null">freight_price_dr,</if>
  213. <if test="freightPriceCr != null">freight_price_cr,</if>
  214. </trim>
  215. <trim prefix="values (" suffix=")" suffixOverrides=",">
  216. <if test="id != null">#{id},</if>
  217. <if test="pId != null">#{pId},</if>
  218. <if test="orgId != null">#{orgId},</if>
  219. <if test="cntrId != null">#{cntrId},</if>
  220. <if test="cntrQty != null">#{cntrQty},</if>
  221. <if test="carQty != null">#{carQty},</if>
  222. <if test="planCntrQty != null">#{planCntrQty},</if>
  223. <if test="carcorPid != null">#{carcorPid},</if>
  224. <if test="pricecrType != null">#{pricecrType},</if>
  225. <if test="pricecr != null">#{pricecr},</if>
  226. <if test="ifNeedInvCr != null">#{ifNeedInvCr},</if>
  227. <if test="transProp != null">#{transProp},</if>
  228. <if test="carnolist != null">#{carnolist},</if>
  229. <if test="planDate != null">#{planDate},</if>
  230. <if test="planreMarks != null">#{planreMarks},</if>
  231. <if test="acceptDate != null">#{acceptDate},</if>
  232. <if test="acceptRemarks != null">#{acceptRemarks},</if>
  233. <if test="billStatus != null">#{billStatus},</if>
  234. <if test="delFlag != null">#{delFlag},</if>
  235. <if test="createBy != null">#{createBy},</if>
  236. <if test="createTime != null">#{createTime},</if>
  237. <if test="updateBy != null">#{updateBy},</if>
  238. <if test="updateTime != null">#{updateTime},</if>
  239. <if test="remarks != null">#{remarks},</if>
  240. <if test="freightPriceDr != null">#{freightPriceDr},</if>
  241. <if test="freightPriceCr != null">#{freightPriceCr},</if>
  242. </trim>
  243. </insert>
  244. <update id="updateftmsorderbillsplans" parameterType="ftmsorderbillsplans">
  245. update F_TMSORDERBILLSPLANS
  246. <trim prefix="SET" suffixOverrides=",">
  247. <if test="pId != null">p_id = #{pId},</if>
  248. <if test="orgId != null">org_id = #{orgId},</if>
  249. <if test="cntrId != null">cntr_id = #{cntrId},</if>
  250. <if test="cntrQty != null">cntr_qty = #{cntrQty},</if>
  251. <if test="carQty != null">car_qty = #{carQty},</if>
  252. <if test="planCntrQty != null">plan_cntr_qty = #{planCntrQty},</if>
  253. <if test="carcorPid != null">carcor_pid = #{carcorPid},</if>
  254. <if test="pricecrType != null">pricecr_type = #{pricecrType},</if>
  255. <if test="pricecr != null">pricecr = #{pricecr},</if>
  256. <if test="ifNeedInvCr != null">if_need_inv_cr = #{ifNeedInvCr},</if>
  257. <if test="transProp != null">trans_prop = #{transProp},</if>
  258. <if test="carnolist != null">carnolist = #{carnolist},</if>
  259. <if test="planDate != null">plan_date = #{planDate},</if>
  260. <if test="freightPriceDr != null">freight_price_dr = #{freightPriceDr},</if>
  261. <if test="freightPriceCr != null">freight_price_cr = #{freightPriceCr},</if>
  262. <if test="planreMarks != null">planre_marks = #{planreMarks},</if>
  263. <if test="acceptDate != null">accept_date = #{acceptDate},</if>
  264. <if test="acceptRemarks != null">accept_remarks = #{acceptRemarks},</if>
  265. <if test="billStatus != null">bill_status = #{billStatus},</if>
  266. <if test="delFlag != null">del_flag = #{delFlag},</if>
  267. <if test="createBy != null">create_by = #{createBy},</if>
  268. <if test="createTime != null">create_time = #{createTime},</if>
  269. <if test="updateBy != null">update_by = #{updateBy},</if>
  270. <if test="updateTime != null">update_time = #{updateTime},</if>
  271. <if test="remarks != null">remarks = #{remarks},</if>
  272. </trim>
  273. where id = #{id}
  274. </update>
  275. <update id="updateTmsorderSplanStatusByOrgId" parameterType="ftmsorderbillsplans">
  276. update F_TMSORDERBILLSPLANS
  277. set bill_status = #{billStatus}
  278. where org_id = #{orgId}
  279. </update>
  280. <delete id="deleteftmsorderbillsplansById" parameterType="Long">
  281. delete from F_TMSORDERBILLSPLANS where id = #{id}
  282. </delete>
  283. <delete id="deleteftmsorderbillsplansByPId" parameterType="Long">
  284. delete from F_TMSORDERBILLSPLANS where p_id = #{pId}
  285. </delete>
  286. <delete id="deleteftmsorderbillsplansByOrgId" parameterType="Long">
  287. delete from F_TMSORDERBILLSPLANS where org_id = #{orgId}
  288. </delete>
  289. <delete id="deleteftmsorderbillsplansByIds" parameterType="String">
  290. delete from F_TMSORDERBILLSPLANS where id in
  291. <foreach item="id" collection="array" open="(" separator="," close=")">
  292. #{id}
  293. </foreach>
  294. </delete>
  295. </mapper>